v4 wdio-mocha-framework behaves incorrectly when using ".only"
See original GitHub issueHey, I’m running into a few issues when using wdio cli to run Mocha tests:
- When
.only
is appended to adescribe
, Webdriver seems to ignore it and incorrectly continues to run all test suites in the spec file. - When
.only
is appended to anit
test case, it correctly becomes the only test case to run, but suffers from a different problem: it runs asynchronously instead of synchronously.
For example, the code below has two identical tests, but one is sync and the other is async.
When the suite is run, Test 1 passes and Test 2 fails.
When Test 1 is appended with .only
, it fails.
When Test 2 is appended with .only
, it passes.
describe('sanity tests', function () {
it('Test 1: sync google search', function (done) {
browser.url('https://www.google.com');
browser.setValue('input[type="text"]', 'test search string');
browser.click('button[type="submit"]');
browser.pause(1000);
assert.equal(browser.getTitle(), 'test search string - Google Search', "Search title is incorrect");
});
it('Test 2: async google search', function (done) {
browser.url('https://www.google.com')
.setValue('input[type="text"]', 'test search string')
.click('button[type="submit"]')
.pause(1000)
.getTitle(function(err, title) {
assert.equal(browser.title, 'test search string - Google Search', "Search title is incorrect");
})
.call(done);
});
});
Node modules being used:
"mocha": "2.4.5",
"selenium-standalone": "4.9.0",
"wdio-mocha-framework": "0.2.11",
"webdriverio": "4.0.3"
Issue Analytics
- State:
- Created 8 years ago
- Comments:14 (8 by maintainers)
Top Results From Across the Web
webdriverio/webdriverio - Gitter
Hello, I have a question…If an inputfield is not visible on the page, but it exists, can i use the command browser.setValue()? (wdio...
Read more >Mocha documentation — DevDocs
WARNING: Exclusive tests are incompatible with parallel mode. The exclusivity feature allows you to run only the specified suite or test-case by appending...
Read more >Organizing Test Suite - WebdriverIO
Once your tests have several spec files, you should start running your tests concurrently. To do so, adjust the maxInstances property in your...
Read more >How to debug webdriverio in standalone mode?
client() , you you won't been to deal with it anymore. Just pick a framework to run your test-cases (Mocha, Cucumber, or Jasmine)...
Read more >WebdriverIO Tutorial: Browser Commands for Selenium Testing
WebdriverIO is a very well known End to End JavaScript framework for automation ... How To Handle Browser Windows With WebdriverIO Commands?
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Just fyi:
describe.only
won’t work because each spec file runs in its own child process and doesn’t know about other files. We will introduce a global grep/fgrep option with #1247FYI, I’ve implemented a “quick and dirty” solution to support it (I prefer a slower bootstrap than having my entire suite running because I forgot
.only
is not working as it should):