Skip to content

Commit

Permalink
Few minor changes in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
garg3133 committed Aug 12, 2024
1 parent 6595b0f commit 7022912
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
describe('test', function () {
test('test setPassword', async (browser) => {
test('test isPresent', async (browser) => {
browser
.element('#wrong').isPresent().assert.equals(false);
});
Expand Down
12 changes: 7 additions & 5 deletions test/src/api/commands/web-element/testIsPresent.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ describe('element().isPresent() command', function() {
assert.strictEqual(result, false);
});

it('test .element().find().isPresent() suppressNotFoundErrors should not throw NoSuchElementError', async function() {

it('test .element().isPresent() suppresses NoSuchElementError', async function() {
MockServer.addMock({
url: '/session/13521-10219-202/elements',
method: 'POST',
Expand All @@ -84,16 +83,19 @@ describe('element().isPresent() command', function() {
})
});

let globalReporterCalled = false;

const globals = {
reporter(results) {
globalReporterCalled = true;
if (Object.prototype.hasOwnProperty.call(results, 'lastError')) {
assert.notStrictEqual(results.lastError.name, 'NoSuchElementError');
}
},
waitForConditionTimeout: 100
};
const testsPath = [
path.join(__dirname, '../../../../sampletests/isPresent/isPresentElementNotPresent.js')
path.join(__dirname, '../../../../sampletests/isPresent/elementNotPresent.js')
];

await NightwatchClient.runTests(testsPath, settings({
Expand All @@ -102,6 +104,6 @@ describe('element().isPresent() command', function() {
selenium_host: null
}));

assert.strictEqual(globalReporterCalled, true);
});

});
});

0 comments on commit 7022912

Please sign in to comment.