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

问题描述 投票:0回答:1

我在Angular CLI项目上运行'ng e2e',但我想指定要运行的测试而不是全部运行它们。 当我使用'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();
  });
});

软件

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();
  }
}
angular protractor
1个回答
0
投票

你的问题和你的问题没什么关系。你使用错误的cmd选项:spec,它应该是specs

enter image description here

更多细节在here

© www.soinside.com 2019 - 2024. All rights reserved.