Skip to content

Commit 6dcaae3

Browse files
authored
Merge pull request #1223 from joshunrau/ci
update ci and e2e testing
2 parents 2d624bc + c711b6b commit 6dcaae3

File tree

36 files changed

+299
-139
lines changed

36 files changed

+299
-139
lines changed

.github/workflows/ci.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Checkout Code
11-
uses: actions/checkout@v6
11+
uses: actions/checkout@v5
1212
- name: Setup PNPM
1313
uses: pnpm/action-setup@v4
1414
- name: Setup Node.js
@@ -18,9 +18,21 @@ jobs:
1818
node-version-file: '.nvmrc'
1919
- name: Generate Environment
2020
run: ./scripts/generate-env.sh
21+
- name: Setup Mongo
22+
run: |
23+
docker run -d --name mongo -p 27017:27017 mongo:7 --replSet rs0
24+
docker exec mongo mongosh --eval "rs.initiate({_id: 'rs0', members: [{_id: 0, host: 'localhost:27017'}]});"
25+
- name: Configure Git
26+
run: |
27+
# necessary for the git commands used for release info
28+
git config --global --add safe.directory /__w/OpenDataCapture/OpenDataCapture
2129
- name: Install Dependencies
2230
run: pnpm install --frozen-lockfile
31+
- name: Install Playwright
32+
run: pnpm --filter "@opendatacapture/e2e" exec playwright install --with-deps
2333
- name: Lint
2434
run: pnpm lint
25-
- name: Test
35+
- name: Unit Tests
2636
run: pnpm test
37+
- name: End-to-End Tests
38+
run: pnpm --filter "@opendatacapture/e2e" test

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,4 @@ storybook-static
7474
.claude/settings.local.json
7575

7676
# playwright
77-
testing/e2e/.output/
78-
testing/e2e/playwright/.cache/
77+
testing/e2e/.playwright

apps/web/src/components/Footer/Footer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const Footer = () => {
99
const { t } = useTranslation('layout');
1010

1111
return (
12-
<footer className="text-muted-foreground container py-3 text-sm">
12+
<footer className="text-muted-foreground container py-3 text-sm" data-testid="footer">
1313
<hr className="my-3 border-slate-200 dark:border-slate-700" />
1414
<div className="flex items-center justify-center">
1515
<div className="mb-1 flex flex-row flex-wrap font-medium lg:flex-nowrap">

apps/web/src/components/IdentificationForm/IdentificationForm.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ export const IdentificationForm = ({ onSubmit }: IdentificationFormProps) => {
113113
}
114114
}
115115
]}
116+
data-testid="identification-form"
116117
initialValues={{
117118
identificationMethod: currentGroup?.settings.defaultIdentificationMethod ?? 'PERSONAL_INFO'
118119
}}

apps/web/src/components/InstrumentCard/InstrumentCard.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ export const InstrumentCard = ({ instrument, onClick }: InstrumentCardProps) =>
125125
return (
126126
<Card
127127
className="group flex gap-8 p-6 transition-transform duration-300 ease-in-out hover:scale-[1.03] hover:cursor-pointer sm:p-8"
128+
data-testid={`instrument-card-${instrument.id}`}
128129
role="button"
129130
tabIndex={0}
130131
onClick={onClick}

apps/web/src/components/InstrumentShowcase/InstrumentShowcase.tsx

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,30 @@ export const InstrumentShowcase: React.FC<{
5959
}, [availableInstruments]);
6060

6161
return (
62-
<div className="flex flex-col gap-5">
62+
<div className="flex flex-col gap-5" data-testid="instrument-showcase">
6363
<div className="flex items-center gap-2.5">
64-
<SearchBar className="grow" value={searchTerm} onValueChange={setSearchTerm} />
64+
<SearchBar
65+
className="grow"
66+
data-testid="instrument-search-bar"
67+
value={searchTerm}
68+
onValueChange={setSearchTerm}
69+
/>
6570
<div className="flex items-center gap-2.5">
66-
<InstrumentKindDropdown selected={selectedKinds} setSelected={setSelectedKinds} />
67-
<ListboxDropdown
68-
widthFull
69-
options={tagOptions}
70-
selected={selectedTags}
71-
setSelected={setSelectedTags}
72-
title={t('core.tags')}
73-
/>
74-
<InstrumentLanguageDropdown selected={selectedLanguages} setSelected={setSelectedLanguages} />
71+
<div data-testid="instrument-kind-filter">
72+
<InstrumentKindDropdown selected={selectedKinds} setSelected={setSelectedKinds} />
73+
</div>
74+
<div data-testid="instrument-tag-filter">
75+
<ListboxDropdown
76+
widthFull
77+
options={tagOptions}
78+
selected={selectedTags}
79+
setSelected={setSelectedTags}
80+
title={t('core.tags')}
81+
/>
82+
</div>
83+
<div data-testid="instrument-language-filter">
84+
<InstrumentLanguageDropdown selected={selectedLanguages} setSelected={setSelectedLanguages} />
85+
</div>
7586
</div>
7687
</div>
7788
<ul className="flex flex-col gap-5">

apps/web/src/components/Layout/Layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import { Sidebar } from '../Sidebar';
66

77
export const Layout = () => {
88
return (
9-
<div className="flex h-screen w-screen flex-col md:flex-row">
9+
<div className="flex h-screen w-screen flex-col md:flex-row" data-testid="layout">
1010
<div className="absolute md:hidden">
1111
<Navbar />
1212
</div>
1313
<div className="hidden md:flex md:shrink-0">
1414
<Sidebar />
1515
</div>
16-
<div className="scrollbar-none flex grow flex-col overflow-y-scroll pt-14 md:pt-0">
16+
<div className="scrollbar-none flex grow flex-col overflow-y-scroll pt-14 md:pt-0" data-testid="layout-main">
1717
<main className="container flex grow flex-col">
1818
<Outlet />
1919
</main>

apps/web/src/components/LoginForm/LoginForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const LoginForm = ({ onSubmit }: LoginFormProps) => {
2525
variant: 'password'
2626
}
2727
}}
28-
data-cy="login-form"
28+
data-testid="login-form"
2929
submitBtnLabel={t('login')}
3030
validationSchema={z.object({
3131
username: z.string().min(1),

apps/web/src/components/NavButton/NavButton.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export const NavButton = React.forwardRef<HTMLButtonElement, NavButtonProps>(fun
2727
)}
2828
data-nav-url={url}
2929
data-spotlight-type="nav-button"
30+
data-testid={`nav-button-${url}`}
3031
disabled={disabled}
3132
ref={ref}
3233
type="button"

apps/web/src/components/Navbar/Navbar.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,15 @@ export const Navbar = () => {
3030

3131
return (
3232
<Sheet open={isOpen} onOpenChange={setIsOpen}>
33-
<div className="fixed top-0 z-10 w-full bg-white/80 text-slate-700 shadow-sm backdrop-blur-lg dark:bg-slate-800/75 dark:text-slate-300">
33+
<div
34+
className="fixed top-0 z-10 w-full bg-white/80 text-slate-700 shadow-sm backdrop-blur-lg dark:bg-slate-800/75 dark:text-slate-300"
35+
data-testid="navbar"
36+
>
3437
<div className="h-full w-full bg-inherit">
3538
<div className="container flex items-center justify-between bg-inherit py-2 font-medium">
3639
<Branding className="[&>span]:hidden" />
3740
<Sheet.Trigger
41+
data-testid="navbar-menu-trigger"
3842
onClick={() => {
3943
setIsOpen(true);
4044
}}

0 commit comments

Comments
 (0)