A next generation, full-stack acceptance testing framework optimised for collaboration, speed and scale!
APACHE-2.0 License
Bot releases are hidden (Show)
Published by jan-molak over 7 years ago
<a name"0.10.2">
Cucumber Data Tables are handy for passing a list of values to a step definition:
Scenario: Serenity/JS reports DataTable steps
Given the following accounts:
| name | email | twitter |
| Jan | [email protected] | @JanMolak |
| John | [email protected] | @wakaleo |
and that's what they'll look like in your Serenity Report:
Doc Strings are handy for passing a larger piece of text to a step definition.
Scenario: Serenity/JS reports DocString steps
Given an example.ts file with the following contents:
"""
export const noop = (_) => _;
export const sum = (a, b) => a + b;
"""
Doc Strings are now reported too:
Show your support, give Serenity/JS a star! ★
Published by jan-molak almost 8 years ago
<a name"0.10.1">
Published by jan-molak almost 8 years ago
There are two ways you can wait for things to happen in your test scenarios:
To make your test wait using a PassiveWait
(an equivalent of browser.sleep()
in Protractor):
actor.attemptsTo(
Wait.for(Duration.ofMillis(500)), // we *assume* that the button will show up during 500ms
Click.on(InboxNavigation.Compose_Button)
)
Please bear in mind that by using a PassiveWait
in your test scenario, you're making an assumption that whatever the condition you're waiting for is, it will be met within the specified timeout. If this assumption turns out to be incorrect (because of the network being slow for instance), your test might result in false negatives. Please try to use ActiveWait
instead as it's less prone to assumption-related issues ;-)
Why did I introduce PassiveWait
then? Because it's useful with things such as CSS3 animations.
To make your test wait using an ActiveWait
(so actively polling the app until the condition is met):
actor.attemptsTo(
Wait.until(InboxNavigation.Compose_Button, Is.clickable()),
Click.on(InboxNavigation.Compose_Button)
)
To specify the maximum timeout:
actor.attemptsTo(
Wait.upTo(Duration.seconds(10)).until(InboxNavigation.Compose_Button, Is.clickable()),
Click.on(InboxNavigation.Compose_Button)
)
You might also want to check out the Is
class to see what conditions are already defined and find inspiration to write some of your own.
Hope you find the new features useful!
Jan
Many thanks to @npryce for suggesting to introduce the Duration
class ✋
Published by jan-molak about 8 years ago