Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gravityvi committed Sep 22, 2023
1 parent 1fb8512 commit 0b1f4b5
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 28 deletions.
32 changes: 30 additions & 2 deletions test/src/core/testCreateSession.js
Expand Up @@ -47,6 +47,8 @@ describe('test Request With Credentials', function () {
});
assert.deepStrictEqual(result, {
sessionId: '1352110219202',
host: 'localhost',
port: 10195,
capabilities: {browserName: 'firefox', version: 'TEST', platform: 'TEST'}
});
});
Expand Down Expand Up @@ -79,6 +81,8 @@ describe('test Request With Credentials', function () {
});
assert.deepStrictEqual(result, {
sessionId: '1352110219202',
host: 'localhost',
port: 10195,
capabilities: {
browserName: 'chrome', version: 'TEST', platform: 'TEST'
}
Expand Down Expand Up @@ -113,6 +117,8 @@ describe('test Request With Credentials', function () {
});
assert.deepStrictEqual(result, {
sessionId: '1352110219202',
host: 'localhost',
port: 10195,
capabilities: {
browserName: 'MicrosoftEdge', version: 'TEST', platform: 'TEST'
}
Expand Down Expand Up @@ -154,6 +160,8 @@ describe('test Request With Credentials', function () {

assert.deepStrictEqual(session, {
sessionId: '1352110219202',
host: 'localhost',
port: 10195,
capabilities: {browserName: 'firefox', version: 'TEST', platform: 'TEST'}
});
assert.deepStrictEqual(sessionOptions.get('moz:firefoxOptions'), {args: ['-headless']});
Expand Down Expand Up @@ -197,6 +205,8 @@ describe('test Request With Credentials', function () {

assert.deepStrictEqual(session, {
sessionId: '1352110219202',
host: 'localhost',
port: 10195,
capabilities: {browserName: 'chrome', version: 'TEST', platform: 'TEST'}
});
assert.deepStrictEqual(sessionOptions.get('goog:chromeOptions'), {args: ['headless=new']});
Expand Down Expand Up @@ -240,6 +250,8 @@ describe('test Request With Credentials', function () {

assert.deepStrictEqual(session, {
sessionId: '1352110219202',
host: 'localhost',
port: 10195,
capabilities: {browserName: 'MicrosoftEdge', version: 'TEST', platform: 'TEST'}
});

Expand Down Expand Up @@ -369,6 +381,8 @@ describe('test Request With Credentials', function () {
});
assert.deepStrictEqual(result, {
sessionId: '1352110219202',
host: 'localhost',
port: 10195,
capabilities: {
browserName: 'chrome', version: 'TEST', platform: 'TEST'
}
Expand Down Expand Up @@ -429,7 +443,9 @@ describe('test Request With Credentials', function () {
deviceName: 'iPhone 13',
name: 'sample test goes here'
},
sessionId: '1352110219202'
sessionId: '1352110219202',
host: 'locahost',
port: 4723
});
});

Expand Down Expand Up @@ -486,7 +502,9 @@ describe('test Request With Credentials', function () {
platformVersion: '12.0',
name: 'sample test goes here'
},
sessionId: '1352110219202'
sessionId: '1352110219202',
host: 'somewhere',
port: 9999
});
});

Expand Down Expand Up @@ -580,6 +598,8 @@ describe('test Request With Credentials', function () {
const result = await client.createSession();
assert.deepEqual(result, {
sessionId: '1352110219202',
host: 'hub.browserstack.com',
port: 443,
capabilities: {
firstMatch: [{}],
alwaysMatch: {
Expand Down Expand Up @@ -704,6 +724,8 @@ describe('test Request With Credentials', function () {
const result = await client.createSession();
assert.deepStrictEqual(result, {
sessionId: '1352110219202',
host: 'hub.browserstack.com',
port: 443,
capabilities: {
platform: 'MAC',
platformName: 'iOS',
Expand Down Expand Up @@ -831,6 +853,8 @@ describe('test Request With Credentials', function () {
const result = await client.createSession();
assert.deepStrictEqual(result, {
sessionId: '1352110219202',
host: 'hub.browserstack.com',
port: 443,
capabilities: {
platform: 'LINUX',
platformName: 'Android',
Expand Down Expand Up @@ -927,6 +951,8 @@ describe('test Request With Credentials', function () {
const result = await client.createSession();
assert.deepStrictEqual(result, {
sessionId: '1352110219202',
host: 'hub.browserstack.com',
port: 443,
capabilities: {
firstMatch: [{}],
alwaysMatch: {
Expand Down Expand Up @@ -1026,6 +1052,8 @@ describe('test Request With Credentials', function () {
const result = await client.createSession();
assert.deepStrictEqual(result, {
sessionId: '1352110219202',
host: 'hub.browserstack.com',
port: 443,
capabilities: {
firstMatch: [{}],
alwaysMatch: {
Expand Down
4 changes: 2 additions & 2 deletions test/src/service-builders/testAppiumServer.js
Expand Up @@ -243,7 +243,7 @@ describe('AppiumServer Transport Tests', function () {
});

assert.deepStrictEqual(session, {
sessionId: '1111', capabilities: {}
sessionId: '1111', capabilities: {}, host: 'localhost', port: 9999
});
assert.strictEqual(command, 'node');
assert.strictEqual(serverPort, 9999);
Expand Down Expand Up @@ -322,7 +322,7 @@ describe('AppiumServer Transport Tests', function () {
});

assert.deepStrictEqual(session, {
sessionId: '1111', capabilities: {}
sessionId: '1111', capabilities: {}, host: 'somewhere', port: 4725
});
// service not created
assert.ok(!serverPort);
Expand Down
14 changes: 11 additions & 3 deletions test/src/service-builders/testChromeDriver.js
Expand Up @@ -223,7 +223,7 @@ describe('ChromeDriver Transport Tests', function () {
});

assert.deepStrictEqual(session, {
sessionId: '1111', capabilities: {}
sessionId: '1111', capabilities: {}, host: 'localhost', port: 9999
});
assert.strictEqual(serverPath, '/path/to/chromedriver');
assert.strictEqual(serverPort, 9999);
Expand All @@ -246,7 +246,7 @@ describe('ChromeDriver Transport Tests', function () {
});

assert.deepStrictEqual(session, {
sessionId: '1111', capabilities: {}
sessionId: '1111', capabilities: {}, host: 'localhost', port: undefined
});
assert.strictEqual(serverPath, '/path/to/chromedriver');
assert.strictEqual(serverPort, undefined);
Expand Down Expand Up @@ -274,6 +274,8 @@ describe('ChromeDriver Transport Tests', function () {

assert.deepStrictEqual(session, {
sessionId: '1111',
host: 'localhost',
port: '9999',
capabilities: {}
});
assert.strictEqual(serverPath, '/path/to/chromedriver');
Expand Down Expand Up @@ -307,6 +309,8 @@ describe('ChromeDriver Transport Tests', function () {

assert.deepStrictEqual(session, {
sessionId: '1111',
host: 'localhost',
port: 9999,
capabilities: {}
});
assert.strictEqual(serverPath, '/path/to/chromedriver');
Expand Down Expand Up @@ -338,6 +342,8 @@ describe('ChromeDriver Transport Tests', function () {

assert.deepStrictEqual(session, {
sessionId: '1111',
host: 'localhost',
port: 9999,
capabilities: {}
});
assert.strictEqual(serverPath, '/path/to/chromedriver');
Expand Down Expand Up @@ -371,7 +377,9 @@ describe('ChromeDriver Transport Tests', function () {

assert.deepStrictEqual(session, {
sessionId: '1111',
capabilities: {}
capabilities: {},
host: 'localhost',
port: 9999
});
assert.strictEqual(serverPath, '/path/to/chromedriver');
assert.strictEqual(serverPort, 9999);
Expand Down
8 changes: 4 additions & 4 deletions test/src/service-builders/testEdgeDriver.js
Expand Up @@ -225,7 +225,7 @@ describe('EdgeDriver Transport Tests', function () {
});

assert.deepStrictEqual(session, {
sessionId: '1111', capabilities: {}
sessionId: '1111', capabilities: {}, host: 'localhost', port: 9999
});
assert.strictEqual(serverPath, '/path/to/edgedriver');
assert.strictEqual(serverPort, 9999);
Expand All @@ -244,7 +244,7 @@ describe('EdgeDriver Transport Tests', function () {
}, {parallel: true});

assert.deepStrictEqual(session, {
sessionId: '1111', capabilities: {}
sessionId: '1111', capabilities: {}, host: 'localhost', port: undefined
});
assert.strictEqual(serverPath, '/path/to/edgedriver');
assert.strictEqual(serverPort, undefined);
Expand All @@ -267,7 +267,7 @@ describe('EdgeDriver Transport Tests', function () {
});

assert.deepStrictEqual(session, {
sessionId: '1111', capabilities: {}
sessionId: '1111', capabilities: {}, host: 'localhost', port: 9999
});
assert.strictEqual(serverPath, '/path/to/edgedriver');
assert.strictEqual(serverPort, 9999);
Expand All @@ -290,7 +290,7 @@ describe('EdgeDriver Transport Tests', function () {
});

assert.deepStrictEqual(session, {
sessionId: '1111', capabilities: {}
sessionId: '1111', capabilities: {}, host: 'localhost', port: 9999
});
assert.strictEqual(serverPath, '/path/to/edgedriver');
assert.strictEqual(serverPort, 9999);
Expand Down
6 changes: 3 additions & 3 deletions test/src/service-builders/testFirefoxDriver.js
Expand Up @@ -229,7 +229,7 @@ describe('GeckoDriver Transport Tests', function () {
});

assert.deepStrictEqual(session, {
sessionId: '1111', capabilities: {}
sessionId: '1111', capabilities: {}, host: 'localhost', port: 9999
});
assert.strictEqual(serverPath, '/path/to/geckodriver');
assert.strictEqual(serverPort, 9999);
Expand All @@ -253,7 +253,7 @@ describe('GeckoDriver Transport Tests', function () {
});

assert.deepStrictEqual(session, {
sessionId: '1111', capabilities: {}
sessionId: '1111', capabilities: {}, host: 'localhost', port: undefined
});
assert.strictEqual(serverPath, '/path/to/geckodriver');
assert.strictEqual(serverPort, undefined);
Expand Down Expand Up @@ -282,7 +282,7 @@ describe('GeckoDriver Transport Tests', function () {
});

assert.deepStrictEqual(session, {
sessionId: '1111', capabilities: {}
sessionId: '1111', capabilities: {}, host: 'localhost', port: 9999
});
assert.strictEqual(serverPath, '/path/to/geckodriver');
assert.strictEqual(serverPort, 9999);
Expand Down
6 changes: 3 additions & 3 deletions test/src/service-builders/testSafariDriver.js
Expand Up @@ -218,7 +218,7 @@ describe('SafariDriver Transport Tests', function () {
});

assert.deepStrictEqual(session, {
sessionId: '1111', capabilities: {}
sessionId: '1111', capabilities: {}, host: 'localhost', port: 9999
});
assert.strictEqual(serverPath, '/usr/bin/safaridriver');
assert.strictEqual(serverPort, 9999);
Expand All @@ -236,7 +236,7 @@ describe('SafariDriver Transport Tests', function () {
});

assert.deepStrictEqual(session, {
sessionId: '1111', capabilities: {}
sessionId: '1111', capabilities: {}, host: 'localhost', port: undefined
});
assert.strictEqual(serverPath, '/usr/bin/safaridriver');
assert.strictEqual(serverPort, undefined);
Expand All @@ -257,7 +257,7 @@ describe('SafariDriver Transport Tests', function () {
});

assert.deepStrictEqual(session, {
sessionId: '1111', capabilities: {}
sessionId: '1111', capabilities: {}, host: 'localhost', port: 9999
});
assert.strictEqual(serverPath, '/Applications/Safari Technology Preview.app/Contents/MacOS/safaridriver');
});
Expand Down
22 changes: 11 additions & 11 deletions test/src/service-builders/testSeleniumServer.js
Expand Up @@ -18,12 +18,12 @@ describe('SeleniumServer Transport Tests', function () {
const sessionData = {
sessionId: '111',
getId() {
return '1111'
return '1111';
},
getCapabilities() {
return {
getPlatform() {
return 'MAC'
return 'MAC';
},
getBrowserName() {
return 'chrome';
Expand All @@ -37,7 +37,7 @@ describe('SeleniumServer Transport Tests', function () {
keys() {
return new Map();
}
}
};
}
};

Expand All @@ -49,9 +49,9 @@ describe('SeleniumServer Transport Tests', function () {
async getExecutor() {
return {
w3c: true
}
};
}
}
};

const fn = function() {};
function deleteFromRequireCache(location) {
Expand Down Expand Up @@ -108,7 +108,7 @@ describe('SeleniumServer Transport Tests', function () {
}

async start() {
return {}
return {};
}
}

Expand All @@ -124,7 +124,7 @@ describe('SeleniumServer Transport Tests', function () {
}

async start() {
return {}
return {};
}
}

Expand Down Expand Up @@ -217,7 +217,7 @@ describe('SeleniumServer Transport Tests', function () {
serverPath,
serverPort,
options
}
};
}

it('test create session with selenium server 3', async function() {
Expand Down Expand Up @@ -249,7 +249,7 @@ describe('SeleniumServer Transport Tests', function () {
});

assert.deepStrictEqual(session, {
sessionId: '1111', capabilities: {}
sessionId: '1111', capabilities: {}, host: 'localhost', port: 9999
});
assert.strictEqual(serverPath, '/path/to/selenium-server-standalone.3.0.jar');
assert.strictEqual(serverPort, 9999);
Expand Down Expand Up @@ -317,7 +317,7 @@ describe('SeleniumServer Transport Tests', function () {
});

assert.deepStrictEqual(session, {
sessionId: '1111', capabilities: {}
sessionId: '1111', capabilities: {}, host: 'localhost', port: null
});
assert.strictEqual(serverPath, '/path/to/selenium-server-standalone.3.0.jar');
assert.ok(!!serverPort);
Expand Down Expand Up @@ -357,7 +357,7 @@ describe('SeleniumServer Transport Tests', function () {
});

assert.deepStrictEqual(session, {
sessionId: '1111', capabilities: {}
sessionId: '1111', capabilities: {}, host: 'localhost', port: 9999
});

assert.strictEqual(serverPort, 9999);
Expand Down

0 comments on commit 0b1f4b5

Please sign in to comment.