mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-13 22:42:38 -05:00
* Stop using npm run migrate:reset in tests * Begin moving other existing fixtures to factories * Update cypress/support/index.ts Co-authored-by: Kalle <38327916+Sendouc@users.noreply.github.com> * Clean up usage of _.sample * Rename files * Remove incomplete building of associations * Add missing references to calendarEvent * Remove inaccurate seeds * Add explicit lodash devDependency Co-authored-by: Kalle <38327916+Sendouc@users.noreply.github.com>
19 lines
594 B
TypeScript
19 lines
594 B
TypeScript
Cypress.Commands.add("dataCy", (value: string) => {
|
|
return cy.get(`[data-cy=${value}]`);
|
|
});
|
|
|
|
Cypress.Commands.add("login", (user: "sendou" | "nzap") => {
|
|
return cy.fixture(`user.${user}`).then((u) => {
|
|
const d = new Date();
|
|
u.iat = Math.floor(d.setHours(-168) / 1000);
|
|
u.exp = Math.floor(d.setHours(336) / 1000);
|
|
cy.setCookie("mockUser", JSON.stringify(u));
|
|
cy.intercept("/api/auth/session", u);
|
|
});
|
|
});
|
|
|
|
beforeEach(() => {
|
|
// TODO: use database transactions, instead of dropping and recreating the database with each individual test
|
|
cy.exec("npm run seed");
|
|
});
|