Closed posva closed 3 years ago
This issue has been automatically marked as stale because it has not had any recent activity. If possible, please retry using the latest Nightwatch version and update the issue with any relevant details. If no further activity occurs, it will be closed. Thank you for your contribution.
Describe the bug
I found that using
browser.click()
on Safari right after using a block ofexecute
orevaluate
with some scrolling related code doesn't effectively run the followingclick
Sample test
sampleTest.js
```js module.exports = { /** @type {import('nightwatch').NightwatchTest} */ bug: function (browser) { const TIMEOUT = 3000 browser .url('https://router.vuejs.org/guide/essentials/nested-routes.html') .waitForElementPresent('#app > *', 1000) .execute(function () { window.scrollTo(0, 100) // works in Safari // document.querySelector('.sidebar-group-items li:nth-child(4) a').click() }) .click('.sidebar-group-items li:nth-child(4) a') .waitForElementPresent('#programmatic-navigation', TIMEOUT) }, } ```
Run with command
Verbose output
debug.log
```txt yarn run v1.22.4 $ /Users/posva/vue-router-next/node_modules/.bin/nightwatch -c e2e/sample.config.js e2e/specs/bug-report.js -e safari --verbose [1;36mStarting Selenium Server on port 4444...[0m [1;36mSelenium Server up and running on port 4444 with pid: 60404 (517ms).[0m [0;36m[Bug Report] Test Suite[0m [0;35m=======================[0m [1;36m Request [1;36mPOST /wd/hub/session [0m[0m { desiredCapabilities: { browserName: [32m'safari'[39m, platform: [32m'ANY'[39m, acceptSslCerts: [33mtrue[39m, name: [32m'Bug Report'[39m } } [1;36m Response 200 POST /wd/hub/session (816ms)[0m { status: [33m0[39m, sessionId: [32m'448A366F-1485-4F26-81E5-4E4254E1E476'[39m, value: { [32m'safari:platformVersion'[39m: [32m'10.15.4'[39m, [32m'safari:automaticInspection'[39m: [33mfalse[39m, [32m'webkit:WebRTC'[39m: { DisableICECandidateFiltering: [33mfalse[39m, DisableInsecureMediaCapture: [33mfalse[39m }, browserVersion: [32m'13.1'[39m, strictFileInteractability: [33mfalse[39m, browserName: [32m'Safari'[39m, [32m'safari:useSimulator'[39m: [33mfalse[39m, [32m'safari:automaticProfiling'[39m: [33mfalse[39m, [32m'safari:platformBuildVersion'[39m: [32m'19E287'[39m, acceptInsecureCerts: [33mfalse[39m, setWindowRect: [33mtrue[39m, platformName: [32m'macOS'[39m, [32m'safari:diagnose'[39m: [33mfalse[39m, [32m'webdriver.remote.sessionid'[39m: [32m'448A366F-1485-4F26-81E5-4E4254E1E476'[39m } } Using: [1;34mSafari[0m [0;33m(13.1)[0m on [0;36mmacOS[0m platform. [1;36mReceived session with ID: 448A366F-1485-4F26-81E5-4E4254E1E476 [0m [1;37m[0;32m→[0m Running [before]:[0m [1;37m[0;32m→[0m Completed [before].[0m Running: [0;32mbug[0m [1;37m[0;32m→[0m Running [beforeEach]:[0m [1;37m[0;32m→[0m Completed [beforeEach].[0m [1;37m [0;32m→[0m Running command: [1;32murl[0m ('https://router.vuejs.org/guide/essentials/nested-routes.html')[0m [1;36m Request [1;36mPOST /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476/url [0m[0m { url: [32m'https://router.vuejs.org/guide/essentials/nested-routes.html'[39m } [1;36m Response 200 POST /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476/url (240ms)[0m { state: [32m'success'[39m, sessionId: [1mnull[22m, value: [1mnull[22m, status: [33m0[39m } [1;37m [0;32m→[0m Completed command: [1;32murl[0m ('https://router.vuejs.org/guide/essentials/nested-routes.html') (242ms)[0m [1;37m [0;32m→[0m Running command: [1;32mwaitForElementPresent[0m ('#app > *', 1000)[0m [1;36m Request [1;36mPOST /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476/elements [0m[0m { using: [32m'css selector'[39m, value: [32m'#app > *'[39m } [1;36m Response 200 POST /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476/elements (74ms)[0m { state: [32m'success'[39m, sessionId: [1mnull[22m, value: [ { [32m'element-6066-11e4-a52e-4f735466cecf'[39m: [32m'node-AE29BDD8-6456-4350-9A94-DF112EB6B104'[39m } ], status: [33m0[39m } [0;32m✔[0m Element <#app > *> was present after 74 milliseconds. [1;37m [0;32m→[0m Completed command: [1;32mwaitForElementPresent[0m ('#app > *', 1000) (76ms)[0m [1;37m [0;32m→[0m Running command: [1;32mexecute[0m ([Function])[0m [1;36m Request [1;36mPOST /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476/execute [0m[0m { script: [32m'var passedArgs = Array.prototype.slice.call(arguments,0); return function () {\n'[39m + [32m' window.scrollTo(0, 100)\n'[39m + [32m' // works in Safari\n'[39m + [32m" // document.querySelector('.sidebar-group-items li:nth-child(4) a').click()\n"[39m + [32m' }.apply(window, passedArgs);'[39m, args: [] } [1;36m Response 200 POST /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476/execute (26ms)[0m { state: [32m'success'[39m, sessionId: [1mnull[22m, value: [1mnull[22m, status: [33m0[39m } [1;37m [0;32m→[0m Completed command: [1;32mexecute[0m ([Function]) (27ms)[0m [1;37m [0;32m→[0m Running command: [1;32mclick[0m ('.sidebar-group-items li:nth-child(4) a')[0m [1;36m Request [1;36mPOST /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476/elements [0m[0m { using: [32m'css selector'[39m, value: [32m'.sidebar-group-items li:nth-child(4) a'[39m } [1;36m Response 200 POST /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476/elements (6ms)[0m { state: [32m'success'[39m, sessionId: [1mnull[22m, value: [ { [32m'element-6066-11e4-a52e-4f735466cecf'[39m: [32m'node-63474816-D549-4D77-BBE4-81C84F4C1AC6'[39m }, { [32m'element-6066-11e4-a52e-4f735466cecf'[39m: [32m'node-696EFACA-9B30-4FEB-BBA1-0F57E65A7AC1'[39m } ], status: [33m0[39m } [1;36m Request [1;36mPOST /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476/element/node-63474816-D549-4D77-BBE4-81C84F4C1AC6/click [0m[0m {} [1;36m Response 200 POST /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476/element/node-63474816-D549-4D77-BBE4-81C84F4C1AC6/click (68ms)[0m { state: [32m'success'[39m, sessionId: [1mnull[22m, value: [1mnull[22m, status: [33m0[39m } [1;37m [0;32m→[0m Completed command: [1;32mclick[0m ('.sidebar-group-items li:nth-child(4) a') (78ms)[0m [1;37m [0;32m→[0m Running command: [1;32mwaitForElementPresent[0m ('#programmatic-navigation', 3000)[0m [1;36m Request [1;36mPOST /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476/elements [0m[0m { using: [32m'css selector'[39m, value: [32m'#programmatic-navigation'[39m } [1;36m Response 200 POST /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476/elements (30ms)[0m { state: [32m'success'[39m, sessionId: [1mnull[22m, value: [], status: [33m0[39m } [1;36m Request [1;36mPOST /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476/elements [0m[0m { using: [32m'css selector'[39m, value: [32m'#programmatic-navigation'[39m } [1;36m Response 200 POST /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476/elements (7ms)[0m { state: [32m'success'[39m, sessionId: [1mnull[22m, value: [], status: [33m0[39m } [1;36m Request [1;36mPOST /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476/elements [0m[0m { using: [32m'css selector'[39m, value: [32m'#programmatic-navigation'[39m } [1;36m Response 200 POST /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476/elements (28ms)[0m { state: [32m'success'[39m, sessionId: [1mnull[22m, value: [], status: [33m0[39m } [1;36m Request [1;36mPOST /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476/elements [0m[0m { using: [32m'css selector'[39m, value: [32m'#programmatic-navigation'[39m } [1;36m Response 200 POST /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476/elements (10ms)[0m { state: [32m'success'[39m, sessionId: [1mnull[22m, value: [], status: [33m0[39m } [1;36m Request [1;36mPOST /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476/elements [0m[0m { using: [32m'css selector'[39m, value: [32m'#programmatic-navigation'[39m } [1;36m Response 200 POST /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476/elements (36ms)[0m { state: [32m'success'[39m, sessionId: [1mnull[22m, value: [], status: [33m0[39m } [1;36m Request [1;36mPOST /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476/elements [0m[0m { using: [32m'css selector'[39m, value: [32m'#programmatic-navigation'[39m } [1;36m Response 200 POST /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476/elements (12ms)[0m { state: [32m'success'[39m, sessionId: [1mnull[22m, value: [], status: [33m0[39m } [1;36m Request [1;36mPOST /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476/elements [0m[0m { using: [32m'css selector'[39m, value: [32m'#programmatic-navigation'[39m } [1;36m Response 200 POST /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476/elements (28ms)[0m { state: [32m'success'[39m, sessionId: [1mnull[22m, value: [], status: [33m0[39m } [0;32m✖[0m Timed out while waiting for element <#programmatic-navigation> to be present for 3000 milliseconds. - expected [0;32m"found"[0m but got: [0;31m"not found"[0m [0;90m(3176ms)[0m [0;90m at Object.bug (/Users/posva/vue-router-next/e2e/specs/bug-report.js:16:8) at processTicksAndRejections (internal/process/task_queues.js:97:5)[0m [1;37m [0;32m→[0m Completed command: [1;32mwaitForElementPresent[0m ('#programmatic-navigation', 3000) (3178ms)[0m [1;37m[0;32m→[0m Running [afterEach]:[0m [1;37m[0;32m→[0m Completed [afterEach].[0m [0;31mFAILED:[0m [0;31m1[0m assertions failed and [0;32m1[0m passed (3.603s) [1;37m[0;32m→[0m Running [after]:[0m [1;37m[0;32m→[0m Completed [after].[0m [1;37m [0;32m→[0m Running command: [1;32mend[0m ([Function])[0m [1;36mFailures in "bug". Taking screenshot...[0m [1;37m [0;32m→[0m Running command: [1;32msaveScreenshot[0m ('/Users/posva/vue-router-next/e2e/screenshots/bug-report/bug_FAILED_May-20-2020-183042-GMT+0200-(Central-European-Summer.png', [Function])[0m [1;37m [0;32m→[0m Running command: [1;32mscreenshot[0m (false, [Function])[0m [1;36m Request [1;36mGET /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476/screenshot [0m[0m [1;36m Response 200 GET /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476/screenshot (46ms)[0m { state: [32m'success'[39m, sessionId: [1mnull[22m, value: [32m''[39m, status: [33m0[39m, suppressBase64Data: [33mtrue[39m } [1;37m [0;32m→[0m Completed command: [1;32mscreenshot[0m (false, [Function]) (63ms)[0m [1;37m [0;32m→[0m Completed command: [1;32msaveScreenshot[0m ('/Users/posva/vue-router-next/e2e/screenshots/bug-report/bug_FAILED_May-20-2020-183042-GMT+0200-(Central-European-Summer.png', [Function]) (68ms)[0m [1;37m [0;32m→[0m Running command: [1;32msession[0m ('delete', [Function])[0m [1;36m Request [1;36mDELETE /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476 [0m[0m [1;36m Response 200 DELETE /wd/hub/session/448A366F-1485-4F26-81E5-4E4254E1E476 (17ms)[0m { state: [32m'success'[39m, sessionId: [1mnull[22m, value: [1mnull[22m, status: [33m0[39m } [1;37m [0;32m→[0m Completed command: [1;32mend[0m ([Function]) (92ms)[0m [1;37m [0;32m→[0m Completed command: [1;32msession[0m ('delete', [Function]) (21ms)[0m [1;31m_________________________________________________[0m [1;31mTEST FAILURE:[0m [0;31m1[0m assertions failed, [0;32m1[0m passed [0;90m(5.173s)[0m [0;31m ✖ bug-report[0m – [0;90mbug[0m [1;33m(3.603s)[0m [1;36mWrote report file to: e2e/reports/SAFARI_13.1__bug-report.xml.[0m [1;36mWrote log file to: /Users/posva/vue-router-next/selenium-server.log.[0m [1;36mSelenium Server process closed.[0m info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. ```
Configuration
nightwatch.json
The problem appears without adding any config and using the one generated ```js { /** @type {import('nightwatch').NightwatchTestSettingScreenshots} */ const browserDefaults = { selenium_port: 4444, selenium_host: 'localhost', silent: true, screenshots: { enabled: true, on_failure: true, on_error: false, path: 'e2e/screenshots', }, } /** @type {import('nightwatch').NightwatchOptions} */ module.exports = { src_folders: ['e2e/specs'], output_folder: 'e2e/reports', // set to true when testing on multiple browsers (-e chrome,firefox) to display tests as they pass instead of waiting for everything to be finished live_output: false, selenium: { start_process: true, start_session: true, host: '127.0.0.1', port: 4444, server_path: require('selenium-server').path, cli_args: { // 'webdriver.chrome.driver': require('chromedriver').path, // 'webdriver.gecko.driver': require('geckodriver').path, }, }, webdriver: { start_process: false, }, test_settings: { default: { launch_url: 'https://nightwatchjs.org', }, safari: { ...browserDefaults, desiredCapabilities: { browserName: 'safari', acceptSslCerts: true, }, }, }, } ```
Your Environment
nightwatch --version
npm --version
yarn --version
node --version