Skip to content

Commit

Permalink
added test
Browse files Browse the repository at this point in the history
  • Loading branch information
gravityvi committed Aug 24, 2023
1 parent abd3340 commit fa826e8
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
5 changes: 5 additions & 0 deletions test/apidemos/web-elements/waitUntilElementNotPresent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('demo of failure of waitUntil element commands', function() {
it('waitUntil element is visible - element not present', function({element}) {
element.find('#badElement').waitUntil('visible');
});
});
2 changes: 1 addition & 1 deletion test/apidemos/web-elements/waitUntilTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ describe('demo tests using waitUntil element APIs', function() {
});

it('wait until element is selected', function({element, state}) {
element('#weblogin').waitUntil('selected');
element('#weblogin').waitUntil('present').waitUntil('selected');
});

it('wait until element is enabled', function({element}) {
Expand Down
33 changes: 33 additions & 0 deletions test/src/apidemos/web-elements/testWaitUntil.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,37 @@ describe('waitUntil element command', function() {
globals
}));
});

it('test waitUntil element command - element not present', function() {
const testsPath = path.join(__dirname, '../../../apidemos/web-elements/waitUntilElementNotPresent.js');


const globals = {
waitForConditionPollInterval: 50,
waitForConditionTimeout: 120,
retryAssertionTimeout: 100,

reporter(results) {
if (!results.lastError) {
assert.fail('Should result into failure');
}
assert.ok(results.lastError.message.includes('not present'), 'err message should be element not present');
}
};

return NightwatchClient.runTests(testsPath, settings({
selenium: {
port: null,
start_process: false
},
selenium_host: null,
webdriver: {
port: 10195,
start_process: false
},
output: false,
skip_testcases_on_fail: false,
globals
}));
});
});

0 comments on commit fa826e8

Please sign in to comment.