From e97fcd4e9975c90d5806866f42190cd91f954bbb Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sun, 30 Oct 2022 02:15:15 +0300 Subject: [PATCH] Remove Cypress tests Planned to be replaced with Playwright maybe? Just removing in the meanwhile so they don't confuse people. Or that people won't accidentally develop new. --- .gitignore | 5 +- README.md | 8 +- app/components/BuildCard.tsx | 4 +- app/components/DateInput.tsx | 3 - app/components/FormWithConfirm.tsx | 7 +- app/components/layout/ColorModeToggle.tsx | 6 +- app/components/layout/HamburgerButton.tsx | 1 - app/components/layout/UserItem.tsx | 16 +- app/entry.client.tsx | 23 +- app/routes/badges.tsx | 1 - app/routes/badges/$id.tsx | 4 +- app/routes/badges/$id/edit.tsx | 21 +- app/routes/calendar/$id/index.tsx | 13 +- app/routes/calendar/$id/report-winners.tsx | 10 +- app/routes/calendar/components/Tags.tsx | 1 - app/routes/calendar/index.tsx | 9 +- app/routes/calendar/new.tsx | 12 +- app/routes/plus.tsx | 12 +- app/routes/plus/suggestions.tsx | 14 +- .../suggestions/comment.$tier.$userId.tsx | 4 +- app/routes/plus/suggestions/new.tsx | 8 +- app/routes/u.$identifier.tsx | 10 +- app/routes/u.$identifier/builds/index.tsx | 6 +- app/routes/u.$identifier/builds/new.tsx | 6 +- app/routes/u.$identifier/edit.tsx | 3 - app/routes/u.$identifier/index.tsx | 10 +- .../u.$identifier/results/highlights.tsx | 1 - cypress.config.ts | 16 - cypress/e2e/badges.cy.ts | 71 - cypress/e2e/builds.cy.ts | 87 - cypress/e2e/calendar.cy.ts | 150 -- cypress/e2e/misc.cy.ts | 19 - cypress/e2e/plus.cy.ts | 91 - cypress/e2e/user.cy.ts | 64 - cypress/support/e2e.ts | 24 - package-lock.json | 2080 ----------------- package.json | 7 +- tsconfig.json | 1 - 38 files changed, 43 insertions(+), 2785 deletions(-) delete mode 100644 cypress.config.ts delete mode 100644 cypress/e2e/badges.cy.ts delete mode 100644 cypress/e2e/builds.cy.ts delete mode 100644 cypress/e2e/calendar.cy.ts delete mode 100644 cypress/e2e/misc.cy.ts delete mode 100644 cypress/e2e/plus.cy.ts delete mode 100644 cypress/e2e/user.cy.ts delete mode 100644 cypress/support/e2e.ts diff --git a/.gitignore b/.gitignore index b7cb775af..b6e561320 100644 --- a/.gitignore +++ b/.gitignore @@ -10,13 +10,10 @@ notes.md db*.sqlite3* dump -/cypress/videos -/cypress/screenshots - .DS_Store .excalidraw /scripts/output/* !/scripts/output/.gitkeep -/scripts/dicts/**/*.json \ No newline at end of file +/scripts/dicts/**/*.json diff --git a/README.md b/README.md index c9446086e..57e98c85b 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,6 @@ There is a sequence of commands you need to run: 5. `npm run dev` to run the project in development mode. 6. Navigate to `http://localhost:5800/admin`. There press the seed button to fill the DB with test data. You can also impersonate any user (Sendou#0043 = admin). -And if you want to run the E2E tests: - -6. Make a copy of the `db.sqlite3` file created by migration and name it `db-cypress.sqlite3`. -7. `npm run dev:cypress` and `npm run cy:open` can be used to run the E2E tests. - ## Lohi TODO: instructions on how to develop Lohi locally @@ -64,8 +59,7 @@ sendou.ink/ │ ├── routes/ -- Routes see: https://remix.run/docs/en/v1/guides/routing │ ├── styles/ -- All .css files of the project for styling │ ├── utils/ -- Random helper functions used in many places -│ └── permissions.ts / -- What actions are allowed. Separated by frontend and backend as frontend has constraints based on what user sees. -├── cypress/ -- see: https://docs.cypress.io/guides/core-concepts/writing-and-organizing-tests#Folder-structure +│ └── permissions.ts / -- What actions are allowed. Separated by frontend and backend as frontend has constraints based on what user sees.writing-and-organizing-tests#Folder-structure ├── discord-bot/ -- Lohi Discord bot that works together with sendou.ink ├── migrations/ -- Database migrations ├── public/ -- Images, built assets etc. static files to be served as is diff --git a/app/components/BuildCard.tsx b/app/components/BuildCard.tsx index 310eca152..ded1d6a3e 100644 --- a/app/components/BuildCard.tsx +++ b/app/components/BuildCard.tsx @@ -67,7 +67,7 @@ export function BuildCard({ build, owner, canEdit = false }: BuildProps) { } = build; return ( -
+

{title}

@@ -169,7 +169,6 @@ export function BuildCard({ build, owner, canEdit = false }: BuildProps) { variant="minimal" tiny to={`new?buildId=${id}&userId=${user!.id}`} - data-cy="edit-build-button" > @@ -182,7 +181,6 @@ export function BuildCard({ build, owner, canEdit = false }: BuildProps) { variant="minimal-destructive" tiny type="submit" - data-cy="delete-build-button" > diff --git a/app/components/DateInput.tsx b/app/components/DateInput.tsx index dfc42a542..3caf43d4f 100644 --- a/app/components/DateInput.tsx +++ b/app/components/DateInput.tsx @@ -9,14 +9,12 @@ export function DateInput({ min, max, required, - "data-cy": dataCy, }: { id?: string; name?: string; defaultValue?: Date; min?: Date; max?: Date; - "data-cy": string; required?: boolean; }) { const [date, setDate] = React.useState(defaultValue ?? new Date()); @@ -44,7 +42,6 @@ export function DateInput({ min={min ? dateToYearMonthDayHourMinuteString(min) : undefined} max={max ? dateToYearMonthDayHourMinuteString(max) : undefined} onChange={(e) => setDate(new Date(e.target.value))} - data-cy={dataCy} required={required} /> diff --git a/app/components/FormWithConfirm.tsx b/app/components/FormWithConfirm.tsx index 9a61786d9..764be6680 100644 --- a/app/components/FormWithConfirm.tsx +++ b/app/components/FormWithConfirm.tsx @@ -33,12 +33,7 @@ export function FormWithConfirm({

{dialogHeading}

- diff --git a/app/components/layout/HamburgerButton.tsx b/app/components/layout/HamburgerButton.tsx index c77eee522..80f9d46a5 100644 --- a/app/components/layout/HamburgerButton.tsx +++ b/app/components/layout/HamburgerButton.tsx @@ -11,7 +11,6 @@ export function HamburgerButton({ diff --git a/app/entry.client.tsx b/app/entry.client.tsx index bca9b2c12..170d52bc3 100644 --- a/app/entry.client.tsx +++ b/app/entry.client.tsx @@ -4,24 +4,13 @@ import { i18nLoader } from "./modules/i18n"; import i18next from "i18next"; import { I18nextProvider } from "react-i18next"; -i18nLoader().then(hydrate).catch(console.error); - -// work around for react 18 + cypress problem - https://github.com/remix-run/remix/issues/2570#issuecomment-1099696456 -function hydrate() { - if (process.env.NODE_ENV === "test") { - // eslint-disable-next-line @typescript-eslint/no-var-requires - return require("react-dom").hydrate( - - - , - document - ); - } else { - return hydrateRoot( +i18nLoader() + .then(() => + hydrateRoot( document, - ); - } -} + ) + ) + .catch(console.error); diff --git a/app/routes/badges.tsx b/app/routes/badges.tsx index 8b64d95ed..e866a8172 100644 --- a/app/routes/badges.tsx +++ b/app/routes/badges.tsx @@ -44,7 +44,6 @@ export default function BadgesPageLayout() { className="badges__nav-link" key={badge.id} to={String(badge.id)} - data-cy="badge-nav-link" > diff --git a/app/routes/badges/$id.tsx b/app/routes/badges/$id.tsx index 5c12fbb9e..d5d4e6417 100644 --- a/app/routes/badges/$id.tsx +++ b/app/routes/badges/$id.tsx @@ -71,7 +71,7 @@ export default function BadgeDetailsPage() {
{canEditBadgeOwners({ user, managers: data.managers }) ? ( - + Edit ) : null} @@ -86,7 +86,7 @@ export default function BadgeDetailsPage() { > ×{owner.count} - {discordFullName(owner)} + {discordFullName(owner)} ))} diff --git a/app/routes/badges/$id/edit.tsx b/app/routes/badges/$id/edit.tsx index ed7fb1cf1..d92a64fe0 100644 --- a/app/routes/badges/$id/edit.tsx +++ b/app/routes/badges/$id/edit.tsx @@ -140,7 +140,7 @@ function Managers({ data }: { data: BadgeDetailsLoaderData }) {
    {managers.map((manager) => ( -
  • +
  • {manager.discordFullName}
  • ))} @@ -227,7 +226,6 @@ function Owners({ data }: { data: BadgeDetailsLoaderData }) { {owner.discordFullName} {o.difference}{" "} - - added - {" "} - to {o.discordFullName} + added to{" "} + {o.discordFullName} ) : ( <> {o.difference}{" "} - - removed - {" "} + removed{" "} from {o.discordFullName} )} @@ -289,7 +277,6 @@ function Owners({ data }: { data: BadgeDetailsLoaderData }) { disabled={ownerDifferences.length === 0} name="_action" value="OWNERS" - data-cy="save-owners-button" > Save diff --git a/app/routes/calendar/$id/index.tsx b/app/routes/calendar/$id/index.tsx index 28b2b8c69..f95db101e 100644 --- a/app/routes/calendar/$id/index.tsx +++ b/app/routes/calendar/$id/index.tsx @@ -145,11 +145,7 @@ export default function CalendarEventPage() { {resolveBaseUrl(data.event.bracketUrl)} {canEditCalendarEvent({ user, event: data.event }) && ( - + {t("common:actions.edit")} )} @@ -161,7 +157,6 @@ export default function CalendarEventPage() { {t("calendar:actions.reportWinners")} @@ -271,11 +266,7 @@ function Description() { {discordFullName(data.event)}
- {data.event.description && ( -
- {data.event.description} -
- )} + {data.event.description &&
{data.event.description}
}
); diff --git a/app/routes/calendar/$id/report-winners.tsx b/app/routes/calendar/$id/report-winners.tsx index 588ec5fc7..a0ffec341 100644 --- a/app/routes/calendar/$id/report-winners.tsx +++ b/app/routes/calendar/$id/report-winners.tsx @@ -176,7 +176,7 @@ export default function ReportWinnersPage() { {t("calendar:forms.reportResultsInfo")} - @@ -201,7 +201,6 @@ function ParticipantsCountInput() { min={1} max={CALENDAR_EVENT_RESULT.MAX_PARTICIPANTS_COUNT} defaultValue={data.participantCount ?? undefined} - data-cy="participants-count-input" className="w-24" />
@@ -245,7 +244,6 @@ function TeamInputs() { @@ -322,7 +320,6 @@ function Team({ onChange={handleTeamNameChange} required maxLength={CALENDAR_EVENT_RESULT.MAX_TEAM_NAME_LENGTH} - data-cy="team-name-input" />
@@ -335,7 +332,6 @@ function Team({ required max={CALENDAR_EVENT_RESULT.MAX_TEAM_PLACEMENT} className="w-24" - data-cy="placing-input" />
@@ -402,7 +398,6 @@ function Players({ tiny variant="minimal" onClick={() => handlePlayerInputTypeChange(i)} - data-cy="change-input-type-button" className="outline-theme" > {asPlainInput @@ -416,7 +411,6 @@ function Players({ value={player} onChange={(e) => handleInputChange(i, e.target.value)} max={CALENDAR_EVENT_RESULT.MAX_PLAYER_NAME_LENGTH} - data-cy="plain-player-name-input" /> ) : ( {t("forms.team.player.add")} {" "} @@ -449,7 +442,6 @@ function Players({ variant="destructive" onClick={handleRemovePlayer} disabled={players.length === 1} - data-cy="remove-player-button" > {t("forms.team.player.remove")} diff --git a/app/routes/calendar/components/Tags.tsx b/app/routes/calendar/components/Tags.tsx index 4b47e5f43..8fa3c681c 100644 --- a/app/routes/calendar/components/Tags.tsx +++ b/app/routes/calendar/components/Tags.tsx @@ -38,7 +38,6 @@ export function Tags({ variant="minimal" aria-label="Remove date" tiny - data-cy="tag-delete-button" /> )} {tag === "BADGE" && badges && ( diff --git a/app/routes/calendar/index.tsx b/app/routes/calendar/index.tsx index 841e684f6..70831e864 100644 --- a/app/routes/calendar/index.tsx +++ b/app/routes/calendar/index.tsx @@ -161,9 +161,7 @@ export default function CalendarPage() { ) : ( -

- {t("noEvents")} -

+

{t("noEvents")}

)} ) : ( @@ -358,10 +356,7 @@ function EventsList({
- +

{calendarEvent.name}{" "} {calendarEvent.nthAppearance > 1 ? ( diff --git a/app/routes/calendar/new.tsx b/app/routes/calendar/new.tsx index 6d51ba6e5..c28563c90 100644 --- a/app/routes/calendar/new.tsx +++ b/app/routes/calendar/new.tsx @@ -230,7 +230,7 @@ export default function CalendarNewEventPage() { - @@ -253,7 +253,6 @@ function NameInput() { minLength={CALENDAR_EVENT.NAME_MIN_LENGTH} maxLength={CALENDAR_EVENT.NAME_MAX_LENGTH} defaultValue={eventToEdit?.name} - data-cy="name-input" />

); @@ -281,7 +280,6 @@ function DescriptionTextarea() { value={value} onChange={(e) => setValue(e.target.value)} maxLength={CALENDAR_EVENT.DESCRIPTION_MAX_LENGTH} - data-cy="description-textarea" /> ); @@ -321,7 +319,6 @@ function DatesInput() { } min={MIN_DATE} max={MAX_DATE} - data-cy="date-input" required /> {i === datesCount - 1 && ( @@ -332,7 +329,6 @@ function DatesInput() { datesCount === CALENDAR_EVENT.MAX_AMOUNT_OF_DATES } onClick={() => setDatesCount((count) => count + 1)} - data-cy="add-date-button" > {t("common:actions.add")} @@ -340,7 +336,6 @@ function DatesInput() { + setTargetPlusTier(Number(e.target.value))} @@ -152,11 +151,7 @@ export default function PlusNewSuggestionModalPage() {
- setValue(e.target.value)} maxLength={maxLength} - data-cy="comment-textarea" required />
diff --git a/app/routes/u.$identifier.tsx b/app/routes/u.$identifier.tsx index f5395163a..66702d44a 100644 --- a/app/routes/u.$identifier.tsx +++ b/app/routes/u.$identifier.tsx @@ -100,21 +100,19 @@ export default function UserPageLayout() { return ( <> - - {t("header.profile")} - + {t("header.profile")} {isOwnPage && ( - + {t("actions.edit")} )} {data.results.length > 0 && ( - + {t("results")} ({data.results.length}) )} {(isOwnPage || data.buildsCount > 0) && ( - + {t("pages.builds")} ({data.buildsCount}) )} diff --git a/app/routes/u.$identifier/builds/index.tsx b/app/routes/u.$identifier/builds/index.tsx index 94d7a356b..4e4914059 100644 --- a/app/routes/u.$identifier/builds/index.tsx +++ b/app/routes/u.$identifier/builds/index.tsx @@ -73,11 +73,7 @@ export default function UserBuildsPage() {
{data.builds.length < BUILD.MAX_COUNT && isOwnPage && (
- + {t("addBuild")}
diff --git a/app/routes/u.$identifier/builds/new.tsx b/app/routes/u.$identifier/builds/new.tsx index 44cf417d7..a3654cd38 100644 --- a/app/routes/u.$identifier/builds/new.tsx +++ b/app/routes/u.$identifier/builds/new.tsx @@ -198,7 +198,7 @@ export default function NewBuildPage() { - @@ -221,7 +221,6 @@ function TitleInput() { minLength={BUILD.TITLE_MIN_LENGTH} maxLength={BUILD.TITLE_MAX_LENGTH} defaultValue={buildToEdit?.title} - data-cy="title-input" /> ); @@ -249,7 +248,6 @@ function DescriptionTextarea() { value={value} onChange={(e) => setValue(e.target.value)} maxLength={BUILD.DESCRIPTION_MAX_LENGTH} - data-cy="description-textarea" /> ); @@ -310,7 +308,6 @@ function WeaponsSelector() { tiny disabled={count === BUILD.MAX_WEAPONS_COUNT} onClick={() => setCount((count) => count + 1)} - data-cy="add-date-button" > {t("common:actions.add")} @@ -318,7 +315,6 @@ function WeaponsSelector() { @@ -313,7 +312,6 @@ function CountrySelect({ name="country" id="country" defaultValue={parentRouteData.country?.code ?? ""} - data-cy="country-select" >