Skip to content

Commit 6d0ee53

Browse files
authored
chore: nest routes and v3 future flags (#433)
* nest routes and add `v3` future flags * chore: use playwright (#434) * migrate from cypress to playwright * get playwright actions to work * update deploy workflow * we dont need the database for now * modify playwright deploy worflow * i hope this does not fail * increase playwright timeout * wait for main section on landing page before each test * add `--fail-on-flaky-tests` flag * we actually dont need that flag * reduce timeout limit as this takes way to long in actions * debug failing actions on safari * remove video recording * empty `BrowserContext` on every test to resolve hydration errors on `webkit` tests * update tests
1 parent 61f0239 commit 6d0ee53

File tree

84 files changed

+2118
-5822
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+2118
-5822
lines changed

.eslintrc.cjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ module.exports = {
77
"prettier",
88
],
99
env: {
10-
"cypress/globals": true,
1110
},
12-
plugins: ["cypress", "unicorn"],
11+
plugins: ["unicorn"],
1312
// We're using vitest which has a very similar API to jest
1413
// (so the linting plugins work nicely), but we have to
1514
// set the jest version explicitly.

.github/workflows/deploy.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ jobs:
7676
- name: ⚡ Run vitest
7777
run: npm run test -- --coverage
7878

79-
cypress:
80-
name: ⚫️ Cypress
79+
playwright:
80+
name: 🎭 Playwright
8181
runs-on: ubuntu-latest
8282
steps:
8383
- name: ⬇️ Checkout repo
@@ -114,13 +114,18 @@ jobs:
114114
- name: ⚙️ Build
115115
run: npm run build
116116

117-
- name: 🌳 Cypress run
118-
uses: cypress-io/github-action@v6
117+
- name: Install Playwright Browsers
118+
run: npx playwright install --with-deps
119+
120+
- name: Run Playwright tests
121+
run: npx playwright test
122+
123+
- uses: actions/upload-artifact@v4
124+
if: ${{ !cancelled() }}
119125
with:
120-
start: npm run start:mocks
121-
wait-on: http://localhost:8811
122-
env:
123-
PORT: 8811
126+
name: playwright-report
127+
path: playwright-report/
128+
retention-days: 30
124129

125130
build:
126131
name: 🐳 Build

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ node_modules
1010
.env
1111
.cache
1212

13-
/cypress/screenshots
14-
/cypress/videos
1513
/postgres-data
1614
/pgdata
1715

1816
/db/imports/*.csv
1917
measurements.csv
18+
/test-results/
19+
/playwright-report/
20+
/blob-report/
21+
/playwright/.cache/

.prettierignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ node_modules
44
/public/build
55
.env
66

7-
/cypress/screenshots
8-
/cypress/videos
97
/postgres-data
108

119
/app/styles/**/*.css

app/components/daterange-filter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
import { useEffect, useState } from "react";
1515
import { Calendar } from "./ui/calendar";
1616
import { useLoaderData, useSearchParams, useSubmit } from "@remix-run/react";
17-
import type { loader } from "~/routes/explore.$deviceId";
17+
import type { loader } from "~/routes/explore+/$deviceId+/_$deviceId";
1818
import type { DateRange } from "react-day-picker";
1919
import { PopoverClose } from "@radix-ui/react-popover";
2020
import dateTimeRanges from "~/lib/date-ranges";

app/components/device-detail/device-detail-box.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
AccordionItem,
1414
AccordionTrigger,
1515
} from "../ui/accordion";
16-
import type { loader } from "~/routes/explore.$deviceId";
16+
import type { loader } from "~/routes/explore+/$deviceId+/_$deviceId";
1717
import {
1818
ChevronUp,
1919
Minus,

app/components/header/menu/index.tsx

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import { Form, Link, useNavigation, useSearchParams } from "@remix-run/react";
1+
import {
2+
Form,
3+
Link,
4+
useMatches,
5+
useNavigation,
6+
useSearchParams,
7+
} from "@remix-run/react";
28
import {
39
DropdownMenu,
410
DropdownMenuContent,
@@ -35,6 +41,7 @@ export default function Menu() {
3541
const navigation = useNavigation();
3642
const isLoggingOut = Boolean(navigation.state === "submitting");
3743
const user = useOptionalUser();
44+
const matches = useMatches();
3845

3946
const { t } = useTranslation("menu");
4047

@@ -92,26 +99,32 @@ export default function Menu() {
9299
<Spinner />
93100
</div>
94101
)}
95-
<Link to="/explore">
96-
<DropdownMenuItem className="cursor-pointer">
97-
<Compass className="mr-2 h-5 w-5" />
98-
<span>{"Explore"}</span>
99-
</DropdownMenuItem>
100-
</Link>
101-
<Link to="/profile/me">
102-
<DropdownMenuItem className="cursor-pointer">
103-
<User2 className="mr-2 h-5 w-5" />
104-
Profile
105-
</DropdownMenuItem>
106-
</Link>
102+
{!(matches[1].pathname === "/explore") && (
103+
<Link to="/explore">
104+
<DropdownMenuItem className="cursor-pointer">
105+
<Compass className="mr-2 h-5 w-5" />
106+
<span>{"Explore"}</span>
107+
</DropdownMenuItem>
108+
</Link>
109+
)}
110+
{!(matches[1].pathname === "/profile") && (
111+
<Link to="/profile/me">
112+
<DropdownMenuItem className="cursor-pointer">
113+
<User2 className="mr-2 h-5 w-5" />
114+
Profile
115+
</DropdownMenuItem>
116+
</Link>
117+
)}
107118

108-
<Link to="/settings">
109-
<DropdownMenuItem className=" cursor-pointer">
110-
<Settings className="mr-2 h-5 w-5" />
111-
<span>{"Settings"}</span>
112-
</DropdownMenuItem>
113-
<DropdownMenuSeparator />
114-
</Link>
119+
{!(matches[1].pathname === "/settings") && (
120+
<Link to="/settings/profile">
121+
<DropdownMenuItem className=" cursor-pointer">
122+
<Settings className="mr-2 h-5 w-5" />
123+
<span>{"Settings"}</span>
124+
</DropdownMenuItem>
125+
<DropdownMenuSeparator />
126+
</Link>
127+
)}
115128
</DropdownMenuGroup>
116129
)}
117130
<DropdownMenuGroup>

app/components/header/nav-bar/phenomenon-select/phenomenon-select.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { X } from "lucide-react";
1515
import { Checkbox } from "~/components/ui/checkbox";
1616
import { ScrollArea } from "~/components/ui/scroll-area";
1717
import { Button } from "~/components/ui/button";
18-
import type { loader } from "~/routes/explore";
18+
import type { loader } from "~/routes/explore+/_explore";
1919

2020
export function PhenomenonSelect() {
2121
const data = useLoaderData<typeof loader>();

app/components/landing/connect.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { BookA, Wrench } from "lucide-react";
33
export default function Connect() {
44
return (
55
<section
6-
id="connect"
6+
id="connect-section"
77
className="flex justify-between mx-32 gap-20 border-t border-gray-200 py-20"
88
>
99
<div id="left" className="w-1/2 flex flex-col gap-10">

app/components/landing/features.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
export default function Features() {
1212
return (
1313
<section
14-
id="features"
14+
id="features-section"
1515
className="flex justify-between mx-32 gap-10 border-t border-gray-200 py-20"
1616
>
1717
<div id="left" className="w-1/2 flex flex-col gap-10">

0 commit comments

Comments
 (0)