Created
February 24, 2020 09:30
-
-
Save lucianghinda/8f2750366eabcc6318e0ea3bdaa9fb56 to your computer and use it in GitHub Desktop.
Test Case for verifying signup form with valid data - written in Javascript using Cypress.io
This file contains hidden or 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
/// <reference types="Cypress" /> | |
const faker = require("faker"); | |
describe("Signup", function() { | |
it("it should work with valid data", function() { | |
let first_name = faker.name.firstName(); | |
let password = faker.random.uuid(); | |
let date = new Date(); | |
let timestamp = date.getTime(); | |
let email = "first_name@" + faker.internet.domainName(); | |
cy.visit("/registration/new"); | |
cy.get("#user_first_name").type(first_name); | |
cy.get("#user_last_name").type(faker.name.lastName()); | |
cy.get("#user_email").type(email); | |
cy.get("#user_password").type(password); | |
cy.get("#user_password_confirmation").type(password); | |
cy.get("#submit_button").click(); | |
cy.location().should(location => { | |
expect(location.pathname).to.eq("/"); | |
}); | |
cy.get("#current_user_first_name").should("have.text", first_name); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment