How to use the @serenity-js/assertions.Ensure.that function in @serenity-js/assertions

To help you get started, we’ve selected a few @serenity-js/assertions examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jan-molak / serenity-js / packages / protractor / spec / screenplay / questions / Cookie.spec.ts View on Github external
it('returns an undefined when it can\'t retrieve it', () => Sid.attemptsTo(
                Navigate.to(cookieCutterURLFor('/cookie?name=favourite&value=chocolate-chip')),
                Ensure.that(Cookie.expiryDateOf('not-so-favourite'), equals(undefined)),
            ));
github jan-molak / serenity-js / packages / protractor / spec / screenplay / questions / Text.spec.ts View on Github external
it('allows the actor to read the text of all DOM elements matching the locator', () => Bernie.attemptsTo(
            Navigate.to(testPage),

            Ensure.that(Text.ofAll(Shopping_List_Items), equals(['milk', 'oats'])),
        ));
github jan-molak / serenity-js / packages / protractor / spec / screenplay / questions / Pick.spec.ts View on Github external
it('picks all the items', () => Peter.attemptsTo(
                Navigate.to(shoppingListPage),

                Ensure.that(Text.ofAll(picked.all()), contain('coconut milk x')),
            ));
github jan-molak / serenity-js / packages / protractor / spec / screenplay / questions / CSSClasses.spec.ts View on Github external
it('allows the actor to read the css classes of a DOM element matching the locator', ({ description, expected }) =>
            Bernie.attemptsTo(
                Navigate.to(testPage),

                Ensure.that(
                    CSSClasses.of(Target.the(`Element with ${ description }`).located(by.id(description))),
                    equals(expected),
                ),
            ));
github jan-molak / serenity-js / packages / protractor / spec / screenplay / questions / Value.spec.ts View on Github external
it('allows the actor to read the "value" attribute of a DOM element matching the locator', () => Bernie.attemptsTo(
            Navigate.to(pageFromTemplate(`
                
                
                    <form>
                        <input value="jan-molak" name="username">
                    </form>
                
                
            `)),

            Ensure.that(Value.of(Target.the('username field').located(by.tagName('input'))), equals('jan-molak')),
        ));
github jan-molak / serenity-js / packages / protractor / spec / expectations / isPresent.spec.ts View on Github external
it('contributes to a human-readable description of an assertion', () => {
        expect(Ensure.that(Page.Present_Header, isPresent()).toString())
            .to.equal(`#actor ensures that the header does become present`);
    });
github jan-molak / serenity-js / packages / protractor / spec / screenplay / questions / LastScriptExecution.spec.ts View on Github external
it('complains if the script hasn\'t been executed yet', () =&gt; expect(Joe.attemptsTo(
        Navigate.to(page),

        Ensure.that(LastScriptExecution.result(), equals(Joe.name)),
    )).to.be.rejectedWith(LogicError, 'Make sure to execute a script before checking on the result'));
});
github jan-molak / serenity-js / packages / protractor / spec / screenplay / questions / Target.spec.ts View on Github external
it('all elements relative to another target', () => Bernie.attemptsTo(
            Navigate.to(shoppingListPage),

            Ensure.that(Text.ofAll(ShoppingList.Bought_Items), equals(['coffee'])),
        ));
    });
github jan-molak / serenity-js / packages / protractor / spec / expectations / isSelected.spec.ts View on Github external
it('allows the actor flow to continue when the element is selected', () => expect(Bernie.attemptsTo(
        Wait.until(Languages.TypeScript, isSelected()),
        Ensure.that(Languages.TypeScript, isSelected()),
    )).to.be.fulfilled);
github jan-molak / serenity-js / examples / protractor-cucumber / features / step_definitions / ui.steps.ts View on Github external
Then(/(?:he|she|they) should see the title of "(.*)"/, function(this: WithStage, expectedTitle: string) {
    return this.stage.theActorInTheSpotlight().attemptsTo(
        Ensure.that(Website.title(), equals(expectedTitle)),
    );
});