Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)),
));
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'])),
));
it('picks all the items', () => Peter.attemptsTo(
Navigate.to(shoppingListPage),
Ensure.that(Text.ofAll(picked.all()), contain('coconut milk x')),
));
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),
),
));
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')),
));
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`);
});
it('complains if the script hasn\'t been executed yet', () => 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'));
});
it('all elements relative to another target', () => Bernie.attemptsTo(
Navigate.to(shoppingListPage),
Ensure.that(Text.ofAll(ShoppingList.Bought_Items), equals(['coffee'])),
));
});
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);
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)),
);
});