Untitled

mail@pastecode.io avatar
unknown
javascript
2 years ago
1.3 kB
1
Indexable
Never
import { getUserIdFromUserName, deleteUser } from "../../src/FirebaseUtils/utils";

describe("Signin and login", () => {
  const email = "OlaNordmann2@gmail.com";
  const password = "passord123";
  const mobilenr = "48661732";
  const username = "OlaN12";
  const address = "Prinsens gate 13";


  it("signs up a new user", () => {
    cy.visit("http://localhost:3000");
    cy.get("#signin").click();
    cy.url().should("include", "signin");

    cy.get("#toSignUp").click();
    cy.url().should("include", "signup");

    cy.get("#email").type(email);
    cy.get("#fname").type("Ola");
    cy.get("#surname").type("Norman");
    cy.get("#username").type(username);
    cy.get("#password").type(password);
    cy.get("#password2").type(password);
    cy.get("#mobilenumber").type(mobilenr);
    cy.get("#birthday").type("2000-01-22");
    cy.get("#adress").type(address);
    cy.get("#submit").click();

  });

  it("signs up the user we have created", () =>{
        cy.get("#signin").click();
        cy.url().should("include", "signin");

        cy.get ("#email").type(email);
        cy.get ("#password").type(password);
        cy.get ("#submit").click();

    })

    after(() => {
        const userId = getUserIdFromUserName(username);
        deleteUser(userId);
      });
});