mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-11-16 17:10:12 +00:00
52 lines
1.4 KiB
TypeScript
52 lines
1.4 KiB
TypeScript
import { faker } from "@faker-js/faker";
|
|
|
|
describe("smoke tests", () => {
|
|
afterEach(() => {
|
|
cy.cleanupUser();
|
|
});
|
|
|
|
it("should allow you to register and login", () => {
|
|
const loginForm = {
|
|
email: `${faker.internet.userName()}@example.com`,
|
|
password: faker.internet.password(),
|
|
};
|
|
|
|
cy.then(() => ({ email: loginForm.email })).as("user");
|
|
|
|
cy.visitAndCheck("/");
|
|
|
|
cy.findByRole("link", { name: /sign up/i }).click();
|
|
|
|
cy.findByRole("textbox", { name: /email/i }).type(loginForm.email);
|
|
cy.findByLabelText(/password/i).type(loginForm.password);
|
|
cy.findByRole("button", { name: /create account/i }).click();
|
|
|
|
cy.findByRole("link", { name: /notes/i }).click();
|
|
cy.findByRole("button", { name: /logout/i }).click();
|
|
cy.findByRole("link", { name: /log in/i });
|
|
});
|
|
|
|
it("should allow you to make a note", () => {
|
|
const testNote = {
|
|
title: faker.lorem.words(1),
|
|
body: faker.lorem.sentences(1),
|
|
};
|
|
cy.login();
|
|
|
|
cy.visitAndCheck("/");
|
|
|
|
cy.findByRole("link", { name: /notes/i }).click();
|
|
cy.findByText("No notes yet");
|
|
|
|
cy.findByRole("link", { name: /\+ new note/i }).click();
|
|
|
|
cy.findByRole("textbox", { name: /title/i }).type(testNote.title);
|
|
cy.findByRole("textbox", { name: /body/i }).type(testNote.body);
|
|
cy.findByRole("button", { name: /save/i }).click();
|
|
|
|
cy.findByRole("button", { name: /delete/i }).click();
|
|
|
|
cy.findByText("No notes yet");
|
|
});
|
|
});
|