-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b0aacb8
commit 4e44f67
Showing
1 changed file
with
45 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
const assert = require('assert'); | ||
const {WebElement} = require('selenium-webdriver'); | ||
const MockServer = require('../../../../lib/mockserver.js'); | ||
const CommandGlobals = require('../../../../lib/globals/commands-w3c.js'); | ||
const common = require('../../../../common.js'); | ||
const Element = common.require('element/index.js'); | ||
|
||
describe('element().isPresent() command', function() { | ||
before(function (done) { | ||
CommandGlobals.beforeEach.call(this, done); | ||
}); | ||
|
||
after(function (done) { | ||
CommandGlobals.afterEach.call(this, done); | ||
}); | ||
|
||
it('test .element().isPresent() present', async function() { | ||
const resultPromise = this.client.api.element('#signupSection').isPresent(); | ||
assert.strictEqual(resultPromise instanceof Element, false); | ||
assert.strictEqual(typeof resultPromise.find, 'undefined'); | ||
|
||
assert.strictEqual(resultPromise instanceof Promise, false); | ||
assert.strictEqual(typeof resultPromise.then, 'function'); | ||
|
||
const result = await resultPromise; | ||
assert.strictEqual(result instanceof WebElement, false); | ||
assert.strictEqual(result, true); | ||
|
||
}); | ||
|
||
it('test .element().isPresent() not present', async function() { | ||
const resultPromise = this.client.api.element('#wrong').isPresent(); | ||
assert.strictEqual(resultPromise instanceof Element, false); | ||
assert.strictEqual(typeof resultPromise.find, 'undefined'); | ||
|
||
assert.strictEqual(resultPromise instanceof Promise, false); | ||
assert.strictEqual(typeof resultPromise.then, 'function'); | ||
|
||
const result = await resultPromise; | ||
assert.strictEqual(result instanceof WebElement, false); | ||
assert.strictEqual(result, false); | ||
|
||
}); | ||
|
||
}); |