Skip to content

Commit 397881b

Browse files
committed
update tests + add docs
1 parent 4f8b7a0 commit 397881b

File tree

10 files changed

+160
-206
lines changed

10 files changed

+160
-206
lines changed

COLLABORATOR_GUIDE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- [Adding a Download Package Manager](#adding-a-download-package-manager)
1919
- [Unit Tests and Storybooks](#unit-tests-and-storybooks)
2020
- [General Guidelines for Unit Tests](#general-guidelines-for-unit-tests)
21+
- [General Guidelines for Playwright E2E Tests](#general-guidelines-for-playwright-e2e-tests)
2122
- [General Guidelines for Storybooks](#general-guidelines-for-storybooks)
2223
- [Remarks on Technologies used](#remarks-on-technologies-used)
2324
- [Seeking additional clarification](#seeking-additional-clarification)
@@ -437,6 +438,23 @@ Unit Tests are fundamental to ensure that code changes do not disrupt the functi
437438
- Common Providers and Contexts from the lifecycle of our App, such as [`next-intl`][] should not be mocked but given an empty or fake context whenever possible.
438439
- We recommend reading previous unit tests from the codebase for inspiration and code guidelines.
439440

441+
### General Guidelines for Playwright E2E Tests
442+
443+
End-to-end (E2E) tests are essential for ensuring that the entire application works correctly from a user's perspective:
444+
445+
- E2E tests are located in the `apps/site/tests/e2e` directory.
446+
- We use [Playwright](https://playwright.dev/) as our E2E testing framework.
447+
- E2E tests should focus on user flows and critical paths through the application.
448+
- Tests should be written to be resilient to minor UI changes and should prioritize testing functionality over exact visual appearance.
449+
- When writing E2E tests:
450+
- Use meaningful test descriptions that clearly indicate what is being tested.
451+
- Group related tests using Playwright's test grouping features.
452+
- Use page objects or similar patterns to keep tests maintainable.
453+
- Minimize test interdependencies to prevent cascading failures.
454+
- Tests should run against the built application to accurately reflect the production environment.
455+
- We recommend reviewing existing E2E tests in the codebase for patterns and best practices.
456+
- If your feature involves complex user interactions or spans multiple pages, consider adding E2E tests to verify the complete flow.
457+
440458
### General Guidelines for Storybooks
441459

442460
Storybooks are an essential part of our development process. They help us to document our components and to ensure that the components are working as expected.

apps/site/.stylelintignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,7 @@ styles/old
1717
# Cloudflare Build Output
1818
.open-next
1919
.wrangler
20+
21+
# Playwright
22+
test-results
23+
playwright-report

apps/site/components/withNavBar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ const WithNavBar: FC = () => {
6262
<SearchButton />
6363

6464
<ThemeToggle
65+
data-testid="theme-toggle"
6566
onClick={toggleCurrentTheme}
66-
ariaLabel={t('components.common.themeToggle.label')}
67+
aria-label={t('components.common.themeToggle.label')}
6768
/>
6869

6970
<LanguageDropdown

apps/site/playwright.config.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ import { defineConfig, devices } from '@playwright/test';
22

33
const isCI = !!process.env.CI;
44

5+
// https://playwright.dev/docs/test-configuration
56
export default defineConfig({
67
testDir: './tests/e2e',
78
fullyParallel: true,
89
forbidOnly: isCI,
910
retries: isCI ? 2 : 0,
1011
workers: isCI ? 1 : undefined,
1112
reporter: isCI ? [['html'], ['github']] : [['html']],
12-
13+
timeout: isCI ? 30 * 60 * 1000 : 60 * 60 * 1000,
1314
use: {
1415
baseURL: process.env.VERCEL_PREVIEW_URL || 'http://127.0.0.1:3000',
1516
trace: 'on-first-retry',
@@ -20,13 +21,13 @@ export default defineConfig({
2021
name: 'chromium',
2122
use: { ...devices['Desktop Chrome'] },
2223
},
23-
{
24-
name: 'firefox',
25-
use: { ...devices['Desktop Firefox'] },
26-
},
27-
{
28-
name: 'webkit',
29-
use: { ...devices['Desktop Safari'] },
30-
},
24+
// {
25+
// name: 'firefox',
26+
// use: { ...devices['Desktop Firefox'] },
27+
// },
28+
// {
29+
// name: 'webkit',
30+
// use: { ...devices['Desktop Safari'] },
31+
// },
3132
],
3233
});

0 commit comments

Comments
 (0)