A next generation, full-stack acceptance testing framework optimised for collaboration, speed and scale!
APACHE-2.0 License
Bot releases are visible (Hide)
Published by jan-molak over 7 years ago
See
is no longer reported by default, as that polluted the report and triggere (3b7efb81)tags
parameter in cucumberOpts
is now correctly typed as a list of strin (abdeddad)TakeNotes
to assert on their contents later. (ab368276, closes #24)SerenityBDDReporter, which better handles gathering results from tests executed in parallel.
(0b93ff0d)
You can use the SerenityProtractorFramework instead of the mocha
or the protractor-cucumber-framework
modules
as it provides capabilities equivalent to those modules, and also enables an easy integration with Serenity/JS
as well as synchronisation with the WebDriver ControlFlow so that the test reports will show accurate timing.
To enable the framework, add the following configuration to your protractor.conf.js
file:
exports.config = {
framework: 'custom',
frameworkPath: require.resolve('serenity-js'),
serenity: {
dialect: 'cucumber' // or 'mocha'
},
specs: [ 'features/**/*.feature' ],
cucumberOpts: { // or 'mochaOpts'
},
Both cucumberOpts
and mochaOpts
don't need to change as SerenityProtractorFramework can act as a drop-in replacement.
Please see the todomvc-protractor-cucumber
and todomvc-protractor-mocha
example project for details.
BREAKING CHANGE: The serenity
object should be used instead of the Serenity
singleton to initialise
the stage and the actors.
Instead of:
import { Serenity } from 'serenity-js';
const stage = Serenity.callToStageFor(cast);
use:
import { serenity } from 'serenity-js';
const stage = serenity.callToStageFor(cast);
Tutorials and more documentation to follow shortly!
(6cf0197a)
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 ✋