File tree Expand file tree Collapse file tree 3 files changed +42
-5
lines changed Expand file tree Collapse file tree 3 files changed +42
-5
lines changed Original file line number Diff line number Diff line change @@ -231,9 +231,6 @@ At initialization you were asked to create custom steps file. If you accepted th
231
231
See how ` login ` method can be added to ` I ` :
232
232
233
233
``` js
234
- ' use strict' ;
235
- // in this file you can append custom step methods to 'I' object
236
-
237
234
module .exports = function () {
238
235
return actor ({
239
236
@@ -248,4 +245,36 @@ module.exports = function() {
248
245
249
246
Please notice that instead of ` I ` you should use ` this ` in current context.
250
247
248
+ ## Dependency Injection
249
+
250
+ ### Configuration
251
+
252
+ All objects described here are injected with Dependency Injection. The similar way it happens in AngularJS framework.
253
+ If you want an object to be injected in scenario by its name add it to configuration:
254
+
255
+ ``` js
256
+ " include" : {
257
+ " I" : " ./custom_steps.js" ,
258
+ " Smth" : " ./pages/Smth.js" ,
259
+ " loginPage" : " ./pages/Login.js" ,
260
+ " signinFragment" : " ./fragments/Signin.js"
261
+ }
262
+ ```
263
+
264
+ Now this objects can be retrieved by the name specified in configuration.
265
+ CodeceptJS generator commands (like ` codeceptjs gpo ` ) will update configuration for you.
266
+
267
+ ### Dynamic Injection
268
+
269
+ You can inject objects per test by calling ` injectDependencies ` function on Scenario:
270
+
271
+ ``` js
272
+ Scenario (' search @grop' , (I , Data ) => {
273
+ I .fillField (' Username' , Data .username );
274
+ I .pressKey (' Enter' );
275
+ }).injectDependencies ({ Data: require (' ./data.js' ) });
276
+ ```
277
+
278
+ This requires ` ./data.js ` module and assigns it to ` Data ` argument in a test.
279
+
251
280
### done()
Original file line number Diff line number Diff line change 1
- Waits for element not to be present on page (by default waits for 1sec).
1
+ Waits for element to be present on page (by default waits for 1sec).
2
2
Element can be located by CSS or XPath.
3
3
4
4
```js
Original file line number Diff line number Diff line change @@ -1425,7 +1425,7 @@ class WebDriverIO extends Helper {
1425
1425
*/
1426
1426
async waitUntilExists ( locator , sec = null ) {
1427
1427
const aSec = sec || this . options . waitForTimeout ;
1428
- return this . browser . waitForExist ( locator , aSec * 1000 ) ;
1428
+ return this . browser . waitForExist ( withStrictLocator . call ( this , locator ) , aSec * 1000 ) ;
1429
1429
}
1430
1430
1431
1431
@@ -1599,6 +1599,14 @@ class WebDriverIO extends Helper {
1599
1599
* Appium: support
1600
1600
*/
1601
1601
async waitForStalenessOf ( locator , sec = null ) {
1602
+ return this . waitUntilNotExists ( locator , sec ) ;
1603
+ }
1604
+
1605
+ /**
1606
+ * {{> ../webapi/waitForStalenessOf }}
1607
+ * Appium: support
1608
+ */
1609
+ async waitUntilNotExists ( locator , sec = null ) {
1602
1610
const aSec = sec || this . options . waitForTimeout ;
1603
1611
return this . browser . waitUntil ( async ( ) => {
1604
1612
const res = await this . browser . elements ( withStrictLocator . call ( this , locator ) ) ;
You can’t perform that action at this time.
0 commit comments