Skip to content

browser.getUrl returns promise #22

Open
@hclsiva

Description

@hclsiva

This is really awesome. Helped me a lot.
Found the following,
I am trying to run the command "Then I expect that the url is "http://webdriverjs.christian-bromann.com/"
When I print currentUrl Object from src/support/check/checkUrl.ts i am getting promise.
[0-0] 2020-11-19T11:01:28.205Z INFO webdriver: COMMAND setWindowRect(null, null, 1280, 720)
[0-0] 2020-11-19T11:01:28.206Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/7ee35bdf5a2f9b270060479b5d2dfd7d/window/rect
[0-0] 2020-11-19T11:01:28.206Z INFO webdriver: DATA { x: null, y: null, width: 1280, height: 720 }
[0-0] 2020-11-19T11:01:28.266Z INFO webdriver: COMMAND navigateTo("http://webdriverjs.christian-bromann.com/")
[0-0] 2020-11-19T11:01:28.271Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/7ee35bdf5a2f9b270060479b5d2dfd7d/url
[0-0] 2020-11-19T11:01:28.272Z INFO webdriver: DATA { url: 'http://webdriverjs.christian-bromann.com/' }
[0-0] 2020-11-19T11:01:28.369Z INFO webdriver: RESULT { height: 720, width: 1280, x: 0, y: 0 }
[0-0] currentUrl = Promise { }
[0-0] Inside else case
[0-0] 2020-11-19T11:01:31.263Z INFO webdriver: COMMAND takeScreenshot()
[0-0] 2020-11-19T11:01:31.266Z INFO webdriver: [GET] http://localhost:4444/wd/hub/session/7ee35bdf5a2f9b270060479b5d2dfd7d/screenshot
[0-0] 2020-11-19T11:01:31.267Z INFO webdriver: COMMAND getUrl()
[0-0] 2020-11-19T11:01:31.270Z INFO webdriver: [GET] http://localhost:4444/wd/hub/session/7ee35bdf5a2f9b270060479b5d2dfd7d/url
[0-0] Error in "Tests for the campaign page.: open URL: Then I expect that the url is "http://webdriverjs.christian-bromann.com""
expected url to be "http://webdriverjs.christian-bromann.com" but found "[object Promise]": expected {} to equal 'http://webdriverjs.christian-bromann.com'
[0-0] 2020-11-19T11:01:31.380Z INFO webdriver: COMMAND deleteSession()
[0-0] 2020-11-19T11:01:31.388Z INFO webdriver: [DELETE] http://localhost:4444/wd/hub/session/7ee35bdf5a2f9b270060479b5d2dfd7d
[0-0] 2020-11-19T11:01:31.864Z INFO webdriver: RESULT http://webdriverjs.christian-bromann.com/
[0-0] 2020-11-19T11:01:32.085Z INFO webdriver: RESULT iVBORw0KGgoAAAANSUhEUgAABQAAAALQCAYAAADPfd1WAAAAAXNSR0IArs4c6...
2020-11-19T11:01:32.157Z DEBUG @wdio/local-runner: Runner 0-0 finished with exit code 1
[0-0] FAILED in chrome - /src/features/volvotests.feature
[1-0] 2020-11-19T11:01:35.655Z INFO webdriver: COMMAND setWindowRect(null, null, 1280, 720)
[1-0] 2020-11-19T11:01:35.655Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/c7a53fa1-6709-4b7e-b4ab-0650e26262f1/window/rect
[1-0] 2020-11-19T11:01:35.656Z INFO webdriver: DATA { x: null, y: null, width: 1280, height: 720 }
[1-0] 2020-11-19T11:01:35.722Z INFO webdriver: COMMAND navigateTo("http://webdriverjs.christian-bromann.com/")
[1-0] 2020-11-19T11:01:35.737Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/c7a53fa1-6709-4b7e-b4ab-0650e26262f1/url
[1-0] 2020-11-19T11:01:35.739Z INFO webdriver: DATA { url: 'http://webdriverjs.christian-bromann.com/' }
[1-0] 2020-11-19T11:01:35.749Z INFO webdriver: RESULT { x: 0, y: 0, width: 1280, height: 720 }
[1-0] currentUrl = Promise { }
[1-0] Inside else case
[1-0] 2020-11-19T11:01:37.503Z INFO webdriver: COMMAND takeScreenshot()
[1-0] 2020-11-19T11:01:37.504Z INFO webdriver: [GET] http://localhost:4444/wd/hub/session/c7a53fa1-6709-4b7e-b4ab-0650e26262f1/screenshot
[1-0] 2020-11-19T11:01:37.505Z INFO webdriver: COMMAND getUrl()
[1-0] 2020-11-19T11:01:37.505Z INFO webdriver: [GET] http://localhost:4444/wd/hub/session/c7a53fa1-6709-4b7e-b4ab-0650e26262f1/url
[1-0] Error in "Tests for the campaign page.: open URL: Then I expect that the url is "http://webdriverjs.christian-bromann.com""
expected url to be "http://webdriverjs.christian-bromann.com" but found "[object Promise]": expected {} to equal 'http://webdriverjs.christian-bromann.com'
[1-0] 2020-11-19T11:01:37.572Z INFO webdriver: COMMAND deleteSession()
[1-0] 2020-11-19T11:01:37.574Z INFO webdriver: [DELETE] http://localhost:4444/wd/hub/session/c7a53fa1-6709-4b7e-b4ab-0650e26262f1
[1-0] 2020-11-19T11:01:37.760Z INFO webdriver: RESULT http://webdriverjs.christian-bromann.com/
[1-0] 2020-11-19T11:01:37.780Z INFO webdriver: RESULT iVBORw0KGgoAAAANSUhEUgAABQAAAAKGCAYAAAAVqja8AAAgAElEQVR4nOydd...
2020-11-19T11:01:40.154Z DEBUG @wdio/local-runner: Runner 1-0 finished with exit code 1
[1-0] FAILED in firefox - /src/features/volvotests.feature
2020-11-19T11:01:40.156Z INFO @wdio/cli:launcher: Run onComplete hook

"spec" Reporter:

[chrome 80.0.3987.106 linux #0-0] Spec: /home/ubuntu/tools/webautomation/web-automation/src/features/volvotests.feature
[chrome 80.0.3987.106 linux #0-0] Running: chrome (v80.0.3987.106) on linux
[chrome 80.0.3987.106 linux #0-0] Session ID: 7ee35bdf5a2f9b270060479b5d2dfd7d
[chrome 80.0.3987.106 linux #0-0]
[chrome 80.0.3987.106 linux #0-0] Tests for the campaign page.
[chrome 80.0.3987.106 linux #0-0] open URL
[chrome 80.0.3987.106 linux #0-0] ✓ Given I open the url "http://webdriverjs.christian-bromann.com"
[chrome 80.0.3987.106 linux #0-0] ✖ Then I expect that the url is "http://webdriverjs.christian-bromann.com"
[chrome 80.0.3987.106 linux #0-0]
[chrome 80.0.3987.106 linux #0-0] 1 passing (7.4s)
[chrome 80.0.3987.106 linux #0-0] 1 failing
[chrome 80.0.3987.106 linux #0-0]
[chrome 80.0.3987.106 linux #0-0] 1) open URL Then I expect that the url is "http://webdriverjs.christian-bromann.com"
[chrome 80.0.3987.106 linux #0-0] expected url to be "http://webdriverjs.christian-bromann.com" but found "[object Promise]": expected {} to equal 'http://webdriverjs.christian-bromann.com'
[chrome 80.0.3987.106 linux #0-0] AssertionError: expected url to be "http://webdriverjs.christian-bromann.com" but found "[object Promise]": expected {} to equal 'http://webdriverjs.christian-bromann.com'
[chrome 80.0.3987.106 linux #0-0] at World.checkUrl (/home/ubuntu/tools/webautomation/web-automation/src/support/check/checkUrl.ts:19:25)
[chrome 80.0.3987.106 linux #0-0] at World.executeAsync (/home/ubuntu/tools/webautomation/web-automation/node_modules/@wdio/utils/build/shim.js:123:21)
[chrome 80.0.3987.106 linux #0-0] at World.testFrameworkFnWrapper (/home/ubuntu/tools/webautomation/web-automation/node_modules/@wdio/utils/build/test-framework/testFnWrapper.js:55:28)

[firefox 73.0 linux #1-0] Spec: /home/ubuntu/tools/webautomation/web-automation/src/features/volvotests.feature
[firefox 73.0 linux #1-0] Running: firefox (v73.0) on linux
[firefox 73.0 linux #1-0] Session ID: c7a53fa1-6709-4b7e-b4ab-0650e26262f1
[firefox 73.0 linux #1-0]
[firefox 73.0 linux #1-0] Tests for the campaign page.
[firefox 73.0 linux #1-0] open URL
[firefox 73.0 linux #1-0] ✓ Given I open the url "http://webdriverjs.christian-bromann.com"
[firefox 73.0 linux #1-0] ✖ Then I expect that the url is "http://webdriverjs.christian-bromann.com"
[firefox 73.0 linux #1-0]
[firefox 73.0 linux #1-0] 1 passing (6.5s)
[firefox 73.0 linux #1-0] 1 failing
[firefox 73.0 linux #1-0]
[firefox 73.0 linux #1-0] 1) open URL Then I expect that the url is "http://webdriverjs.christian-bromann.com"
[firefox 73.0 linux #1-0] expected url to be "http://webdriverjs.christian-bromann.com" but found "[object Promise]": expected {} to equal 'http://webdriverjs.christian-bromann.com'
[firefox 73.0 linux #1-0] AssertionError: expected url to be "http://webdriverjs.christian-bromann.com" but found "[object Promise]": expected {} to equal 'http://webdriverjs.christian-bromann.com'
[firefox 73.0 linux #1-0] at World.checkUrl (/home/ubuntu/tools/webautomation/web-automation/src/support/check/checkUrl.ts:19:25)
[firefox 73.0 linux #1-0] at World.executeAsync (/home/ubuntu/tools/webautomation/web-automation/node_modules/@wdio/utils/build/shim.js:123:21)
[firefox 73.0 linux #1-0] at World.testFrameworkFnWrapper (/home/ubuntu/tools/webautomation/web-automation/node_modules/@wdio/utils/build/test-framework/testFnWrapper.js:55:28)

Spec Files: 0 passed, 2 failed, 2 total (100% completed) in 00:00:31

2020-11-19T11:01:40.162Z INFO @wdio/local-runner: Shutting down spawned worker
2020-11-19T11:01:40.416Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
2020-11-19T11:01:40.418Z INFO @wdio/local-runner: shutting down
npm ERR! code 1
npm ERR! path /home/ubuntu/tools/webautomation/web-automation
npm ERR! command failed
npm ERR! command sh -c node ./node_modules/@wdio/cli/bin/wdio.js --spec

npm ERR! A complete log of this run can be found in:
npm ERR! /home/ubuntu/.npm/_logs/2020-11-19T11_01_40_484Z-debug.log

web-automation@1.0.0 report
node ./cucumber.report.conf.js

=====================================================================================
Multiple Cucumber HTML report generated in:

/home/ubuntu/tools/webautomation/web-automation/report/cucumber/html/index.html

=====================================================================================

ubuntu@ubuntu-VirtualBox:~/tools/webautomation/web-automation$

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions