Created
February 12, 2021 08:38
-
-
Save cowboyd/f64e8f0287b07552fa951ff6f4cc385e to your computer and use it in GitHub Desktop.
Hypothetical BDD syntaxt for bigtest that uses generators to build a test tree
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Page, TextField, Button, HTML, Heading, including } from '@bigtest/interactor'; | |
import { describe } from '@bigtest/suite/bdd'; //hypothetical bdd syntax entry point | |
import { createUser } from './helpers'; | |
export default describe("login test", function*() { | |
yield createUser("cowboyd", "password"); //=> injects `user` into context | |
yield Page.visit('/sign-in'); | |
yield Heading(including('Sign into app')).exists(); | |
yield describe("with good credentials", function*() { | |
yield ({ user }) => TextField("username").fillIn(user.username); | |
yield ({ user }) => TextField("password").fillIn(user.password); | |
yield Button("Sign in").click(); | |
}); | |
yield describe("with bad credentials", function*() { | |
yield TextField("username").fillIn("nobody"); | |
yield TextField("password").fillIn("not-gonna-happen"); | |
yield Button("SignIn").click(); | |
yield HTML({ id: 'sigin-errors'}).has({ text: including('password does not match') }) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment