Skip to content

Instantly share code, notes, and snippets.

@cowboyd
Created October 7, 2020 20:15
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/7e0d83ccbbe812f051d5e68e2d2eebf3 to your computer and use it in GitHub Desktop.
Save cowboyd/7e0d83ccbbe812f051d5e68e2d2eebf3 to your computer and use it in GitHub Desktop.
BigTest suite and its raw JSON equivalent
{
"description": "Sign In",
"steps": [
{
"description": "visiting \"/\""
},
{
"description": "click on link \"Sign in\""
}
],
"assertions": [
{
"description": "heading \"Sign in\" exists"
}
],
"children": [
{
"description": "with invalid credentials",
"steps": [
{
"description": "fillIn with \"nobody\" on text field with placeholder \"Email\""
},
{
"description": "fillIn with \"password-of-nobody\" on text field with placeholder \"Password\""
},
{
"description": "click on button \"Sign in\""
}
],
"assertions": [
{
"description": "error message \"email or password is invalid\" exists"
}
],
"children": []
},
{
"description": "with valid credentials",
"steps": [
{
"description": "seed user"
},
{
"description": "fillIn with \"cowboyd\" on text field with placeholder \"Email\""
},
{
"description": "fillIn with \"password\" on text field with placeholder \"Password\""
},
{
"description": "click on button \"Sign in\""
}
],
"assertions": [
{
"description": "link \"Your Feed\" exists"
}
],
"children": []
}
]
}
import { test, App, Heading, Link, TextField, Button } from 'bigtest';
import { ErrorMessage, createUser } from './helpers';
export default test("Sign In")
.step(
App.visit("/"),
Link("Sign in").click())
.assertion(Heading("Sign in").exists())
.child("with invalid credentials", test => test
.step(
TextField({ placeholder: "Email"}).fillIn('nobody'),
TextField({ placeholder: "Password"}).fillIn('password-of-nobody'),
Button("Sign in").click())
.assertion(ErrorMessage("email or password is invalid").exists()))
.child("with valid credentials", test => test
.step("seed user", async () => ({user: createUser('cowboyd', 'password') }))
.step(
TextField({ placeholder: "Email"}).fillIn('cowboyd'),
TextField({ placeholder: "Password"}).fillIn('password'),
Button("Sign in").click())
.assertion(Link("Your Feed").exists()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment