需要一个如何在 serenity-js 上点击按钮的例子

Need an example of how to do a button click on serenity-js

我对 serenity-js 和量角器真的很陌生。我按照 'https://github.com/serenity-js/seed-cucumber/tree/master/features' 来熟悉 serenity-js。有人可以给我一个如何点击按钮的例子吗?

例如点击 'TRY THE NEW ANGULAR'

一个很好的起点是遵循 the official tutorial

要点击按钮,您需要:

// an Actor
const actor = Actor.named('Bob').whoCan(BrowseTheWeb.using(protractor.browser));

// a Target
const LandingPage = {
  Buy_Now = Target.the('"Buy Now" button').located(by.id('#buy-now'));
}

// to tell the actor to perform the Click
actor.attemptsTo(
  Click.on(LandingPage.Buy_Now),
);

希望对您有所帮助!

一月