Created
October 7, 2020 20:15
-
-
Save cowboyd/7e0d83ccbbe812f051d5e68e2d2eebf3 to your computer and use it in GitHub Desktop.
BigTest suite and its raw JSON equivalent
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
{ | |
"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": [] | |
} | |
] | |
} |
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 { 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