Skip to content

Instantly share code, notes, and snippets.

@lucianghinda
Created February 24, 2020 09:30
Show Gist options
  • Save lucianghinda/8f2750366eabcc6318e0ea3bdaa9fb56 to your computer and use it in GitHub Desktop.
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
/// <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