0

我正在尝试使用 Serenity-Js 框架自动化 [ https://www.predix-ui.com/#/home][1] 。My Given 包含打开 URL 的步骤,When 部分包含要单击左侧菜单中组件内的px-accordin的操作项。

下面是我的功能文件看起来像

Scenario: To identify px-accordoin
  Given access to predix ui
  When i click on px-accordion
  Then i shall automate the expand and collapse

以下是我的步骤文件

export =
function identiyPXComponents() {

  this.setDefaultTimeout(120 * 1000);

  const actor = Actor.named("James").whoCan(BrowseTheWeb.using(protractor.browser));

  const stage = serenity.callToStageFor({
    actor: (name) => Actor.named(name).whoCan(BrowseTheWeb.using(protractor.browser)),
  });

  this.Given(/^access to predix ui$/, function () {
    return stage.theActorCalled("James").attemptsTo(
        Start.openApplication()
    );
  });

  this.When(/^i click on px-accordion$/, function () {
    return stage.theActorInTheSpotlight().attemptsTo(PXAccordinComponent.pxAccordinComponent()
    );
  });

  this.Then(/^i shall automate the expand and collapse$/, function () {
    return expect(actor.toSee(Text.of(PXComponentsElements.headerText))).to.eventually.equal("Date And Time");
  });
};

我看到的错误是:鉴于它失败了。但我看到 URL 正在打开,但随后超时并出现以下错误:

Error: Error while running testForAngular: asynchronous script timeout: result was not received in 110 seconds
       (Session info: chrome=60.0.3112.113)
       (Driver info: chromedriver=2.32.498537 (cb2f855cbc7b82e20387eaf9a43f6b99b6105061),platform=Mac OS X 10.11.6 x86_64) (WARNING: The server did not provide any stacktrace information)
     Command duration or timeout: 110.85 seconds
     Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
     System info: host: 'C02PQD87G8WP', ip: '3.204.57.13', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.6', java.version: '1.8.0_65'
     Driver info: org.openqa.selenium.chrome.ChromeDriver
     Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.32.498537 (cb2f855cbc7b82e20387eaf9a43f6b99b6105061), userDataDir=/var/folders/z8/djc07ncj00v81002xs1wh6sw0000gn/T/.org.chromium.Chromium.IHsjtp}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=60.0.3112.113, platform=MAC, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, setWindowRect=true, unexpectedAlertBehaviour=}]
     Session ID: 0a67b882a3d3465cc91eb92ef414897d

无法继续进行,因为代码永远不会导航到When部分。我已经尝试过增加超时时间。

我可以使用普通的量角器-黄瓜-打字稿框架自动化同一个网站。但不使用 Serenity-Js。 请提供您的见解。

4

1 回答 1

0

请查看以下答案,其中我解释了在测试非 Angular 应用程序时如何禁用特定于 Angular 的同步。

最好的,

于 2017-09-22T10:54:10.270 回答