Delete Cypress for now

This commit is contained in:
Kalle (Sendou) 2021-06-16 21:13:42 +03:00
parent 13b495553a
commit 2ccbfdf4e6
10 changed files with 70 additions and 2415 deletions

4
.gitignore vendored
View File

@ -45,7 +45,3 @@ locale/**/*.js
dumped.sql
/utils/data/patrons.json
# cypress
cypress/videos/*
cypress/screenshots/*

View File

@ -1,9 +0,0 @@
{
"id": 333,
"username": "NZAP",
"discriminator": "6227",
"discordId": "455039198672453645",
"discordAvatar": "f809176af93132c3db5f0a5019e96339",
"iat": 1614241069,
"exp": 1616833069
}

View File

@ -1,9 +0,0 @@
{
"id": 999,
"username": "Sendou",
"discriminator": "4059",
"discordId": "79237403620945920",
"discordAvatar": "1e0968214a6ea74aebce4bbd699d6aae",
"iat": 1614241069,
"exp": 1616833069
}

View File

@ -1,61 +0,0 @@
/// <reference types="cypress" />
/// <reference path="../support/index.d.ts" />
context("Event Calendar", () => {
it("don't show event of the past", () => {
cy.visit("/calendar");
// event is in the past
cy.dataCy("event-info-section-should-not-show").should("not.exist");
});
it("tournament info renders as expected", () => {
cy.visit("/calendar");
cy.contains("In The Zone Ultimate");
cy.contains("SZ Only");
cy.dataCy("event-info-section-in-the-zone-ultimate").contains(
"Ultimate zoning"
);
});
it("tournament can be created", () => {
cy.login("sendou");
cy.visit("/calendar");
cy.dataCy("event-info-section-test-event").should("not.exist");
cy.dataCy("add-event-button").click();
cy.dataCy("name-input").type("Test Event");
cy.dataCy("discord-invite-url-input").type("https://discord.gg/sendou");
cy.dataCy("registration-url-input").type(
"https://sendous.challonge.com/InTheZone24"
);
cy.dataCy("description-markdown").type(
"go register amazing test event and all that"
);
cy.dataCy("save-button").click();
cy.dataCy("event-info-section-test-event");
});
it("tournament can be edited and deleted", () => {
cy.login("sendou");
cy.visit("/calendar");
cy.dataCy("event-info-section-in-the-zone-ultimate").contains(
"Ultimate zoning"
);
cy.dataCy("edit-button-in-the-zone-ultimate").click();
cy.dataCy("description-markdown").clear().type("description edited");
cy.dataCy("save-button").click();
cy.dataCy("event-info-section-in-the-zone-ultimate").contains(
"description edited"
);
cy.dataCy("edit-button-in-the-zone-ultimate").click();
cy.on("window:confirm", () => true);
cy.dataCy("delete-button").click();
cy.dataCy("event-info-section-in-the-zone-ultimate").should("not.exist");
});
});

View File

@ -1,92 +0,0 @@
/// <reference types="cypress" />
/// <reference path="../support/index.d.ts" />
context("Plus Voting History", () => {
it("show 404 if invalid route ([[...slug]])", () => {
cy.visit("/plus/history/asd", { failOnStatusCode: false });
cy.contains("Not Found");
cy.visit("/plus/history/1/2000/1", { failOnStatusCode: false });
cy.contains("Not Found");
});
it("can view voting history", () => {
cy.visit("/plus/history");
cy.dataCy("tier-selector").select("+2 - January 2020");
cy.contains("58.3%");
cy.contains("8.3%");
});
});
context("Plus Home Page", () => {
it("sees alternative view of suggestions not logged in", () => {
cy.visit("/plus");
cy.dataCy("plus-three-radio").should("not.exist");
cy.dataCy("alt-suggestions-container").contains("User10#0010 (+2)");
});
// skipped because
// https://github.com/Sendouc/sendou.ink/issues/349
// https://github.com/Sendouc/sendou.ink/issues/350
it.skip("can submit new suggestion and persists with reload", () => {
cy.login("sendou");
cy.visit("/plus");
cy.dataCy("suggestion-button")
.click()
.get(".select__value-container")
.type("NZAP{enter}{enter}")
.dataCy("region-select")
.select("EU")
.dataCy("description-textarea")
.type("always trust in nzap")
.dataCy("submit-button")
.click();
cy.contains("always trust in nzap")
.reload()
.contains("always trust in nzap")
.dataCy("suggestion-button")
.should("not.exist");
});
it("can add comment to suggestion and toast shows", () => {
cy.login("sendou");
cy.visit("/plus");
cy.dataCy("comment-button")
.click()
.dataCy("comment-textarea")
.type("yes agreed")
.dataCy("submit-button")
.click();
cy.contains("Comment added");
cy.contains('"yes agreed" - Sendou#0012');
cy.dataCy("comment-button").should("not.exist");
});
it("can add vouch", () => {
cy.login("sendou");
cy.visit("/plus");
cy.dataCy("vouch-button")
.click()
.get(".select__value-container")
.type("NZAP{enter}")
.dataCy("region-select")
.select("EU")
.dataCy("submit-button")
.click();
cy.dataCy("vouch-button").should("not.exist");
cy.contains("Vouched NZAP#0011");
});
it("can't vouch if canVouchAgainAfter set", () => {
cy.login("nzap");
cy.visit("/plus");
cy.dataCy("vouch-button").should("not.exist");
cy.contains("Can vouch again after:");
});
});

View File

@ -1,18 +0,0 @@
// in cypress/support/index.d.ts
// load type definitions that come with Cypress module
/// <reference types="cypress" />
declare namespace Cypress {
interface Chainable {
/**
* Custom command to select DOM element by data-cy attribute.
* @example cy.dataCy('greeting')
*/
dataCy(value: string): Chainable<Element>;
/**
* Mock login
* @example cy.login('sendou')
*/
login(user: "sendou" | "nzap"): Chainable<Element>;
}
}

View File

@ -1,18 +0,0 @@
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");
});

View File

@ -1,8 +0,0 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["es5", "dom"],
"types": ["cypress"]
},
"include": ["**/*.ts"]
}

2259
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -18,11 +18,7 @@
"ex:clean": "cross-env NODE_ENV=development lingui extract --clean && npm run prettier:format",
"seed": "prisma db seed --preview-feature",
"prettier:check": "prettier --check .",
"prettier:format": "prettier --write .",
"cy:open": "cypress open",
"cy:run": "cypress run",
"cy:clearcache": "cypress cache clear",
"cy:install": "cypress install"
"prettier:format": "prettier --write ."
},
"dependencies": {
"@chakra-ui/icons": "^1.0.13",
@ -81,7 +77,6 @@
"@types/react-select": "^4.0.15",
"@types/uuid": "^8.3.0",
"cross-env": "^7.0.3",
"cypress": "^7.5.0",
"fishery": "^1.3.1",
"prettier": "^2.3.1",
"prisma": "^2.24.1",