Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions CypressTest/form_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
describe('0nboardingApp', () => {

beforeEach(() => {
// console.log(`random int: ${Math.random()}`)
cy.visit('http://localhost:3000')
})

// it represents the test itself
it('sanity check', () => {
// expect is an assertion
// we can have many assertions in a test
expect(2 + 2).to.equal(4)
expect(2 + 2).not.to.equal(5)
})

const textInput = () => cy.get('[name="userName"]')
const emailInput = () => cy.get('[name="email"]')
const passwordInput = () => cy.get('[name="password"]')
const termsBox = () => cy.get('input[name="terms"]')
const submitBtn = () => cy.get('button')
it('Allows submission after completion', () => {
const quote = 'Satoru gojo'
textInput().type(quote).should('have.value', 'Satoru gojo');

const emailquote = 'Satoru@gojo.co'
emailInput().type(emailquote)

const passwordquote = 'Satorugojoisking'
passwordInput().type(passwordquote)

termsBox().check()

submitBtn().should('not.be.disabled')
submitBtn().click()

})


it("will show errors for invalid inputs", () => {
textInput().type("p");
submitBtn().should("be.disabled");

const emailquote = 'Sator'
emailInput().type(emailquote)
})
})