Skip to content

Instantly share code, notes, and snippets.

@cowboyd
Created February 12, 2021 08:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cowboyd/f64e8f0287b07552fa951ff6f4cc385e to your computer and use it in GitHub Desktop.
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
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