You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,6 +65,7 @@ pets-workshop/
65
65
-**Data Fetching**: Fetch data on the server side when possible
66
66
-**Styling**: Use Tailwind utility classes, avoid custom CSS unless necessary
67
67
-**Routing**: File-based routing through Astro's pages directory
68
+
-**Test Identifiers**: Always include `data-testid` attributes for E2E testing resilience (see [`test-identifiers.md`](.github/instructions/test-identifiers.md))
68
69
69
70
### Database Patterns
70
71
-**Models**: Use SQLAlchemy declarative base with proper relationships
@@ -75,6 +76,7 @@ pets-workshop/
75
76
-**E2E Tests**: Playwright tests in `client/e2e-tests/` cover full user workflows
76
77
-**Test Structure**: Organize tests by page/feature (homepage, dog-details, API integration)
77
78
-**Test Commands**: Use `npm run test:e2e` for all tests, `npm run test:e2e:ui` for debugging
79
+
-**Test Identifiers**: Always use `data-testid` attributes for reliable element selection (see [`test-identifiers.md`](.github/instructions/test-identifiers.md))
78
80
-**Server Tests**: Python unittest framework for backend API testing
79
81
-**Test Coverage**: Include tests for user interactions, API responses, and error handling
This document provides a comprehensive reference for all `data-testid` attributes used in the Tailspin Shelter application for E2E testing with Playwright.
4
+
5
+
## Why Test Identifiers?
6
+
7
+
Test identifiers (`data-testid` attributes) provide stable, reliable selectors for E2E tests that won't break when:
8
+
- CSS classes change
9
+
- Styling is updated
10
+
- Component structure is refactored
11
+
- Text content is modified
12
+
13
+
## Naming Conventions
14
+
15
+
-**Format**: Use kebab-case (`dog-card-1`, `homepage-title`)
16
+
-**Descriptive**: Include component and purpose in the name
17
+
-**Unique**: Append IDs for repeated elements (`dog-card-${id}`)
18
+
-**Hierarchical**: Use prefixes for related elements (`dog-details-name`, `dog-details-breed`)
19
+
20
+
## Component Test IDs
21
+
22
+
### Homepage (`src/pages/index.astro`)
23
+
-`homepage-container`: Main page wrapper
24
+
-`homepage-title`: Welcome heading
25
+
-`homepage-description`: Descriptive text
26
+
27
+
### Dog List (`src/components/DogList.svelte`)
28
+
-`dog-list-container`: Main container
29
+
-`available-dogs-heading`: Section heading
30
+
-`dog-list-grid`: Grid of dog cards
31
+
-`dog-list-loading`: Loading state container
32
+
-`dog-list-error`: Error state container
33
+
-`dog-list-empty`: Empty state container
34
+
-`dog-card-{id}`: Individual dog cards (with ID)
35
+
-`dog-name-{id}`: Dog name within card
36
+
-`dog-breed-{id}`: Dog breed within card
37
+
-`dog-view-details-{id}`: View details link
38
+
39
+
### Dog Details (`src/components/DogDetails.svelte`)
40
+
-`dog-details-page`: Page container
41
+
-`dog-details-container`: Main details container
42
+
-`dog-details-loading`: Loading state
43
+
-`dog-details-error`: Error state
44
+
-`dog-details-no-data`: No data state
45
+
-`dog-details-name`: Dog name heading
46
+
-`dog-details-breed`: Breed information
47
+
-`dog-details-age`: Age information
48
+
-`dog-details-gender`: Gender information
49
+
-`dog-details-description`: About text
50
+
-`dog-details-about-heading`: About section heading
51
+
-`dog-status-available`: Available status badge
52
+
-`dog-status-pending`: Pending status badge
53
+
-`dog-status-adopted`: Adopted status badge
54
+
55
+
### Navigation
56
+
-`back-to-dogs-button`: Navigation button (dog details and about pages)
0 commit comments