使用--spec时,量角器e2e测试未运行

时间:2018-04-27 17:33:45

标签: angular protractor

我正在运行e2e'在一个Angular CLI项目中,我想指定要运行的测试,而不是全部运行它们 当我使用' ng e2e --aot '测试运行正常 但是当我使用' ng e2e --aot --spec =。/ e2e / checkout.e2e-spec.ts '我将收到错误消息:

[18:24:51] E/configParser - Error code: 105
[18:24:51] E/configParser - Error message: failed loading configuration file .\e2e\checkout.e2e-spec.ts
[18:24:51] E/configParser - C:\GitRepos\checkout-ui\e2e\checkout.e2e-spec.ts:1
(function (exports, require, module, __filename, __dirname) { import { CheckOut } from './checkoutPage.po';
                                                              ^^^^^^
SyntaxError: Unexpected token import

因此,当我使用--spec指定测试时,测试将失败...而且我不知道为什么:(
任何想法都非常感谢

以下是我的测试规范和我的po如果有帮助。
非常感谢。

测试规范

import { CheckOut } from './checkoutPage.po';

describe('When I arrive at the checkout', () => {
  let page: CheckOut;

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

  it('the checkout button should be clicked', () => {
    page.navigateToCheckout();
    page.clickbutton();
  });
});

PO

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

export class CheckOut {
  shippingElement = element(by.tagName('shipping'));
  shippingSaveAndCoutinueButton = this.shippingElement.element(by.tagName('button'));

  navigateToCheckout() {
    browser.get(
      'http:/mycompany.net/e13cc528-b048-49e6-8981-c59755a6690a',
    );
  }

  clickbutton() {
    this.shippingSaveAndCoutinueButton.click();
  }
}

1 个答案:

答案 0 :(得分:0)

您的问题与您的规格无关。您使用了错误的cmd选项:spec,它应该是specs

enter image description here

here

的详细信息
相关问题