Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Running tests sequentially #4304

stychu started this conversation in General
Discussion options

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 ?

You must be logged in to vote

Replies: 1 comment

Comment options

Probably a question better suited for the forums :)

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1563 on April 16, 2024 11:59.

AltStyle によって変換されたページ (->オリジナル) /