Cypress 10 with fixed tests

This commit is contained in:
Kalle 2022-06-22 23:03:32 +03:00
parent 2bee296561
commit 3e6b5e6f9b
8 changed files with 29 additions and 17 deletions

View File

@ -202,7 +202,7 @@ function hasUserSuggestedThisMonth({
}
export function canPerformAdminActions(user?: Pick<User, "discordId">) {
if (process.env.NODE_ENV === "development") return true;
if (["development", "test"].includes(process.env.NODE_ENV)) return true;
if (!user) return false;
return user.discordId === ADMIN_DISCORD_ID;

10
cypress.config.ts Normal file
View File

@ -0,0 +1,10 @@
import { defineConfig } from "cypress";
export default defineConfig({
fixturesFolder: false,
e2e: {
// eslint-disable-next-line @typescript-eslint/no-empty-function
setupNodeEvents(on, config) {},
baseUrl: "http://localhost:4455",
},
});

View File

@ -1,5 +0,0 @@
{
"baseUrl": "http://localhost:4455",
"pluginsFile": false,
"fixturesFolder": false
}

View File

@ -8,7 +8,7 @@ describe("Plus suggestions page", () => {
});
it("views suggestions status as non plus member", function () {
cy.auth(150);
cy.auth(151);
cy.visit(PLUS_SUGGESTIONS_PAGE);
cy.contains("You are suggested");
});
@ -62,13 +62,20 @@ describe("Plus voting results page", () => {
cy.seed();
});
it("views results and sees own percentage as a failed suggest", () => {
it("does not see results but sees own percentage as a failed suggest", () => {
cy.auth(200);
cy.visit("/plus/voting/results");
cy.contains("Sendou");
cy.contains("Sendou").should("not.exist");
cy.contains("your score was");
});
it("views full results as member who passed", () => {
cy.auth(1);
cy.visit("/plus/voting/results");
cy.contains("Sendou");
});
// xxx: describe Plus Voting
});

14
package-lock.json generated
View File

@ -37,7 +37,7 @@
"@typescript-eslint/eslint-plugin": "^5.29.0",
"@typescript-eslint/parser": "^5.29.0",
"cross-env": "^7.0.3",
"cypress": "^9.7.0",
"cypress": "^10.2.0",
"dotenv": "^16.0.1",
"eslint": "^8.18.0",
"eslint-plugin-react": "^7.30.0",
@ -5291,9 +5291,9 @@
"dev": true
},
"node_modules/cypress": {
"version": "9.7.0",
"resolved": "https://registry.npmjs.org/cypress/-/cypress-9.7.0.tgz",
"integrity": "sha512-+1EE1nuuuwIt/N1KXRR2iWHU+OiIt7H28jJDyyI4tiUftId/DrXYEwoDa5+kH2pki1zxnA0r6HrUGHV5eLbF5Q==",
"version": "10.2.0",
"resolved": "https://registry.npmjs.org/cypress/-/cypress-10.2.0.tgz",
"integrity": "sha512-+i9lY5ENlfi2mJwsggzR+XASOIgMd7S/Gd3/13NCpv596n3YSplMAueBTIxNLcxDpTcIksp+9pM3UaDrJDpFqA==",
"dev": true,
"hasInstallScript": true,
"dependencies": {
@ -19372,9 +19372,9 @@
"dev": true
},
"cypress": {
"version": "9.7.0",
"resolved": "https://registry.npmjs.org/cypress/-/cypress-9.7.0.tgz",
"integrity": "sha512-+1EE1nuuuwIt/N1KXRR2iWHU+OiIt7H28jJDyyI4tiUftId/DrXYEwoDa5+kH2pki1zxnA0r6HrUGHV5eLbF5Q==",
"version": "10.2.0",
"resolved": "https://registry.npmjs.org/cypress/-/cypress-10.2.0.tgz",
"integrity": "sha512-+i9lY5ENlfi2mJwsggzR+XASOIgMd7S/Gd3/13NCpv596n3YSplMAueBTIxNLcxDpTcIksp+9pM3UaDrJDpFqA==",
"dev": true,
"requires": {
"@cypress/request": "^2.88.10",

View File

@ -56,7 +56,7 @@
"@typescript-eslint/eslint-plugin": "^5.29.0",
"@typescript-eslint/parser": "^5.29.0",
"cross-env": "^7.0.3",
"cypress": "^9.7.0",
"cypress": "^10.2.0",
"dotenv": "^16.0.1",
"eslint": "^8.18.0",
"eslint-plugin-react": "^7.30.0",