Comments (8)
along those lines: the idea that showTest method simply shows a line on the screen is not in keeping with any test system currently in use in JavaScript.
Most systems capture and log errors when test conditions are not valid;
The accepted practice in testing is to throw an informational error as in:
client.showTest = function(theTest, receivedValue, expectedValue, message) {
if (!theTest){
throw new chai.AssertionError({actual: receivedValue, expected: expectedValue, message: message})
}
};
While using a test-system-resident error class isn't the way to go for general practice, this does seem to be the pattern for general use.
from webdriverio.
webdriverjs should not stop or fall in an endless pause because of chai. I tried to reconstructed this use case with the following test:
it.only('should not stop if chai assert fails',function(done) {
client
.url(testpageURL)
.isVisible('.btn1_clicked',function(result){
assert.strictEqual(false,true);
done();
});
});
This test fails but it ended. I stumpled several times on a similar problem when I executed the end function without creating a new session with init before the next test started. Did you find a solution for that?
greetings
from webdriverio.
Ok, I've probably found the reason why the test stops.
In this line the callback of the current command gets fired after the respond arrived. In this callback a error could be thrown by any assertion library like chai. This stops the process and the next command self.next();
never gets fired to continue with the next command.
The test above works, because no other test waited for execution. The after
function was executed and ended the test.
I will wrap this part of code in a try catch to avoid this.
thanks for filing this issue!
from webdriverio.
Ok..a try catch doesn't work because the Chai Assertion error never gets thrown and a falsely test gets marked as true.
from webdriverio.
Now I found a nice solution.
process.on('uncaughtException', function (exception) {
self.next();
});
If the Chai (or whatever you use) error gets thrown, this callback continues the command queue.
from webdriverio.
Thanks for your fix Christian, would like to know approximately when will be the release date for the fix (v0.7?) on npm?
Cheers
from webdriverio.
now ;-)
from webdriverio.
Try the latest version and it works !
Just need to perhaps add 'err' for like function(err, results) if you has custom method (previous no 'err' param)
Thanks a lot
from webdriverio.
Related Issues (20)
- [🐛 Bug]: TypeError: Spread syntax requires ...iterable[Symbol.iterator] to be a function HOT 3
- [💡 Feature]: Centralized context manager for Iframe lookups HOT 1
- [💡 Feature]: Support configuring NODE_OPTIONS for ChromeDriver separately from NODE_OPTIONS for WDIO itself HOT 5
- [🐛 Bug]: I should be able to chain element using both xpath and css HOT 1
- [🐛 Bug]: "goog:chromeOptions" args and prefs are being ignored? HOT 3
- [🐛 Bug]: <Tough all the test cases of my spec files are passed it shows 1 spec failure in the console log> HOT 4
- [💡 Feature]: Allow skipping anywhere in test execution HOT 5
- @wdio/runner: Error: Cannot find module HOT 1
- ERROR @wdio/runner: Error: Cannot find typescript module imported from spec.ts HOT 1
- [📖 Docs]: v8.36.0 tag and GitHub release points to wrong commit, v8.36.1 release notes are wrong HOT 1
- [🐛 Bug]: isElementDisplayed returns incorrect result for elements with overflow-x/y: hidden and zero width/height HOT 3
- [📖 Docs]: Mocha third party UIs HOT 6
- [🐛 Bug]: `window.frameElement` always evaluating to `null` HOT 17
- [🐛 Bug]: Specifying browser version does not work when running in a Docker container HOT 1
- [🐛 Bug]: Incorrect Type Definition in suites Configuration Causes Compilation Error in VS Code HOT 3
- [🐛 Bug]: Issue with recording in Safari HOT 1
- [🐛 Bug]: Scrolling in Mobile Devices using WDIO is not working properly HOT 6
- [🐛 Bug]: WebdriverIO toMatchSnapshot does not fail tests on mocha test retries HOT 7
- [🐛 Bug]: `aria/` selector fails when selecting an input related to a label when there are multiple inputs in the document
- [💡 Feature]: Add certificate to Browserstack service config HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webdriverio.