Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
… element to be gone
- Loading branch information
1 parent
0214404
commit d710d76
Showing
4 changed files
with
84 additions
and
1 deletion.
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
25 changes: 25 additions & 0 deletions
25
test/extra/pageobjects/pages/waitForElementNotPresentPageObj.js
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,25 @@ | ||
module.exports = { | ||
commands: [{ | ||
waitForElementNotPresentDemo(cb) { | ||
this.click('@button') | ||
const dialog = this.section.dialog; | ||
dialog.selectValueDemo(cb) | ||
} | ||
}], | ||
elements: { | ||
button: '#weblogin' | ||
}, | ||
sections: { | ||
dialog: { | ||
selector: '#weblogin', | ||
elements: { | ||
select: '#badElement' | ||
}, | ||
commands: [{ | ||
selectValueDemo(cb) { | ||
this.waitForElementNotPresent('@select', cb); | ||
} | ||
}] | ||
} | ||
} | ||
}; |
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,33 @@ | ||
const assert = require('assert'); | ||
const path = require('path'); | ||
const Nocks = require('../../lib/nocks.js'); | ||
const Nightwatch = require('../../lib/nightwatch.js'); | ||
|
||
describe('test PageObject WaitForElementNotPresent', function () { | ||
beforeEach(function (done) { | ||
Nocks.enable().cleanAll().createSession(); | ||
Nightwatch.init({ | ||
page_objects_path: path.join(__dirname, '../../extra/pageobjects/pages') | ||
}, function () { | ||
done(); | ||
}); | ||
this.client = Nightwatch.client(); | ||
}); | ||
|
||
afterEach(function () { | ||
Nocks.deleteSession().disable(); | ||
}); | ||
|
||
it('WaitForElementNotPresent with section', function(done) { | ||
Nocks.elementFound().click().elementFound().childElementsFound('#badElement').elementFound().childElementsNotFound() | ||
|
||
const page = this.client.api.page.waitForElementNotPresentPageObj(); | ||
|
||
page.waitForElementNotPresentDemo(function(result) { | ||
assert.equal(result.status, 0); | ||
done(); | ||
}) | ||
|
||
this.client.start() | ||
}); | ||
}); |