Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/webdriveragent.js
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ export class WebDriverAgent {
base: this.basePath,
timeout: this.wdaConnectionTimeout,
keepAlive: true,
scheme: this.url.protocol ? this.url.protocol.replace(':', '') : 'http',
};
if (this.args.reqBasePath) {
proxyOpts.reqBasePath = this.args.reqBasePath;
Expand Down
24 changes: 24 additions & 0 deletions test/unit/webdriveragent-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ describe('launch', function () {
agent.jwproxy.server.should.eql('mockurl');
agent.jwproxy.port.should.eql(8100);
agent.jwproxy.base.should.eql('');
agent.jwproxy.scheme.should.eql('http');
agent.noSessionProxy.server.should.eql('mockurl');
agent.noSessionProxy.port.should.eql(8100);
agent.noSessionProxy.base.should.eql('');
agent.noSessionProxy.scheme.should.eql('http');
wdaStub.reset();
});
});
Expand All @@ -99,9 +101,11 @@ describe('use wda proxy url', function () {
agent.jwproxy.server.should.eql('127.0.0.1');
agent.jwproxy.port.should.eql(8100);
agent.jwproxy.base.should.eql('/aabbccdd');
agent.jwproxy.scheme.should.eql('http');
agent.noSessionProxy.server.should.eql('127.0.0.1');
agent.noSessionProxy.port.should.eql(8100);
agent.noSessionProxy.base.should.eql('/aabbccdd');
agent.noSessionProxy.scheme.should.eql('http');
});
});

Expand All @@ -110,6 +114,9 @@ describe('get url', function () {
const args = Object.assign({}, fakeConstructorArgs);
const agent = new WebDriverAgent({}, args);
agent.url.href.should.eql('http://127.0.0.1:8100/');
agent.setupProxies('mysession');
agent.jwproxy.scheme.should.eql('http');
agent.noSessionProxy.scheme.should.eql('http');
});
it('should use default WDA listening url with emply base url', function () {
const wdaLocalPort = '9100';
Expand All @@ -121,6 +128,9 @@ describe('get url', function () {

const agent = new WebDriverAgent({}, args);
agent.url.href.should.eql('http://127.0.0.1:9100/');
agent.setupProxies('mysession');
agent.jwproxy.scheme.should.eql('http');
agent.noSessionProxy.scheme.should.eql('http');
});
it('should use customised WDA listening url', function () {
const wdaLocalPort = '9100';
Expand All @@ -132,6 +142,9 @@ describe('get url', function () {

const agent = new WebDriverAgent({}, args);
agent.url.href.should.eql('http://mockurl:9100/');
agent.setupProxies('mysession');
agent.jwproxy.scheme.should.eql('http');
agent.noSessionProxy.scheme.should.eql('http');
});
it('should use customised WDA listening url with slash', function () {
const wdaLocalPort = '9100';
Expand All @@ -143,6 +156,9 @@ describe('get url', function () {

const agent = new WebDriverAgent({}, args);
agent.url.href.should.eql('http://mockurl:9100/');
agent.setupProxies('mysession');
agent.jwproxy.scheme.should.eql('http');
agent.noSessionProxy.scheme.should.eql('http');
});
it('should use the given webDriverAgentUrl and ignore other params', function () {
const args = Object.assign({}, fakeConstructorArgs);
Expand All @@ -153,6 +169,14 @@ describe('get url', function () {
const agent = new WebDriverAgent({}, args);
agent.url.href.should.eql('https://127.0.0.1:8100/');
});
it('should set scheme to https for https webDriverAgentUrl', function () {
const args = Object.assign({}, fakeConstructorArgs);
args.webDriverAgentUrl = 'https://127.0.0.1:8100/';
const agent = new WebDriverAgent({}, args);
agent.setupProxies('mysession');
agent.jwproxy.scheme.should.eql('https');
agent.noSessionProxy.scheme.should.eql('https');
});
});

describe('setupCaching()', function () {
Expand Down
Loading