Banner redirects and is disabled immediately after page load

I am trying to write some e2e specs for an AngularJS app. I have one Jasmine spec in test/e2e/test_spec.js

:

describe('basic functionality', function() {
  it('loads the home page', function() {
    browser.get('/');
    expect(browser.getCurrentUrl()).toMatch(/localhost/);
  });
});

      

Terminal output when running spec:

> protractor protractor.config.js
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
basic functionality
  loads the home page - fail


Failures:

  1) basic functionality loads the home page
   Message:
     Error: waiting for page to load for 10000ms
Wait timed out after 10013ms
   Stacktrace:
     Error: waiting for page to load for 10000ms
Wait timed out after 10013ms
    at Array.forEach (native)
From: Task: waiting for page to load for 10000ms
    at [object Object].<anonymous> (/Users/jdent/swamp-bunny/test/e2e/test_spec.js:3:13)
From: Task: Asynchronous test function: it()
Error
    at [object Object].<anonymous> (/Users/jdent/swamp-bunny/test/e2e/test_spec.js:2:3)
    at Object.<anonymous> (/Users/jdent/swamp-bunny/test/e2e/test_spec.js:1:63)

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

[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 failed 1 test(s)
[launcher] overall: 1 failed spec(s)
[launcher] Process exited with error code 1

      

While the console is sitting on [launcher] Running 1 instances of WebDriver

, Chrome opens and displays the index page for a split second, then navigates to a blank page with data:text/html,<html></html>

in the address bar.

Chrome screenshot

Here is mine protractor.config.js

:

exports.config = {
  seleniumAddress: 'http://localhost:4444/wd/hub',
  capabilities: {
    'browserName': 'chrome'
  },
  specs: 'test/e2e/**/*_spec.js',
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 30000,
    isVerbose: true
  },
  allScriptsTimeout: 20000,
  onPrepare: function() {
    return browser.driver.get("http://localhost:8100");
  }
};

      

My web manager stuff seems to be up to date, although the tool doesn't have the ability to output version numbers.

> webdriver-manager status
selenium standalone is up to date
chromedriver is up to date
IEDriver is not present

      

Why is there no error?

Edit: This is what is printed on the terminal when onPrepare

commented out:

> protractor protractor.config.js
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
A Jasmine spec timed out. Resetting the WebDriver Control Flow.
The last active task was:
unknown
basic functionality
  loads the home page - fail


Failures:

  1) basic functionality loads the home page
   Message:
     timeout: timed out after 30000 msec waiting for spec to complete
   Stacktrace:
     undefined

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

[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 failed 1 test(s)
[launcher] overall: 1 failed spec(s)
[launcher] Process exited with error code 1

      

Edit 2: When I do browser.get("http://google.com")

, Chrome briefly shows pages data:

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

, redirects to Google, and then looks for Angular.

> protractor protractor.config.js
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
basic functionality
  loads the home page - fail


Failures:

  1) basic functionality loads the home page
   Message:
     Error: Angular could not be found on the page http://google.com/ : retries looking for angular exceeded
   Stacktrace:
     Error: Angular could not be found on the page http://google.com/ : retries looking for angular exceeded
    at Array.forEach (native)
From: Task: Asynchronous test function: it()
Error
    at [object Object].<anonymous> (/Users/jdent/swamp-bunny/test/e2e/test_spec.js:2:3)
    at Object.<anonymous> (/Users/jdent/swamp-bunny/test/e2e/test_spec.js:1:63)

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

[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 failed 1 test(s)
[launcher] overall: 1 failed spec(s)
[launcher] Process exited with error code 1

      

+3


source to share


1 answer


Install baseUrl: 'http://localhost:8100'

to your protractor.config.js

file. From Configuring Translator Help :



The base URL for the application under test. Calls to protractor.get () with relative paths will be added with this.

+3


source







All Articles