Nick White
Nick White

Reputation: 1612

Protractor using file://

I'm not sure if I am using it exactly in the correct way as I can't see much documentation around this feature. But I saw that there is the possibility of using file:// as the baseUrl option.

Now I am using Chrome in order to run my Protractor tests and wanting to run them whilst not running against a server as there really isn't any need for the implementation. When running Protractor with this configuration it can't seem to get the file the only thing that happens is that the address comes up with

data:text/html,<html></html>

Which then leaves me with the following output

Failures:

  1) Test that my App can get Mocked data Should be on the correct page
   Message:
     Error: Timed out waiting for page to load after 10000ms
Wait timed out after 10062ms
   Stacktrace:
     Error: Timed out waiting for page to load after 10000ms
Wait timed out after 10062ms
==== async task ====
Timed out waiting for page to load after 10000ms
    at null.<anonymous> (/home/nwhite/Sites/apibyexample/abe-protractor/tests/e2e/app/myTestApp.spec.js:3:17)
==== async task ====
Asynchronous test function: beforeEach()
Error
    at null.<anonymous> (/home/nwhite/Sites/apibyexample/abe-protractor/tests/e2e/app/myTestApp.spec.js:2:5)
    at Object.<anonymous> (/home/nwhite/Sites/apibyexample/abe-protractor/tests/e2e/app/myTestApp.spec.js:1:63)

Finished in 12.435 seconds
1 test, 1 assertion, 1 failure

Shutting down selenium standalone server.

Is there any documentation available around this? is it possible using Chrome as I could only see something mention node-webkit? Is there any different configuration options that I need to implement?

Thanks in advanced

Upvotes: 2

Views: 461

Answers (1)

Leo Gallucci
Leo Gallucci

Reputation: 16722

Problem for your use case is Protractor doing self.driver.executeScript('return window.location.href;') here

Given no JS will be possible to execute on a file:// even if you try hacking Protractor and commenting that section something else will break later.

So seems that using file:// as a baseUrl is a dead-end.

Upvotes: 1

Related Questions