mucsi96 / nightwatch-api

[DEPRECATED] Cross-runner API for Nightwatch.js
https://nightwatch-api.netlify.com/
MIT License
84 stars 64 forks source link

Invalid session id errors when running examples #207

Closed marcdonovan closed 5 years ago

marcdonovan commented 5 years ago

Expected Behavior

Expect example tests to run without errors

Current Behavior

Feature: Google Search

Scenario: Searching Google Given I open Google`s search page Error while running .navigateTo() protocol action: invalid session id

Steps to Reproduce (for bugs)

git clone https://github.com/mucsi96/nightwatch-api.git cd nightwatch-api/packages/cucumber-example npm install npm run test

Your Environment

Linux mint

mucsi96 commented 5 years ago

Hi, I cannot reproduce this on Windows 10 or Ubuntu. Also all examples are running as part of CI build so something should be with your machine. Please try to dig into the root cause of the issue.

Windows 10 output:

C:\Users\Igor>cd test

C:\Users\Igor\test>git clone https://github.com/mucsi96/nightwatch-api.git
Cloning into 'nightwatch-api'...
remote: Enumerating objects: 100, done.
remote: Counting objects: 100% (100/100), done.
remote: Compressing objects: 100% (100/100), done.
remote: Total 2895 (delta 74), reused 0 (delta 0), pack-reused 2795
Receiving objects: 100% (2895/2895), 2.95 MiB | 4.50 MiB/s, done.
Resolving deltas: 100% (2041/2041), done.

C:\Users\Igor\test>cd nightwatch-api/packages/cucumber-example

C:\Users\Igor\test\nightwatch-api\packages\cucumber-example>npm install

> chromedriver@2.46.0 install C:\Users\Igor\test\nightwatch-api\packages\cucumber-example\node_modules\chromedriver
> node install.js

ChromeDriver binary exists. Validating...
ChromeDriver 2.46.628402 (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1)

ChromeDriver is already available at 'C:\Users\Igor\AppData\Local\Temp\2.46\chromedriver\chromedriver.exe'.
Copying to target path C:\Users\Igor\test\nightwatch-api\packages\cucumber-example\node_modules\chromedriver\lib\chromedriver
Done. ChromeDriver binary available at C:\Users\Igor\test\nightwatch-api\packages\cucumber-example\node_modules\chromedriver\lib\chromedriver\chromedriver.exe

> cucumber-expressions@6.0.1 postinstall C:\Users\Igor\test\nightwatch-api\packages\cucumber-example\node_modules\cucumber-expressions
> node scripts/postinstall.js

> geckodriver@1.14.1 postinstall C:\Users\Igor\test\nightwatch-api\packages\cucumber-example\node_modules\geckodriver
> node index.js

Downloading geckodriver... Extracting... Complete.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

added 428 packages from 792 contributors and audited 3110 packages in 16.631s
found 1 low severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details

C:\Users\Igor\test\nightwatch-api\packages\cucumber-example>npm run test

> nightwatch-api-cucumber@1.0.0 test C:\Users\Igor\test\nightwatch-api\packages\cucumber-example
> cucumber-js --require-module babel-core/register --require cucumber.conf.js --require step-definitions --format node_modules/cucumber-pretty

DevTools listening on ws://127.0.0.1:52624/devtools/browser/17d00cfb-bb22-4df8-9c55-6fedbfbd0350
Feature: DuckDuckGo

  Scenario: Searching DuckDuckGo
    Given I open DuckDuckGo search page
    Then the title is "DuckDuckGo — Privacy, simplified."
√ Testing if the page title equals "DuckDuckGo — Privacy, simplified."  - 7 ms.
    And the DuckDuckGo search form exists
√ Testing if element <input[name="q"]> is visible  - 31 ms.

  Scenario: Searching DuckDuckGo again
    Given I open DuckDuckGo search page
    Then the title is "DuckDuckGo — Privacy, simplified."
√ Testing if the page title equals "DuckDuckGo — Privacy, simplified."  - 6 ms.
    And the DuckDuckGo search form exists
√ Testing if element <input[name="q"]> is visible  - 25 ms.

Feature: Google Search

  Scenario: Searching Google
    Given I open Google`s search page
    Then the title is "Google"
√ Testing if the page title equals "Google"  - 6 ms.
    And the Google search form exists
√ Testing if element <input[name="q"]> is visible  - 43 ms.

  Scenario: Searching Google again
    Given I open Google`s search page
    Then the title is "Google"
√ Testing if the page title equals "Google"  - 6 ms.
    And the Google search form exists
√ Testing if element <input[name="q"]> is visible  - 28 ms.

4 scenarios (4 passed)
12 steps (12 passed)
0m04.876s

C:\Users\Igor\test\nightwatch-api\packages\cucumber-example>

Ubuntu output:

igor@DESKTOP-2NPTMJ8:~$ cd test/
igor@DESKTOP-2NPTMJ8:~/test$ git clone https://github.com/mucsi96/nightwatch-api.git
Cloning into 'nightwatch-api'...
remote: Enumerating objects: 100, done.
remote: Counting objects: 100% (100/100), done.
remote: Compressing objects: 100% (100/100), done.
remote: Total 2895 (delta 74), reused 0 (delta 0), pack-reused 2795
Receiving objects: 100% (2895/2895), 2.95 MiB | 3.92 MiB/s, done.
Resolving deltas: 100% (2041/2041), done.
igor@DESKTOP-2NPTMJ8:~/test$ cd nightwatch-api/packages/cucumber-example
igor@DESKTOP-2NPTMJ8:~/test/nightwatch-api/packages/cucumber-example$ npm install

> chromedriver@2.46.0 install /home/igor/test/nightwatch-api/packages/cucumber-example/node_modules/chromedriver
> node install.js

Current existing ChromeDriver binary is unavailable, proceding with download and extraction.
Downloading from file:  https://chromedriver.storage.googleapis.com/2.46/chromedriver_linux64.zip
Saving to file: /tmp/2.46/chromedriver/chromedriver_linux64.zip
Received 781K...
Received 1568K...
Received 2352K...
Received 3136K...
Received 3920K...
Received 4704K...
Received 5277K total.
Extracting zip contents
Copying to target path /home/igor/test/nightwatch-api/packages/cucumber-example/node_modules/chromedriver/lib/chromedriver
Fixing file permissions
Done. ChromeDriver binary available at /home/igor/test/nightwatch-api/packages/cucumber-example/node_modules/chromedriver/lib/chromedriver/chromedriver

> cucumber-expressions@6.0.1 postinstall /home/igor/test/nightwatch-api/packages/cucumber-example/node_modules/cucumber-expressions
> node scripts/postinstall.js

> geckodriver@1.14.1 postinstall /home/igor/test/nightwatch-api/packages/cucumber-example/node_modules/geckodriver
> node index.js

Downloading geckodriver... Extracting... Complete.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 428 packages from 792 contributors and audited 3110 packages in 82.42s
found 1 low severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details

   ╭───────────────────────────────────────────────────────────────╮
   │                                                               │
   │       New minor version of npm available! 6.4.1 → 6.7.0       │
   │   Changelog: https://github.com/npm/cli/releases/tag/v6.7.0   │
   │               Run npm install -g npm to update!               │
   │                                                               │
   ╰───────────────────────────────────────────────────────────────╯

igor@DESKTOP-2NPTMJ8:~/test/nightwatch-api/packages/cucumber-example$ npm run test

> nightwatch-api-cucumber@1.0.0 test /home/igor/test/nightwatch-api/packages/cucumber-example
> cucumber-js --require-module babel-core/register --require cucumber.conf.js --require step-definitions --format node_modules/cucumber-pretty

Feature: DuckDuckGo

  Scenario: Searching DuckDuckGo
    Given I open DuckDuckGo search page
    Then the title is "DuckDuckGo — Privacy, simplified."
✔ Testing if the page title equals "DuckDuckGo — Privacy, simplified."  - 9 ms.
    And the DuckDuckGo search form exists
✔ Testing if element <input[name="q"]> is visible  - 41 ms.

  Scenario: Searching DuckDuckGo again
    Given I open DuckDuckGo search page
    Then the title is "DuckDuckGo — Privacy, simplified."
✔ Testing if the page title equals "DuckDuckGo — Privacy, simplified."  - 6 ms.
    And the DuckDuckGo search form exists
✔ Testing if element <input[name="q"]> is visible  - 28 ms.

Feature: Google Search

  Scenario: Searching Google
    Given I open Google`s search page
    Then the title is "Google"
✔ Testing if the page title equals "Google"  - 7 ms.
    And the Google search form exists
✔ Testing if element <input[name="q"]> is visible  - 40 ms.

  Scenario: Searching Google again
    Given I open Google`s search page
    Then the title is "Google"
✔ Testing if the page title equals "Google"  - 6 ms.
    And the Google search form exists
✔ Testing if element <input[name="q"]> is visible  - 29 ms.

4 scenarios (4 passed)
12 steps (12 passed)
0m02.885s
^C

igor@DESKTOP-2NPTMJ8:~/test/nightwatch-api/packages/cucumber-example$
mucsi96 commented 5 years ago

Are you getting this error message? https://travis-ci.org/mucsi96/nightwatch-api/jobs/494760085#L680

The error message is really strange as it was running perfectly before updating the geckodriver to latest even the test are not running against firefox, but against headless chrome.

Interesting ....

Can you try to switch to earlier version of geckodriver or remove it completely?

What version of Node and NPM you are using?

marcdonovan commented 5 years ago

mint@mint-HP-ProBook-4520s ~ $ node --version v10.13.0 mint@mint-HP-ProBook-4520s ~ $ npm --version 6.6.0

Is there some other system I need to be running in the background, like selenium server or whatever?

spnraju commented 5 years ago

Hi @mucsi96 and @marcdonovan , there was an issue with geckodriver https://github.com/vladikoff/node-geckodriver/issues/59. It is fixed in 1.15.1

mucsi96 commented 5 years ago

I assume the issue is resolved. Closing... Feel free to reopen if it still exist.

marcdonovan commented 5 years ago

Removed geckodriver, still the same errors Scenario: Searching Google Given I open Google`s search page Error while running .navigateTo() protocol action: invalid session id

Then the title is "Google"

Error while running .getPageTitle() protocol action: invalid session id

Error while running .getPageTitle() protocol action: invalid session id

Error while running .getPageTitle() protocol action: invalid session id

marcdonovan commented 5 years ago

I'm not allowed to reopen the issue. I will try this on vanilla ubuntu on amazon

marcdonovan commented 5 years ago

ssh -i .ssh/cucumber.pem ubuntu@ec2-34-212-68-114.us-west-2.compute.amazonaws.com

mint@mint-HP-ProBook-4520s ~ $ cat .ssh/cucumber.pem -----BEGIN RSA PRIVATE KEY----- MIIEpAIBAAKCAQEAn4RfJmdwGzCGYCn3xirbttQ8Moir+dskBeovtaLUW7YVtgoG8d4LEL7RtaiR Jr8I/Wlwy38KDlPVJBRJkIvBv+61IPfwncCF5dQmYiqMTT5xFiMYCVTgSKcGqp3tEbuUSCoeB/mQ jYj+s7HlNtDKr2/jCtNqdWx2qyn2gQSfCyJyh5OZjpjPu7MX1GCVEI0CzIiAHmdJaK1NLrcbrOqk loU3q3mnW4P78ixLHFDFLk3Ez02x2syy789PwyhlK01tF3nH7BRbmRtUpybKoIcKL4ec7C24MMsL yutDqB+zPPb0iQCkSy0ynFHTfcoX589nF4zvsLQUiQnuDiwzE6WuBwIDAQABAoIBAAuMoPr92D8P t1r1Dux5I+lL2o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g/Lj7vYNgzwlB538ZJ8uFFdr+BqhhAgihXoZWNA/EFj oVFJEk1xGdRpnzoOejlOQ0FG5tzd9uDiXcv8Gga0ZiiJu794vgdjQfR8bFPkz1YKMSrXgQ== -----END RSA PRIVATE KEY-----

ubuntu@ip-172-31-26-199:~/nightwatch-api/packages/cucumber-example$ npm run test

nightwatch-api-cucumber@1.0.0 test /home/ubuntu/nightwatch-api/packages/cucumber-example cucumber-js --require-module babel-core/register --require cucumber.conf.js --require step-definitions --format node_modules/cucumber-pretty

Feature: DuckDuckGo

Scenario: Searching DuckDuckGo Given I open DuckDuckGo search page Error while running .navigateTo() protocol action: invalid session id

Then the title is "DuckDuckGo — Privacy, simplified."

Error while running .getPageTitle() protocol action: invalid session id

Error while running .getPageTitle() protocol action: invalid session id

Error while running .getPageTitle() protocol action: invalid session id

✖ Testing if the page title equals "DuckDuckGo — Privacy, simplified." in 1000 ms. - expected "DuckDuckGo — Privacy, simplified." but got: "[object Object]" at World. (/home/ubuntu/nightwatch-api/packages/cucumber-example/step-definitions/steps.js:13:23)

✖ failed
  Error while running "title" command: Testing if the page title equals "DuckDuckGo — Privacy, simplified." in 1000 ms. - expected "DuckDuckGo — Privacy, simplified." but got: "[object Object]"
      at World.<anonymous> (/home/ubuntu/nightwatch-api/packages/cucumber-example/step-definitions/steps.js:13:23)
And the DuckDuckGo search form exists
- skipped

Scenario: Searching DuckDuckGo again Given I open DuckDuckGo search page Error while running .navigateTo() protocol action: invalid session id

Then the title is "DuckDuckGo — Privacy, simplified."

Error while running .getPageTitle() protocol action: invalid session id

Error while running .getPageTitle() protocol action: invalid session id

Error while running .getPageTitle() protocol action: invalid session id

✖ Testing if the page title equals "DuckDuckGo — Privacy, simplified." in 1000 ms. - expected "DuckDuckGo — Privacy, simplified." but got: "[object Object]" at World. (/home/ubuntu/nightwatch-api/packages/cucumber-example/step-definitions/steps.js:13:23)

✖ failed
  Error while running "title" command: Testing if the page title equals "DuckDuckGo — Privacy, simplified." in 1000 ms. - expected "DuckDuckGo — Privacy, simplified." but got: "[object Object]"
      at World.<anonymous> (/home/ubuntu/nightwatch-api/packages/cucumber-example/step-definitions/steps.js:13:23)
And the DuckDuckGo search form exists
- skipped

Feature: Google Search

Scenario: Searching Google Given I open Google`s search page Error while running .navigateTo() protocol action: invalid session id

Then the title is "Google"

Error while running .getPageTitle() protocol action: invalid session id

Error while running .getPageTitle() protocol action: invalid session id

Error while running .getPageTitle() protocol action: invalid session id

✖ Testing if the page title equals "Google" in 1000 ms. - expected "Google" but got: "[object Object]" at World. (/home/ubuntu/nightwatch-api/packages/cucumber-example/step-definitions/steps.js:13:23)

✖ failed
  Error while running "title" command: Testing if the page title equals "Google" in 1000 ms. - expected "Google" but got: "[object Object]"
      at World.<anonymous> (/home/ubuntu/nightwatch-api/packages/cucumber-example/step-definitions/steps.js:13:23)
And the Google search form exists
- skipped

Scenario: Searching Google again Given I open Google`s search page Error while running .navigateTo() protocol action: invalid session id

Then the title is "Google"

Error while running .getPageTitle() protocol action: invalid session id

Error while running .getPageTitle() protocol action: invalid session id

Error while running .getPageTitle() protocol action: invalid session id

✖ Testing if the page title equals "Google" in 1000 ms. - expected "Google" but got: "[object Object]" at World. (/home/ubuntu/nightwatch-api/packages/cucumber-example/step-definitions/steps.js:13:23)

✖ failed
  Error while running "title" command: Testing if the page title equals "Google" in 1000 ms. - expected "Google" but got: "[object Object]"
      at World.<anonymous> (/home/ubuntu/nightwatch-api/packages/cucumber-example/step-definitions/steps.js:13:23)
And the Google search form exists
- skipped

Failures:

1) Scenario: Searching DuckDuckGo # features/duckduckgo-search.feature:3 ✔ Given I open DuckDuckGo search page # step-definitions/steps.js:8 ✖ Then the title is "DuckDuckGo — Privacy, simplified." # step-definitions/steps.js:12 Error while running "title" command: Testing if the page title equals "DuckDuckGo — Privacy, simplified." in 1000 ms. - expected "DuckDuckGo — Privacy, simplified." but got: "[object Object]" at World. (/home/ubuntu/nightwatch-api/packages/cucumber-example/step-definitions/steps.js:13:23)

2) Scenario: Searching DuckDuckGo again # features/duckduckgo-search.feature:9 ✔ Given I open DuckDuckGo search page # step-definitions/steps.js:8 ✖ Then the title is "DuckDuckGo — Privacy, simplified." # step-definitions/steps.js:12 Error while running "title" command: Testing if the page title equals "DuckDuckGo — Privacy, simplified." in 1000 ms. - expected "DuckDuckGo — Privacy, simplified." but got: "[object Object]" at World. (/home/ubuntu/nightwatch-api/packages/cucumber-example/step-definitions/steps.js:13:23)

3) Scenario: Searching Google # features/google-search.feature:3 ✔ Given I open Google`s search page # step-definitions/steps.js:4 ✖ Then the title is "Google" # step-definitions/steps.js:12 Error while running "title" command: Testing if the page title equals "Google" in 1000 ms. - expected "Google" but got: "[object Object]" at World. (/home/ubuntu/nightwatch-api/packages/cucumber-example/step-definitions/steps.js:13:23)

4) Scenario: Searching Google again # features/google-search.feature:9 ✔ Given I open Google`s search page # step-definitions/steps.js:4 ✖ Then the title is "Google" # step-definitions/steps.js:12 Error while running "title" command: Testing if the page title equals "Google" in 1000 ms. - expected "Google" but got: "[object Object]" at World. (/home/ubuntu/nightwatch-api/packages/cucumber-example/step-definitions/steps.js:13:23)

4 scenarios (4 failed) 12 steps (4 failed, 4 skipped, 4 passed) 0m04.091s npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! nightwatch-api-cucumber@1.0.0 test: cucumber-js --require-module babel-core/register --require cucumber.conf.js --require step-definitions --format node_modules/cucumber-pretty npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the nightwatch-api-cucumber@1.0.0 test script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /home/ubuntu/.npm/_logs/2019-02-21T00_59_45_438Z-debug.log

marcdonovan commented 5 years ago

It's not my box. You have root so debug away.

mucsi96 commented 5 years ago

As we are not able to reproduce https://travis-ci.org/mucsi96/nightwatch-api/builds/495773793?utm_source=github_status&utm_medium=notification please try the same test with pure NightwatchJS without using this package. That would at least show where is the problem

marcdonovan commented 5 years ago

I just put up a virgin VM on AWS that reproduces the problem and I gave you root access to try it out. How are you not able to reproduce?

What is pure Nightwatchjs? What package are you wanting me to without using? I tried removing gecko and same.

All I did on the virgin VM was install latest nodejs, checkout your github, run test and it failed.

mucsi96 commented 5 years ago

Do you have Chrome installed on this VM? The cucumber example is configured to run on headless Chrome browser by default. Also you should turn on the WebDriver logs to see better what’s the issue here

mucsi96 commented 5 years ago

I don’t really like the manner you communicate and expect us to fix an issue submitted only by you. For some reason nobody else is complaining about this. Also please don’t forget this is an open-source project created and maintained in free time. No one is paying us to do that. We are able to exist only by contribution of people willing to help the community. We try to prioritize our efforts on issues which affect more people first

marcdonovan commented 5 years ago

I am paying Amazon to demo the error. You know what, I'm out with this project. I thought it had promise but I can't get it to work following your instructions. I've been a coder for 40 years and I'm done with you.

marcdonovan commented 5 years ago

Instance terminated. Nevermind.

spnraju commented 5 years ago

Dear Mr @marcdonovan , I am sorry that you are facing issue with this package. With due respect, kindly be a little polite in your conversation. Reiterating what has been said already, this is an open source project and an issue wont be fixed/addressed just because it is posted. I regret to know that you had to pay Amazon. But that is how it works. If you still think there is some issue, feel free to fix and raise a PR with your 40yrs of coding experience. We will be glad to merge it and add you as contributor. Thank you for the support and understanding.

aberonni commented 5 years ago

FYI I've linked to another example of this occurring above, I also have a hunch that this issue might actually be the result of a nightwatch issue: https://github.com/nightwatchjs/nightwatch/issues/1936 if anyone encounters this and can reproduce consistently, please add more info there (and upvote the issue)