Skip to content

Commit f5badc5

Browse files
committed
Merge branch 'master' of github.com:Codeception/CodeceptJS
2 parents 7124642 + ab24a51 commit f5badc5

21 files changed

+130
-75
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ addons:
2121
services:
2222
- docker
2323
before_install:
24-
- docker pull selenium/standalone-chrome:3.8
24+
- docker pull selenium/standalone-chrome:3.9.1-actinium
2525
before_script:
26-
- docker run -d --net=host selenium/standalone-chrome:3.8
26+
- docker run -d --net=host --shm-size=2g selenium/standalone-chrome:3.8
27+
- export DBUS_SESSION_BUS_ADDRESS=/dev/null
2728
- export DISPLAY=:99.0
2829
- sh -e /etc/init.d/xvfb start
2930
- chmod -R 777 test/data
@@ -32,5 +33,4 @@ before_script:
3233
- sleep 10
3334
script:
3435
- npm build && npm test
35-
- './node_modules/.bin/mocha test/rest'
3636
- './node_modules/.bin/mocha test/helper/${HELPER}_test.js'

docs/acceptance.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ Strict locators allow to specify additional locator types:
4646
```js
4747
// locate form element by name
4848
I.seeElement({name: 'password'});
49-
// locate element by text
50-
I.seeElement({text: 'press me'});
5149
// locate element by id
5250
I.seeElement({id: 'users'});
5351
```

docs/basics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Usage: `within('section', ()=>{})`
116116

117117
```js
118118
I.amOnPage('https://github.com');
119-
within('.form-signup-home', () => {
119+
within('.js-signup-form', () => {
120120
I.fillField('user[login]', 'User');
121121
I.fillField('user[email]', '[email protected]');
122122
I.fillField('user[password]', '[email protected]');

docs/nightmare.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ When opening a web page you can set headers as well. `amOnPage` methods can take
144144

145145
```js
146146
// use basic http auth
147-
I.amOnPage('/admin', [{'Authorization': 'Basic '+token}]);
147+
I.amOnPage('/admin', { 'Authorization': 'Basic '+token });
148148
```
149149

150150
As a small bonus: all `console.log` calls on a page will be also shown in `--debug` mode.

docs/webapi/grabSource.mustache

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Retrieves page source and returns it to test.
2+
Resumes test execution, so should be used inside an async function.
3+
4+
```js
5+
let pageSource = await I.grabSource();
6+
```

docs/webapi/pressKey.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Presses a key on a focused element.
2-
Speical keys like 'Enter', 'Control', [etc](https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value)
2+
Special keys like 'Enter', 'Control', [etc](https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value)
33
will be replaced with corresponding unicode.
44
If modifier key is used (Control, Command, Alt, Shift) in array, it will be released afterwards.
55

docs/webapi/waitForStalenessOf.mustache renamed to docs/webapi/waitForDetached.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Waits for an element to become not attached to the DOM on a page (by default wai
22
Element can be located by CSS or XPath.
33

44
```
5-
I.waitForStalenessOf('#popup');
5+
I.waitForDetached('#popup');
66
```
77

88
@param locator element located by CSS|XPath|strict locator

lib/helper/Nightmare.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ class Nightmare extends Helper {
231231
this.browser = this.Nightmare(this.options);
232232
await this.browser;
233233
}
234+
await this.browser.goto('about:blank'); // Load a blank page so .saveScreenshot (/evaluate) will work
234235
this.isRunning = true;
235236
this.browser.on('dom-ready', () => this._injectClientScripts());
236237
this.browser.on('did-start-loading', () => this._injectClientScripts());
@@ -340,7 +341,7 @@ class Nightmare extends Helper {
340341
* In a second argument a list of request headers can be passed:
341342
*
342343
* ```js
343-
* I.amOnPage('/auth', [{'x-my-custom-header': 'some value'}])
344+
* I.amOnPage('/auth', { 'x-my-custom-header': 'some value' })
344345
* ```
345346
*/
346347
async amOnPage(url, headers = null) {

lib/helper/Protractor.js

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ class Protractor extends Helper {
626626
}
627627

628628
/**
629-
* {{> ../webapi/seeInSource }}
629+
* {{> ../webapi/grabSource }}
630630
*/
631631
async grabSource() {
632632
return this.browser.getPageSource();
@@ -899,19 +899,30 @@ class Protractor extends Helper {
899899
return this.browser.wait(EC.presenceOf(el), aSec * 1000);
900900
}
901901

902+
async waitUntilExists(locator, sec = null) {
903+
console.log(`waitUntilExists deprecated:
904+
* use 'waitForElement' to wait for element to be attached
905+
* use 'waitForDetached to wait for element to be removed'`);
906+
return this.waitForDetached(locator, sec);
907+
}
908+
902909
/**
903-
* {{> ../webapi/waitUntilExists }}
910+
* {{> ../webapi/waitForDetached }}
904911
*/
905-
waitUntilExists(locator, sec = null) {
912+
async waitForDetached(locator, sec = null) {
906913
const aSec = sec || this.options.waitForTimeout;
907914
const el = global.element(guessLocator(locator) || global.by.css(locator));
908915
return this.browser.wait(EC.not(EC.presenceOf(el)), aSec * 1000);
909916
}
910917

911918
/**
912919
* Waits for element to become clickable for number of seconds.
920+
*
921+
* ```js
922+
* I.waitForClickable('#link');
923+
* ```
913924
*/
914-
waitForClickable(locator, sec = null) {
925+
async waitForClickable(locator, sec = null) {
915926
const aSec = sec || this.options.waitForTimeout;
916927
const el = global.element(guessLocator(locator) || global.by.css(locator));
917928
return this.browser.wait(EC.elementToBeClickable(el), aSec * 1000);
@@ -920,7 +931,7 @@ class Protractor extends Helper {
920931
/**
921932
* {{> ../webapi/waitForVisible }}
922933
*/
923-
waitForVisible(locator, sec = null) {
934+
async waitForVisible(locator, sec = null) {
924935
const aSec = sec || this.options.waitForTimeout;
925936
const el = global.element(guessLocator(locator) || global.by.css(locator));
926937
return this.browser.wait(EC.visibilityOf(el), aSec * 1000);
@@ -929,23 +940,23 @@ class Protractor extends Helper {
929940
/**
930941
* {{> ../webapi/waitForInvisible }}
931942
*/
932-
waitForInvisible(locator, sec = null) {
943+
async waitForInvisible(locator, sec = null) {
933944
const aSec = sec || this.options.waitForTimeout;
934945
const el = global.element(guessLocator(locator) || global.by.css(locator));
935946
return this.browser.wait(EC.invisibilityOf(el), aSec * 1000);
936947
}
937948

938-
/**
939-
* {{> ../webapi/waitForStalenessOf }}
940-
*/
941-
waitForStalenessOf(locator, sec = null) {
949+
async waitForStalenessOf(locator, sec = null) {
950+
console.log(`waitForStalenessOf deprecated.
951+
* Use waitForDetached to wait for element to be removed from page
952+
* Use waitForInvisible to wait for element to be hidden on page`);
942953
return this.waitForInvisible(locator, sec);
943954
}
944955

945956
/**
946957
* {{> ../webapi/waitForText }}
947958
*/
948-
waitForText(text, sec = null, context = null) {
959+
async waitForText(text, sec = null, context = null) {
949960
if (!context) {
950961
context = this.context;
951962
}

lib/helper/Puppeteer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ class Puppeteer extends Helper {
912912
}
913913

914914
/**
915-
* {{> ../webapi/seeInSource }}
915+
* {{> ../webapi/grabSource }}
916916
*/
917917
async grabSource() {
918918
return this.page.content();

0 commit comments

Comments
 (0)