Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Element API sends further HTTP requests in failed chained commands #4077 #4088

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions examples/tests/ecosia.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@ describe('Ecosia.org Demo', function() {

before(browser => {
browser
.navigateTo('https://www.ecosia.org/');
.url('https://www.ecosia.org/') // Use .url() instead of .navigateTo()
.waitForElementVisible('body'); // Wait for the body element to become visible
});

it('Demo test ecosia.org', function(browser) {
browser
.waitForElementVisible('body')
.assert.titleContains('Ecosia')
.assert.visible('input[type=search]')
.setValue('input[type=search]', 'nightwatch')
.assert.visible('button[type=submit]')
.click('button[type=submit]')
.assert.textContains('.layout__content', 'Nightwatch.js');
.expect.element('.wrong_selector').to.not.be.present; // Check if the element with class '.wrong_selector' is not present
});

after(browser => browser.end());
Expand Down
10 changes: 7 additions & 3 deletions lib/api/web-element/scoped-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,13 @@ class ScopedWebElement {
}

function createNarrowedError({error, condition, timeout}) {
return error.name === 'TimeoutError'
? new Error(`Timed out while waiting for element "${condition}" to be present for ${timeout} milliseconds.`)
: error;
if (error.name === 'TimeoutError') {
return new Error(`Timed out while waiting for element "${condition}" to be present for ${timeout} milliseconds.`);
}

return error;

}


module.exports = ScopedWebElement;
1 change: 1 addition & 0 deletions snpashot.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><html class="no-js" lang=""><head><base href="https://nightwatchjs.org"> <meta charset="utf-8"> <title></title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta property="og:title" content=""> <meta property="og:type" content=""> <meta property="og:url" content=""> <meta property="og:image" content=""> <link rel="manifest" href="site.webmanifest"> <link rel="apple-touch-icon" href="icon.png"> <link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="css/main.css"> <meta name="theme-color" content="#fafafa"></head><body> <p>Hello world! This is HTML5 Boilerplate.</p> </body></html>
Empty file added test/types/index.d.ts
Empty file.