-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for defining a custom return function for custom command
- Loading branch information
1 parent
c60f3f2
commit fe9a010
Showing
5 changed files
with
71 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const assert = require('assert'); | ||
|
||
describe('Test using custom commands with returnFn', function() { | ||
before(browser => { | ||
browser | ||
.url('http://localhost'); | ||
}); | ||
|
||
it('sampleTest', browser => { | ||
const result = browser.customCommandReturnFn(); | ||
assert.deepStrictEqual(result, {status: 0}); | ||
browser.end(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module.exports = class CustomCommandReturnFn { | ||
static get returnFn() { | ||
return function(node, api) { | ||
api.globals.count++; | ||
|
||
return { | ||
status: 0 | ||
}; | ||
}; | ||
} | ||
|
||
command() { | ||
this.api.perform(function() { | ||
this.globals.count++; | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters