量角器未连接到Localhost:角度2应用程序测试中的8080 - ERR_CONNECTION_REFUSED

时间:2017-05-31 23:40:56

标签: angularjs unit-testing testing protractor localhost

我正在尝试运行我的量角器测试但是在连接到我在browser.get函数调用中请求的url时遇到了一些问题。

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('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();
  });
});

我已尝试清理浏览历史记录/缓存,并在services.msc中重新启动DNS客户端。两者都没有提供解决方案。

"查看网站信息"浏览器网址中的标签表示"不安全"当Protractor试图加载浏览器但最终它说:ERR_CONNECTION_REFUSED

有谁知道我在这里失踪了什么?感谢

0 个答案:

没有答案