mardi 26 mars 2019

Error when running e2e tests in Visual Studio 2017 with MVC dotNet Core 2.2 and Angular 7

Trying to set up some e2e testing in VS2017 for an dotnet core 2.2 MVC app that fronts an Angular 7 SPA.

When I run the default tests from Visual Studio, the tests come back as "Ignored: Task skipped on timeout". I also get a Jasmine page in a browser with lots of errors.

tsconfig.e2e.json

{
  "extends": "../tsconfig.json",
  "compilerOptions": {

    "outDir": "../out-tsc/app",
    "module": "commonjs",
    "target": "es5",
    "types": [
      "jasmine",
      "jasminewd2",
      "node"
    ]
  }
}

protractor.conf.js

// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts

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

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

app.e2e-spec.ts

import { AppPage } from './app.po';
import { browser, logging, by } from 'protractor';

describe('workspace-project App', () => {
  let page: AppPage;

  beforeEach(() => {
    page = new AppPage();
  });


  it('should display welcome message', () => {
    page.navigateTo();
    expect(page.getTitleText()).toEqual('Welcome to a7app!');
  });

  afterEach(async () => {
    // Assert that there are no errors emitted from the browser
    const logs = await browser.manage().logs().get(logging.Type.BROWSER);
    expect(logs).not.toContain(jasmine.objectContaining({
      level: logging.Level.SEVERE,
    } as logging.Entry));
  });
});

app.po.ts

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

export class AppPage {
  navigateTo() {
    return browser.get(browser.baseUrl) as Promise<any>;
  }

  getTitleText() {
    return element(by.css('app-root h1')).getText() as Promise<string>;
  }
}

lines of jasmine output

0 specs, 0 failures, randomized with seed 84783
Error during loading: Uncaught SyntaxError: Identifier 'selenium_webdriver_1' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/protractor/built/runner.js line 1
Error during loading: Uncaught TypeError: logger_1.Logger is not a constructor in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/protractor/built/driverProviders/index.js line 28
Error during loading: Uncaught SyntaxError: Identifier 'selenium_webdriver_1' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/protractor/built/driverProviders/driverProvider.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'selenium_webdriver_1' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/protractor/built/driverProviders/useExistingWebDriver.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'logger_1' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/protractor/built/driverProviders/kobiton.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'logger_1' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/protractor/built/driverProviders/testObject.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'logger_1' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/protractor/built/driverProviders/sauce.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'selenium_webdriver_1' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/protractor/built/driverProviders/mock.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'logger_1' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/protractor/built/driverProviders/local.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'logger_1' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/protractor/built/driverProviders/hosted.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'selenium_webdriver_1' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/protractor/built/driverProviders/direct.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'logger_1' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/protractor/built/driverProviders/browserStack.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'selenium_webdriver_1' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/protractor/built/driverProviders/attachSession.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'chrome' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/protractor/built/ptor.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'selenium_webdriver_1' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/protractor/built/locators.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'selenium_webdriver_1' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/protractor/built/expectedConditions.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'selenium_webdriver_1' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/protractor/built/element.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'selenium_webdriver_1' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/protractor/built/browser.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'selenium_webdriver_1' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/protractor/built/debugger.js line 1
Error during loading: Uncaught ReferenceError: goog is not defined in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/protractor/built/webdriver-js-extender/index.js line 8
Error during loading: Uncaught SyntaxError: Identifier 'blockingproxy_1' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/blocking-proxy/built/lib/client.js line 1
Error during loading: Uncaught TypeError: Cannot read property 'FindElement' of undefined in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/blocking-proxy/built/lib/webdriver_logger.js line 20
Error during loading: Uncaught SyntaxError: Identifier 'webdriver_commands_1' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/blocking-proxy/built/lib/highlight_delay_barrier.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'http' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/blocking-proxy/built/lib/webdriver_proxy.js line 1
Error during loading: Uncaught TypeError: Class extends value undefined is not a constructor or null in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/blocking-proxy/built/lib/webdriver_commands.js line 112
Error during loading: Uncaught SyntaxError: Identifier 'http' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/blocking-proxy/built/lib/simple_webdriver_client.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'chrome' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/index.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'http' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/safari.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'fs' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/remote/index.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'fs' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/phantomjs.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'fs' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/opera.js line 1
Error during loading: Uncaught TypeError: Cannot read property 'addImplementation' of undefined in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/lib/webdriver.js line 2442
Error during loading: Uncaught SyntaxError: Identifier 'by' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/lib/until.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'Capabilities' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/lib/session.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'error' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/lib/promise.js line 1
Error during loading: Uncaught ReferenceError: module is not defined in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/lib/logging.js line 664
Error during loading: Uncaught ReferenceError: module is not defined in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/lib/input.js line 167
Error during loading: Uncaught ReferenceError: module is not defined in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/lib/events.js line 207
Error during loading: Uncaught ReferenceError: module is not defined in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/lib/error.js line 563
Error during loading: Uncaught ReferenceError: module is not defined in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/lib/command.js line 241
Error during loading: Uncaught SyntaxError: Identifier 'Symbols' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/lib/capabilities.js line 1
Error during loading: Uncaught ReferenceError: module is not defined in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/lib/by.js line 282
Error during loading: Uncaught SyntaxError: Identifier 'command' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/lib/actions.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'fs' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/ie.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'http' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/http/index.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'error' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/lib/http.js line 1
Error during loading: Uncaught ReferenceError: module is not defined in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/lib/atoms/is-displayed.js line 2
Error during loading: Uncaught ReferenceError: module is not defined in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/lib/atoms/get-attribute.js line 2
Error during loading: Uncaught SyntaxError: Identifier 'http' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/firefox/index.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'Executor' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/http/util.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'fs' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/firefox/profile.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'fs' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/firefox/extension.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'path' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/io/zip.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'fs' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/firefox/binary.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'Command' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/io/exec.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'fs' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/lib/devmode.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'fs' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/edge.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'fs' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/chrome.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'fs' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/net/portprober.js line 1
Error during loading: Uncaught ReferenceError: module is not defined in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/lib/symbols.js line 26
Error during loading: Uncaught SyntaxError: Identifier 'fs' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/io/index.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'fs' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/selenium-webdriver/node_modules/tmp/lib/tmp.js line 1
Error during loading: Uncaught ReferenceError: process is not defined in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/os-tmpdir/index.js line 2
Error during loading: Uncaught SyntaxError: Identifier 'path' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/rimraf/rimraf.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'fs' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/glob/glob.js line 1
Error during loading: Uncaught ReferenceError: module is not defined in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/once/once.js line 2
Error during loading: Uncaught ReferenceError: module is not defined in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/inflight/inflight.js line 5
Error during loading: Uncaught ReferenceError: module is not defined in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/wrappy/wrappy.js line 6
Error during loading: Uncaught SyntaxError: Identifier 'path' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/glob/common.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'fs' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/glob/sync.js line 1
Error during loading: Uncaught ReferenceError: module is not defined in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/path-is-absolute/index.js line 18
Error during loading: Uncaught ReferenceError: module is not defined in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/inherits/inherits.js line 6
Error during loading: Uncaught ReferenceError: module is not defined in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/inherits/inherits_browser.js line 3
Error during loading: Uncaught SyntaxError: Identifier 'path' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/minimatch/minimatch.js line 1
Error during loading: Uncaught ReferenceError: module is not defined in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/brace-expansion/index.js line 4
Error during loading: Uncaught ReferenceError: module is not defined in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/balanced-match/index.js line 2
Error during loading: Uncaught ReferenceError: module is not defined in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/concat-map/index.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'fs' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/fs.realpath/index.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'fs' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/fs.realpath/old.js line 1
Error during loading: Uncaught SyntaxError: Identifier 'logger_1' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/protractor/built/plugins.js line 1
Error during loading: Uncaught ReferenceError: module is not defined in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/url/util.js line 3
Error during loading: Uncaught SyntaxError: Identifier 'EventEmitter' has already been declared in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/events/events.js line 1
Error during loading: Uncaught ReferenceError: module is not defined in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/querystring/encode.js line 40
Error during loading: Uncaught ReferenceError: module is not defined in http://localhost:65086/referenceFile?path=~/ITSAppv303/a7app/node_modules/querystring/decode.js line 31

I'd expect the tests to at least try to run.

Aucun commentaire:

Enregistrer un commentaire