mirror of https://github.com/zulip/zulip.git
Update casper testing documentation.
This adds a note that waitFor functions cannot be chained together if the wait can cause race condition.
This commit is contained in:
parent
8e5e6a06f2
commit
f20f9ce8c8
|
@ -244,6 +244,23 @@ for writing Casper tests in addition to the debugging notes below:
|
||||||
<http://docs.casperjs.org/en/latest/modules/casper.html#waitforselector>
|
<http://docs.casperjs.org/en/latest/modules/casper.html#waitforselector>
|
||||||
and the various assert statements available are documented here:
|
and the various assert statements available are documented here:
|
||||||
<http://docs.casperjs.org/en/latest/modules/tester.html#the-tester-prototype>
|
<http://docs.casperjs.org/en/latest/modules/tester.html#the-tester-prototype>
|
||||||
|
|
||||||
|
- The 'waitFor' style functions (waitForSelector, etc.) cannot be
|
||||||
|
chained together in certain conditions without creating race
|
||||||
|
conditions where the test may fail nondeterministically. For
|
||||||
|
example, don't do this:
|
||||||
|
|
||||||
|
casper.waitForSelector('tag 1');
|
||||||
|
casper.waitForSelector('tag 2');
|
||||||
|
|
||||||
|
Instead, if you want to avoid race condition, wrap the second
|
||||||
|
`waitFor` in a `then` function like this:
|
||||||
|
|
||||||
|
casper.waitForSelector('tag 1');
|
||||||
|
casper.then(function () {
|
||||||
|
casper.waitForSelector('tag 2');
|
||||||
|
});
|
||||||
|
|
||||||
- Casper uses CSS3 selectors; you can often save time by testing and
|
- Casper uses CSS3 selectors; you can often save time by testing and
|
||||||
debugging your selectors on the relevant page of the Zulip
|
debugging your selectors on the relevant page of the Zulip
|
||||||
development app in the Chrome JavaScript console by using e.g.
|
development app in the Chrome JavaScript console by using e.g.
|
||||||
|
|
Loading…
Reference in New Issue