Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
52 views
in Technique[技术] by (71.8m points)

javascript - I'm unable to run all webdriver.io spec file in single browser seession

I'm using webdriver.io run test. I also reduced maxinstances to 1, but webdriver.io still keeps creating a new browser session before each spec. Can you point out what i'm doing wrong here?

wdio.conf.js

exports.config = {
runner: 'local',
specs: [
    './specs/specs.e2e.js'
],
exclude: [
],
maxInstances: 1,

capabilities: [{

    maxInstances: 1,
    browserName: 'chrome',
    acceptInsecureCerts: true
}],

logLevel: 'info',

bail: 0,

baseUrl: 'http://localhost',

waitforTimeout: 10000,

connectionRetryTimeout: 120000,

connectionRetryCount: 3,

services: ['chromedriver'],

framework: 'mocha',

reporters: ['spec'],

mochaOpts: {
    ui: 'bdd',
    timeout: 60000
  },
}

specs.e2e.js

require('../specs/spec01_login.e2e');
require('../specs/spec02_test.one.e2e');

my folder directories are:

enter image description here

your assistance is greatly appreciated.

PS: I did not use browser.closeWindow() in my spec files.

question from:https://stackoverflow.com/questions/65937650/im-unable-to-run-all-webdriver-io-spec-file-in-single-browser-seession

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I had an error on my spec02_test.one.e2e.js and it was not able to find such element, and that's why it opened another browser, and did not close that browser. The code config above is good and has no issue, it works but make sure no error occurs on each spec file


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...