-
-
Notifications
You must be signed in to change notification settings - Fork 747
-
What are you trying to achieve?
I want to run whole tests suite for each browser sequentially. Currently I was able to do so but I wonder if this is the best approach.
const HOST_URL = process.env.HOST_URL || 'http://localhost:3000';
const BROWSERSTACK_USER = process.env.BROWSERSTACK_USER || 'grzegorzgurgul1';
const BROWSERSTACK_KEY = process.env.BROWSERSTACK_KEY || 'qPzSJDAQqn67ecPu9JLP';
const REST_API_ENDPOINT = process.env.REST_API_ENDPOINT || 'http://localhost:3000/dac/api/v1';
const generateConfig = ({ browser, os, os_version, browser_version }) => ({
browser,
windowSize: 'maximize',
desiredCapabilities: {
'browserstack.local': true,
os: os || 'Windows',
os_version: os_version || '10',
browser_version,
resolution: '1920x1080',
project : 'DAC',
build : 'Acceptance',
}
});
exports.config = {
output: './output',
helpers: {
WebDriver: {
url: HOST_URL,
browser: 'chrome',
uniqueScreenshotNames: true,
restart: false,
keepCookies: true,
user: BROWSERSTACK_USER,
key: BROWSERSTACK_KEY,
desiredCapabilities: {
'browserstack.local': true,
}
},
Cookie: {
require: './helpers/cookieHelper.js'
},
REST: {
endpoint: REST_API_ENDPOINT,
onRequest: (request) => {
}
}
},
include: {
// PAGES
I: './pages/steps_file.js',
dashboardPage: './pages/dashboard.js',
raiseDealPage: './pages/raiseDeal.js',
// FRAGMENTS
modal: './fragments/modal.js',
},
mocha: {},
bootstrap: async () => {
if (!BROWSERSTACK_KEY && !BROWSERSTACK_USER) {
const promisify = require('util').promisify;
const exec = promisify(require('child_process').exec);
await exec('npm run clean:output');
}
},
teardown: null,
hooks: [],
tests: './tests/*_test.js',
name: 'acceptance',
multiple: {
'chrome': {
browsers: [
generateConfig({ browser: 'chrome', browser_version: '72.0' }),
]
},
'firefox': {
browsers: [
generateConfig({ browser: 'firefox', browser_version: '65.0' }),
]
},
'IE': {
browsers: [
generateConfig({ browser: 'IE', browser_version: '11.0' }),
]
},
'safari': {
browsers: [
generateConfig({ browser: 'safari', browser_version: '11.1', os: 'OS X', os_version: 'High Sierra' }),
]
},
},
};
"browserstack:chrome": "./node_modules/codeceptjs/bin/codecept.js run-multiple chrome",
"browserstack:firefox": "./node_modules/codeceptjs/bin/codecept.js run-multiple firefox",
"browserstack:IE": "./node_modules/codeceptjs/bin/codecept.js run-multiple IE",
"browserstack:safari": "./node_modules/codeceptjs/bin/codecept.js run-multiple safari",
"browserstack": "run-s browserstack:chrome browserstack:firefox browserstack:IE browserstack:safari"
What do you get instead?
With this approach all tests are running for all the browsers at the same time.
multiple: {
'browser-stack': {
browsers: [
generateConfig({ browser: 'chrome', browser_version: '72.0' }),
generateConfig({ browser: 'firefox', browser_version: '65.0' }),
generateConfig({ browser: 'IE', browser_version: '11.0' }),
generateConfig({ browser: 'safari', browser_version: '11.1', os: 'OS X', os_version: 'High Sierra' }),
]
}
},
./node_modules/codeceptjs/bin/codecept.js run-multiple browser-stack
Is the current approach fine or I could change something about ?
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
Probably a question better suited for the forums :)
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment