mercredi 31 mai 2017

Protractor Not Connecting To Localhost:8080 in Angular 2 App Testing - ERR_CONNECTION_REFUSED

I am trying to run my protractor tests but am having some problems connecting to the url I am requesting in my browser.get function call.

protractor.conf.js:

const { SpecReporter } = require('jasmine-spec-reporter');


exports.config = {
      framework: 'jasmine',
      allScriptsTimeout: 11000,
      specs: ['./e2e_tests/components/**/*.spec.ts'],
      capabilities: {
          'browserName': 'chrome'
      },
      directConnect: true,
      jasmineNodeOpts: {
          showColors: true,
          defaultTimeoutInterval: 30000,
          print: function() {}
      },
      beforeLaunch: function() {
         require('ts-node').register({
            project: 'e2e_tests/tsconfig.e2e.json'
        });
      },
      onPrepare() {
           jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
         }
 };

spec.ts

 import { browser, element, by } from 'protractor';

 describe('Header Bar Component', function () {
   beforeEach(function () {
        browser.get('http://localhost:8080/#/dashboard');
   });

  it('should have a title', function () {
       var headerElement = element(by.tagName('h2'));
       expect(headerElement.getText()).toMatch('Galileo Example');
  });

  it('should have a menu', function () {
      var menu = element(by.tagName('md-menu'));
      expect(menu).not.toBeFalsy();
 });

 it('should have a settings option', function () {
      var menuOption = element(by.buttonText('Settings'));
      expect(menuOption).not.toBeFalsy();
  });
});

I have tried cleaning my browsing history / cache and also restarting my DNS Client in services.msc. Both did not provide a solution.

The "View Site Information" tab in the browser url is saying "Not Secure" when Protractor is trying to load the browser but in the end it says: ERR_CONNECTION_REFUSED

Does anyone know what I'm missing here? Thanks

Aucun commentaire:

Enregistrer un commentaire