mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-08-25 12:35:18 -05:00
Cypress test with new mock auth
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
.plus__suggested-info-text {
|
||||
font-size: var(--fonts-lg);
|
||||
color: var(--text-lighter);
|
||||
font-size: var(--fonts-lg);
|
||||
}
|
||||
|
||||
13
cypress/integration/plus.spec.ts
Normal file
13
cypress/integration/plus.spec.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
export {};
|
||||
|
||||
describe("Plus suggestions page", () => {
|
||||
beforeEach(() => {
|
||||
cy.seed();
|
||||
});
|
||||
|
||||
it("views suggestions status as non plus member", function () {
|
||||
cy.auth(150);
|
||||
cy.visit("/plus");
|
||||
cy.contains("You are suggested");
|
||||
});
|
||||
});
|
||||
@@ -44,6 +44,6 @@ describe("User page", () => {
|
||||
cy.getCy("profile-page-link").click();
|
||||
cy.contains("Sendou");
|
||||
cy.contains("Finland").should("not.exist");
|
||||
cy.contains(bio);
|
||||
cy.contains(bio).should("not.exist");
|
||||
});
|
||||
});
|
||||
@@ -6,7 +6,7 @@ declare global {
|
||||
interface Chainable {
|
||||
getCy(id: string): Chainable<JQuery<HTMLElement>>;
|
||||
seed(): void;
|
||||
auth(): void;
|
||||
auth(userId?: number): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,13 +15,11 @@ Cypress.Commands.add("getCy", (id) => {
|
||||
return cy.get(`[data-cy=${id}]`);
|
||||
});
|
||||
|
||||
// TODO: make this a request instead... probably faster?
|
||||
Cypress.Commands.add("seed", () => {
|
||||
cy.exec("npm run seed");
|
||||
});
|
||||
|
||||
const SENDOU_COOKIE =
|
||||
"eyJvYXV0aDI6c3RhdGUiOiJhMDE0MjI5Mi03YjRiLTRkYTYtYWQxZC1jMTI5ZWExZGVhNjUiLCJ1c2VyIjp7ImlkIjoxLCJkaXNjb3JkSWQiOiI3OTIzNzQwMzYyMDk0NTkyMCIsImRpc2NvcmRBdmF0YXIiOiJmY2ZkNjVhM2JlYTU5ODkwNWFiYjljYTI1Mjk2ODE2YiJ9LCJzdHJhdGVneSI6ImRpc2NvcmQifQ%3D%3D.yf5YER%2B15VPqVk6Kys2jnpPAQqbq2Yv%2FF50lmGAIilc";
|
||||
|
||||
Cypress.Commands.add("auth", () => {
|
||||
cy.setCookie("_session", SENDOU_COOKIE);
|
||||
Cypress.Commands.add("auth", (id = 1) => {
|
||||
cy.request("POST", `/auth/impersonate?id=${id}`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user