remixed v0
This commit is contained in:
1
cypress/fixtures/example.json
Normal file
1
cypress/fixtures/example.json
Normal file
@ -0,0 +1 @@
|
||||
{}
|
20
cypress/integration/dashboard.ts
Normal file
20
cypress/integration/dashboard.ts
Normal file
@ -0,0 +1,20 @@
|
||||
describe("dashboard", () => {
|
||||
it("should redirect to login page if user is unauthenticated", () => {
|
||||
cy.visit("/test/dashboard");
|
||||
cy.url().should("include", "/sign-in");
|
||||
});
|
||||
|
||||
it("should redirect to the user's organization if user is trying to access a different one", () => {
|
||||
cy.visit("/register");
|
||||
cy.findByLabelText("Organization name").type("Inspect Page Source Gang");
|
||||
cy.findByLabelText("Full name").type("Hasbulla Nurmagomedov");
|
||||
cy.findByLabelText("Email").type("hasbi@test.com");
|
||||
cy.findByLabelText("Password").type(`secret password{enter}`);
|
||||
cy.url().should("include", "/inspect-page-source-gang/dashboard");
|
||||
|
||||
cy.findByText("Team").click();
|
||||
cy.url().should("include", "/inspect-page-source-gang/team");
|
||||
cy.visit("/other-org/dashboard");
|
||||
cy.url().should("include", "/inspect-page-source-gang/dashboard");
|
||||
});
|
||||
});
|
27
cypress/integration/onboarding.ts
Normal file
27
cypress/integration/onboarding.ts
Normal file
@ -0,0 +1,27 @@
|
||||
describe("onboarding", () => {
|
||||
it("should register, invite a colleague, remove them and delete my account", () => {
|
||||
const email = "hasbi@test.com";
|
||||
const password = "secret password";
|
||||
|
||||
cy.visit("/");
|
||||
|
||||
cy.findByText("Register").click();
|
||||
cy.findByLabelText("Organization name").type("Inspect Page Source Gang");
|
||||
cy.findByLabelText("Full name").type("Hasbulla Nurmagomedov");
|
||||
cy.findByLabelText("Email").type(email);
|
||||
cy.findByLabelText("Password").type(`${password}{enter}`);
|
||||
|
||||
cy.findByText("Team").click();
|
||||
cy.findByPlaceholderText("colleague@company.com").type("khabib@test.com{enter}");
|
||||
cy.findByText("x").click();
|
||||
|
||||
cy.findByText("Sign out").click();
|
||||
|
||||
cy.findByText("Sign in").click();
|
||||
cy.findByLabelText("Email").type(email);
|
||||
cy.findByLabelText("PasswordForgot your password?").type(`${password}{enter}`);
|
||||
|
||||
cy.findByText("Settings").click();
|
||||
cy.findByText("Delete my account").click();
|
||||
});
|
||||
});
|
22
cypress/plugins/index.ts
Normal file
22
cypress/plugins/index.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import db from "~/utils/db.server";
|
||||
|
||||
const plugins: Cypress.PluginConfig = (on, config) => {
|
||||
on("task", {
|
||||
async resetDb() {
|
||||
await emptyDatabase();
|
||||
return null;
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
...config,
|
||||
baseUrl: "http://localhost:3000",
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = plugins;
|
||||
|
||||
async function emptyDatabase() {
|
||||
await db.user.deleteMany();
|
||||
await db.organization.deleteMany();
|
||||
}
|
0
cypress/support/commands.ts
Normal file
0
cypress/support/commands.ts
Normal file
7
cypress/support/index.ts
Normal file
7
cypress/support/index.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import "@testing-library/cypress/add-commands";
|
||||
|
||||
import "./commands";
|
||||
|
||||
beforeEach(() => {
|
||||
cy.task("resetDb");
|
||||
});
|
26
cypress/tsconfig.json
Normal file
26
cypress/tsconfig.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"include": [
|
||||
"./index.ts",
|
||||
"integration/**/*",
|
||||
"plugins/**/*",
|
||||
"support/**/*",
|
||||
"../node_modules/cypress",
|
||||
"../node_modules/@testing-library/cypress"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"noEmit": true,
|
||||
"types": ["node", "cypress", "@testing-library/cypress"],
|
||||
"esModuleInterop": true,
|
||||
"jsx": "react",
|
||||
"moduleResolution": "node",
|
||||
"target": "es2019",
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"resolveJsonModule": true,
|
||||
"typeRoots": ["../node_modules/@types"],
|
||||
"paths": {
|
||||
"~/*": ["../app/*"]
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user