@zap-wunschlachen/wl-shared-components 1.0.38 → 1.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/playwright.yml +205 -205
- package/.github/workflows/static.yml +61 -61
- package/.github/workflows/update-snapshots.yml +37 -37
- package/.prettierrc +5 -5
- package/.storybook/main.ts +18 -18
- package/.storybook/preview.ts +37 -37
- package/.storybook/storyWrapper.vue +18 -18
- package/.storybook/withVuetifyTheme.decorator.ts +21 -21
- package/App.vue +33 -33
- package/README.md +56 -56
- package/heroicons.ts +75 -75
- package/index.html +19 -19
- package/package.json +67 -67
- package/playwright.config.ts +48 -48
- package/public/background.svg +60 -60
- package/public/style.css +187 -187
- package/public/technologies.svg +22 -22
- package/src/assets/css/base.css +234 -232
- package/src/assets/css/variables.css +112 -109
- package/src/components/Accordion/Accordion.css +59 -59
- package/src/components/Accordion/AccordionGroup.vue +51 -51
- package/src/components/Accordion/AccordionItem.vue +66 -66
- package/src/components/Appointment/Card/Actions.css +54 -54
- package/src/components/Appointment/Card/Actions.vue +99 -99
- package/src/components/Appointment/Card/AnamneseNotification.css +15 -15
- package/src/components/Appointment/Card/AnamneseNotification.vue +23 -23
- package/src/components/Appointment/Card/Card.css +80 -80
- package/src/components/Appointment/Card/Card.vue +93 -93
- package/src/components/Appointment/Card/Details.css +50 -50
- package/src/components/Appointment/Card/Details.vue +43 -43
- package/src/components/Audio/Audio.vue +187 -187
- package/src/components/Audio/Waveform.vue +118 -118
- package/src/components/Button/Button.vue +174 -174
- package/src/components/CheckBox/CheckBox.css +214 -214
- package/src/components/CheckBox/Checkbox.vue +138 -138
- package/src/components/DateInput/DateInput.css +2 -2
- package/src/components/DateInput/DateInput.vue +262 -262
- package/src/components/Dialog/Dialog.css +6 -6
- package/src/components/Dialog/Dialog.vue +38 -38
- package/src/components/EditField/EditField.css +19 -19
- package/src/components/EditField/EditField.vue +202 -202
- package/src/components/ErrorPage/ErrorPage.css +172 -172
- package/src/components/IconBullet/IconBullet.vue +86 -86
- package/src/components/IconBullet/IconBulletList.vue +41 -41
- package/src/components/Icons/AdvanceAppointments.vue +153 -153
- package/src/components/Icons/Audio/CloudFailed.vue +20 -20
- package/src/components/Icons/Audio/CloudSaved.vue +21 -21
- package/src/components/Icons/Audio/Delete.vue +15 -15
- package/src/components/Icons/Audio/Pause.vue +18 -18
- package/src/components/Icons/Audio/Play.vue +15 -15
- package/src/components/Icons/{calendar.vue → Calendar.vue} +17 -17
- package/src/components/Icons/CalendarNotification.vue +126 -126
- package/src/components/Icons/Chair.vue +32 -32
- package/src/components/Icons/ChairNotification.vue +35 -35
- package/src/components/Icons/Circle.vue +66 -66
- package/src/components/Icons/FavIcon.vue +22 -22
- package/src/components/Icons/FilledCircle.vue +11 -11
- package/src/components/Icons/Group3.vue +46 -46
- package/src/components/Icons/RingNotification.vue +54 -54
- package/src/components/Icons/SolidArrowRight.vue +14 -14
- package/src/components/Icons/checkbox.vue +19 -19
- package/src/components/Icons/outlineChecked.vue +27 -27
- package/src/components/Icons/play.vue +5 -5
- package/src/components/Input/Input.css +187 -187
- package/src/components/Input/Input.vue +253 -253
- package/src/components/Laboratory/AppointmentCard/AppointmentCard.css +7 -7
- package/src/components/Laboratory/AppointmentCard/AppointmentCard.vue +116 -116
- package/src/components/Laboratory/ChatBoxImage/ChatBoxImage.vue +81 -81
- package/src/components/Laboratory/ChatMessage/ChatMessage.vue +113 -113
- package/src/components/Laboratory/ChatMessage/ChatMessageBadge.css +4 -4
- package/src/components/Laboratory/ChatMessage/ChatMessageBadge.vue +99 -99
- package/src/components/Laboratory/ChatNotification/ChatNotification.vue +130 -130
- package/src/components/Laboratory/DocumentCard/DocumentCard.css +3 -3
- package/src/components/Laboratory/DocumentCard/DocumentCard.vue +50 -50
- package/src/components/Laboratory/DocumentCard/DocumentCardItem.vue +53 -53
- package/src/components/Laboratory/InfoCard/InfoCard.vue +162 -162
- package/src/components/Laboratory/MainColumnsBar/MainColumnsBar.vue +102 -102
- package/src/components/Laboratory/ProgressCircle/ProgressCircle.vue +152 -152
- package/src/components/Laboratory/ProgressLinear/ProgressLinear.css +33 -33
- package/src/components/Laboratory/ProgressLinear/ProgressLinear.vue +75 -75
- package/src/components/Laboratory/SelectionColumnBar/SelectionColumnBar.vue +92 -92
- package/src/components/Laboratory/StatusNotification/StatusNotification.vue +49 -49
- package/src/components/Laboratory/TagLabel/TagLabel.vue +126 -126
- package/src/components/Laboratory/TagLabelGroup/TagLabelGroup.vue +97 -97
- package/src/components/Laboratory/TicketCard/TicketCard.css +3 -3
- package/src/components/Laboratory/TicketCard/TicketCard.vue +143 -143
- package/src/components/Laboratory/TimeLine/TimeLineEvent.css +18 -18
- package/src/components/Laboratory/TimeLine/TimeLineEvent.vue +119 -119
- package/src/components/Laboratory/TimeLine/Timeline.css +4 -4
- package/src/components/Laboratory/TimeLine/Timeline.vue +30 -30
- package/src/components/Loader/Loader.css +71 -71
- package/src/components/MaintenanceBanner/MaintenanceBanner.css +353 -353
- package/src/components/MaintenanceBanner/MaintenanceBanner.vue +127 -127
- package/src/components/MaintenanceBanner/MaintenanceIllustration.vue +54 -54
- package/src/components/Modal/Modal.css +5 -5
- package/src/components/Modal/Modal.vue +22 -22
- package/src/components/NotificationBubble/NotificationBubble.css +4 -4
- package/src/components/NotificationBubble/NotificationBubble.vue +90 -90
- package/src/components/OtpInput/OtpInput.css +39 -39
- package/src/components/OtpInput/OtpInput.vue +151 -151
- package/src/components/PhoneInput/PhoneInput.css +31 -31
- package/src/components/PhoneInput/PhoneInput.vue +113 -113
- package/src/components/Select/Select.css +150 -150
- package/src/components/Select/Select.vue +316 -316
- package/src/components/TextArea/TextArea.css +3 -3
- package/src/components/TextArea/TextArea.vue +126 -126
- package/src/components/TickBox/TickBox.css +49 -49
- package/src/components/TickBox/TickBox.vue +126 -126
- package/src/components/accessibility.css +218 -218
- package/src/components/index.ts +29 -29
- package/src/constants/iconEnums.ts +3 -3
- package/src/i18n/i18n.ts +15 -15
- package/src/i18n/locales/de.json +30 -30
- package/src/i18n/locales/en.json +30 -30
- package/src/index.ts +34 -34
- package/src/main.ts +11 -11
- package/src/plugins/vuetify.ts +141 -141
- package/src/shims-vue.d.ts +10 -10
- package/src/stories/Accordion.stories.ts +650 -650
- package/src/stories/Audio.stories.ts +28 -28
- package/src/stories/Button.stories.ts +263 -263
- package/src/stories/CheckBox.stories.ts +348 -348
- package/src/stories/DateInput.stories.ts +53 -53
- package/src/stories/Dialog.stories.ts +147 -147
- package/src/stories/EditField.stories.ts +78 -78
- package/src/stories/IconBullet/IconBullet.stories.ts +201 -201
- package/src/stories/IconBullet/IconBulletList.stories.ts +275 -275
- package/src/stories/Input.stories.ts +351 -351
- package/src/stories/Laboratory/Cards/AppointmentCard/AppointmentCard.stories.ts +260 -260
- package/src/stories/Laboratory/Cards/DocumentCard/DocumentCard.stories.ts +176 -176
- package/src/stories/Laboratory/Cards/DocumentCard/DocumentCardItem.stories.ts +119 -119
- package/src/stories/Laboratory/Cards/InfoCard/InfoCard.stories.ts +320 -320
- package/src/stories/Laboratory/Cards/TicketCard/TicketCard.stories.ts +335 -335
- package/src/stories/Laboratory/Chat/ChatBoxImage.stories.ts +82 -82
- package/src/stories/Laboratory/Chat/ChatMessage.stories.ts +198 -198
- package/src/stories/Laboratory/Chat/ChatMessageBadge.stories.ts +204 -204
- package/src/stories/Laboratory/Chat/ChatNotification.stories.ts +144 -144
- package/src/stories/Laboratory/Chat/ProgressLinear.stories.ts +186 -186
- package/src/stories/Laboratory/Chat/StatusNotification.stories.ts +111 -111
- package/src/stories/Laboratory/MainColumnsBar.stories.ts +48 -48
- package/src/stories/Laboratory/ProgressCircle.stories.ts +261 -261
- package/src/stories/Laboratory/SelectionColumnBar.stories.ts +234 -234
- package/src/stories/Laboratory/TagLabel.stories.ts +418 -418
- package/src/stories/Laboratory/TagLabelGroup.stories.ts +234 -234
- package/src/stories/Laboratory/Timeline.stories.ts +403 -403
- package/src/stories/NotificationBubble.stories.ts +194 -194
- package/src/stories/OtpInput.stories.ts +100 -100
- package/src/stories/PhoneInput.stories.ts +52 -52
- package/src/stories/Select.stories.ts +419 -419
- package/src/stories/TextArea.stories.ts +112 -112
- package/src/stories/TickBox.stories.ts +294 -294
- package/src/stories/v-icon.stories.ts +91 -91
- package/src/utils/index.ts +116 -109
- package/src/vite-env.d.ts +1 -1
- package/tests/e2e/README.md +220 -220
- package/tests/e2e/accessibility.spec.ts +638 -638
- package/tests/e2e/accordion.spec.ts +42 -42
- package/tests/e2e/additional-components.spec.ts +437 -437
- package/tests/e2e/all-components.spec.ts +135 -135
- package/tests/e2e/appointment-card.spec.ts +816 -816
- package/tests/e2e/button-fixed.spec.ts +58 -58
- package/tests/e2e/button.spec.ts +76 -76
- package/tests/e2e/checkbox.spec.ts +50 -50
- package/tests/e2e/date-input.spec.ts +46 -46
- package/tests/e2e/debug.spec.ts +51 -51
- package/tests/e2e/dialog.spec.ts +58 -58
- package/tests/e2e/input.spec.ts +55 -55
- package/tests/e2e/laboratory-components.spec.ts +320 -320
- package/tests/e2e/otp-input.spec.ts +50 -50
- package/tests/e2e/select.spec.ts +52 -52
- package/tests/e2e/storybook-utils.ts +59 -59
- package/tests/e2e/test-basic.spec.ts +33 -33
- package/tests/e2e/visual-regression.spec.ts +350 -350
- package/tests/unit/accessibility/component-a11y.spec.ts +469 -469
- package/tests/unit/components/Accordion/AccordionGroup.spec.ts +228 -228
- package/tests/unit/components/Accordion/AccordionGroup.spec.ts.skip +342 -342
- package/tests/unit/components/Accordion/AccordionItem.spec.ts +292 -292
- package/tests/unit/components/Accordion/AccordionItem.spec.ts.skip +383 -383
- package/tests/unit/components/Appointment/AnamneseNotification.spec.ts +176 -176
- package/tests/unit/components/Appointment/Card/Actions.spec.ts +407 -407
- package/tests/unit/components/Appointment/Card/Card.spec.ts +485 -485
- package/tests/unit/components/Appointment/Card/Details.spec.ts +397 -397
- package/tests/unit/components/Audio/Audio.spec.ts +403 -403
- package/tests/unit/components/Audio/Waveform.spec.ts +483 -483
- package/tests/unit/components/Background/Background.spec.ts +177 -177
- package/tests/unit/components/Core/Button.spec.ts +336 -336
- package/tests/unit/components/Core/Checkbox.spec.ts +544 -544
- package/tests/unit/components/Core/DateInput.spec.ts +690 -690
- package/tests/unit/components/Core/Dialog.spec.ts +485 -485
- package/tests/unit/components/Core/EditField.spec.ts +782 -782
- package/tests/unit/components/Core/Input.spec.ts +512 -512
- package/tests/unit/components/Core/Modal.spec.ts +518 -518
- package/tests/unit/components/Core/NotificationBubble.spec.ts +606 -606
- package/tests/unit/components/Core/OtpInput.spec.ts +708 -708
- package/tests/unit/components/Core/PhoneInput.spec.ts +619 -619
- package/tests/unit/components/Core/Select.spec.ts +712 -712
- package/tests/unit/components/Core/TextArea.spec.ts +565 -565
- package/tests/unit/components/Core/TickBox.spec.ts +779 -779
- package/tests/unit/components/ErrorPage/ErrorPage.spec.ts +313 -313
- package/tests/unit/components/ErrorPage/ErrorPageLogo.spec.ts +153 -153
- package/tests/unit/components/IconBullet/IconBullet.spec.ts +356 -356
- package/tests/unit/components/IconBullet/IconBulletList.spec.ts +371 -371
- package/tests/unit/components/Icons/AdvanceAppointments.spec.ts +61 -61
- package/tests/unit/components/Icons/Audio/CloudFailed.spec.ts +108 -108
- package/tests/unit/components/Icons/Audio/CloudSaved.spec.ts +149 -149
- package/tests/unit/components/Icons/Audio/Delete.spec.ts +158 -158
- package/tests/unit/components/Icons/Audio/Pause.spec.ts +208 -208
- package/tests/unit/components/Icons/Audio/Play.spec.ts +217 -217
- package/tests/unit/components/Icons/CalendarNotification.spec.ts +186 -186
- package/tests/unit/components/Icons/Chair.spec.ts +234 -234
- package/tests/unit/components/Icons/ChairNotification.spec.ts +311 -311
- package/tests/unit/components/Icons/Circle.spec.ts +255 -255
- package/tests/unit/components/Icons/FavIcon.spec.ts +251 -251
- package/tests/unit/components/Icons/FilledCircle.spec.ts +274 -274
- package/tests/unit/components/Icons/Group3.spec.ts +355 -355
- package/tests/unit/components/Icons/Logo.spec.ts +228 -228
- package/tests/unit/components/Icons/MiniLogo.spec.ts +38 -38
- package/tests/unit/components/Icons/RingNotification.spec.ts +393 -393
- package/tests/unit/components/Icons/SolidArrowRight.spec.ts +49 -49
- package/tests/unit/components/Icons/calendar.spec.ts +286 -286
- package/tests/unit/components/Icons/checkbox.spec.ts +315 -315
- package/tests/unit/components/Icons/outlineChecked.spec.ts +434 -434
- package/tests/unit/components/Icons/play.spec.ts +308 -308
- package/tests/unit/components/Laboratory/AppointmentCard.spec.ts +167 -167
- package/tests/unit/components/Laboratory/ChatBoxImage.spec.ts +179 -179
- package/tests/unit/components/Laboratory/ChatMessage.spec.ts +263 -263
- package/tests/unit/components/Laboratory/ChatMessageBadge.spec.ts +282 -282
- package/tests/unit/components/Laboratory/ChatNotification.spec.ts +256 -256
- package/tests/unit/components/Laboratory/DocumentCard.spec.ts +228 -228
- package/tests/unit/components/Laboratory/DocumentCardItem.spec.ts +236 -236
- package/tests/unit/components/Laboratory/InfoCard.spec.ts +308 -308
- package/tests/unit/components/Laboratory/MainColumnsBar.spec.ts +251 -251
- package/tests/unit/components/Laboratory/ProgressCircle.spec.ts +290 -290
- package/tests/unit/components/Laboratory/ProgressLinear.spec.ts +275 -275
- package/tests/unit/components/Laboratory/SelectionColumnBar.spec.ts +288 -288
- package/tests/unit/components/Laboratory/StatusNotification.spec.ts +296 -296
- package/tests/unit/components/Laboratory/TagLabel.spec.ts +353 -353
- package/tests/unit/components/Laboratory/TagLabelGroup.spec.ts +377 -377
- package/tests/unit/components/Laboratory/TicketCard.spec.ts +351 -351
- package/tests/unit/components/Laboratory/TimeLineEvent.spec.ts +381 -381
- package/tests/unit/components/Laboratory/Timeline.spec.ts +419 -419
- package/tests/unit/components/Loader/Loader.spec.ts +197 -197
- package/tests/unit/components/MaintenanceBanner/MaintenanceBanner.spec.ts +302 -302
- package/tests/unit/constants/iconEnums.spec.ts +39 -39
- package/tests/unit/i18n/i18n.spec.ts +88 -88
- package/tests/unit/plugins/vuetify.spec.ts +220 -220
- package/tests/unit/setup.ts +189 -189
- package/tests/unit/src/components/index.spec.ts.skip +192 -192
- package/tests/unit/src/index.spec.ts.skip +182 -182
- package/tests/unit/src/main.spec.ts +151 -151
- package/tests/unit/utils/accessibility.spec.ts +318 -318
- package/tsconfig.json +26 -26
- package/vite.config.ts +29 -29
- package/vitest.config.ts +83 -83
|
@@ -1,817 +1,817 @@
|
|
|
1
|
-
import { test, expect } from '@playwright/test';
|
|
2
|
-
import AxeBuilder from '@axe-core/playwright';
|
|
3
|
-
|
|
4
|
-
test.describe('Appointment Card Component', () => {
|
|
5
|
-
async function getFrame(page) {
|
|
6
|
-
await page.waitForSelector('#storybook-preview-iframe', { timeout: 30000 });
|
|
7
|
-
const frame = page.frame({ url: /iframe\.html/ });
|
|
8
|
-
if (!frame) throw new Error('Frame not found');
|
|
9
|
-
await frame.waitForSelector('body', { timeout: 30000, state: 'attached' });
|
|
10
|
-
await page.waitForTimeout(1000);
|
|
11
|
-
return frame;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
test.describe('Appointment Card Structure and Display', () => {
|
|
15
|
-
test('renders appointment card with all sections', async ({ page }) => {
|
|
16
|
-
// Since there's no specific story for the new Card component, we'll test it through direct component mounting
|
|
17
|
-
await page.goto('http://localhost:7000');
|
|
18
|
-
|
|
19
|
-
// Create a test page that mounts our component
|
|
20
|
-
await page.evaluate(() => {
|
|
21
|
-
const testContainer = document.createElement('div');
|
|
22
|
-
testContainer.id = 'test-appointment-card';
|
|
23
|
-
testContainer.innerHTML = `
|
|
24
|
-
<div data-testid="root">
|
|
25
|
-
<a href="#" class="appointment-card">
|
|
26
|
-
<div>
|
|
27
|
-
<div class="card-header header-bg-normal">
|
|
28
|
-
<div class="header-item">
|
|
29
|
-
<div class="header-icon"></div>
|
|
30
|
-
<p>John Doe</p>
|
|
31
|
-
</div>
|
|
32
|
-
<div class="header-item">
|
|
33
|
-
<div class="header-icon"></div>
|
|
34
|
-
<p>Mon, 15 Jan 2024</p>
|
|
35
|
-
</div>
|
|
36
|
-
<div class="header-item">
|
|
37
|
-
<div class="header-icon"></div>
|
|
38
|
-
<p>10:30</p>
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
<div class="card-body">
|
|
42
|
-
<h2>Test Treatment</h2>
|
|
43
|
-
<div class="details-stub">Details Component</div>
|
|
44
|
-
<hr />
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
</a>
|
|
48
|
-
<div class="card-footer">
|
|
49
|
-
<div class="actions-stub">Actions Component</div>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
`;
|
|
53
|
-
document.body.appendChild(testContainer);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
await expect(page.locator('[data-testid="root"]')).toBeVisible();
|
|
57
|
-
await expect(page.locator('.appointment-card')).toBeVisible();
|
|
58
|
-
await expect(page.locator('.card-header')).toBeVisible();
|
|
59
|
-
await expect(page.locator('.card-body')).toBeVisible();
|
|
60
|
-
await expect(page.locator('.card-footer')).toBeVisible();
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
test('displays patient information correctly', async ({ page }) => {
|
|
64
|
-
await page.goto('http://localhost:7000');
|
|
65
|
-
|
|
66
|
-
await page.evaluate(() => {
|
|
67
|
-
const testContainer = document.createElement('div');
|
|
68
|
-
testContainer.innerHTML = `
|
|
69
|
-
<div class="appointment-card">
|
|
70
|
-
<div class="card-header">
|
|
71
|
-
<div class="header-item">
|
|
72
|
-
<p>Jane Smith</p>
|
|
73
|
-
</div>
|
|
74
|
-
<div class="header-item">
|
|
75
|
-
<p>Tue, 20 Feb 2024</p>
|
|
76
|
-
</div>
|
|
77
|
-
<div class="header-item">
|
|
78
|
-
<p>14:15</p>
|
|
79
|
-
</div>
|
|
80
|
-
</div>
|
|
81
|
-
</div>
|
|
82
|
-
`;
|
|
83
|
-
document.body.appendChild(testContainer);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
await expect(page.locator('.appointment-card')).toContainText('Jane Smith');
|
|
87
|
-
await expect(page.locator('.appointment-card')).toContainText('Tue, 20 Feb 2024');
|
|
88
|
-
await expect(page.locator('.appointment-card')).toContainText('14:15');
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
test('displays default patient name when none provided', async ({ page }) => {
|
|
92
|
-
await page.goto('http://localhost:7000');
|
|
93
|
-
|
|
94
|
-
await page.evaluate(() => {
|
|
95
|
-
const testContainer = document.createElement('div');
|
|
96
|
-
testContainer.innerHTML = `
|
|
97
|
-
<div class="appointment-card">
|
|
98
|
-
<div class="card-header">
|
|
99
|
-
<div class="header-item">
|
|
100
|
-
<p>Unbekannter Patient</p>
|
|
101
|
-
</div>
|
|
102
|
-
</div>
|
|
103
|
-
</div>
|
|
104
|
-
`;
|
|
105
|
-
document.body.appendChild(testContainer);
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
await expect(page.locator('.appointment-card')).toContainText('Unbekannter Patient');
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
test.describe('Appointment Card Status Styling', () => {
|
|
113
|
-
test('applies normal styling for upcoming appointments', async ({ page }) => {
|
|
114
|
-
await page.goto('http://localhost:7000');
|
|
115
|
-
|
|
116
|
-
await page.evaluate(() => {
|
|
117
|
-
const testContainer = document.createElement('div');
|
|
118
|
-
testContainer.innerHTML = `
|
|
119
|
-
<div class="card-header header-bg-normal">
|
|
120
|
-
<p>Upcoming Appointment</p>
|
|
121
|
-
</div>
|
|
122
|
-
`;
|
|
123
|
-
document.body.appendChild(testContainer);
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
await expect(page.locator('.card-header')).toHaveClass(/header-bg-normal/);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
test('applies cancelled styling for cancelled appointments', async ({ page }) => {
|
|
130
|
-
await page.goto('http://localhost:7000');
|
|
131
|
-
|
|
132
|
-
await page.evaluate(() => {
|
|
133
|
-
const testContainer = document.createElement('div');
|
|
134
|
-
testContainer.innerHTML = `
|
|
135
|
-
<div class="card-header header-bg-cancelled">
|
|
136
|
-
<p>Cancelled Appointment</p>
|
|
137
|
-
</div>
|
|
138
|
-
`;
|
|
139
|
-
document.body.appendChild(testContainer);
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
await expect(page.locator('.card-header')).toHaveClass(/header-bg-cancelled/);
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
test('applies opacity styling for past appointments', async ({ page }) => {
|
|
146
|
-
await page.goto('http://localhost:7000');
|
|
147
|
-
|
|
148
|
-
await page.evaluate(() => {
|
|
149
|
-
const testContainer = document.createElement('div');
|
|
150
|
-
testContainer.innerHTML = `
|
|
151
|
-
<div class="card-opacity">
|
|
152
|
-
<p>Past Appointment</p>
|
|
153
|
-
</div>
|
|
154
|
-
`;
|
|
155
|
-
document.body.appendChild(testContainer);
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
await expect(page.locator('.card-opacity')).toBeVisible();
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
test.describe('Appointment Card Actions', () => {
|
|
163
|
-
test('displays action buttons for upcoming appointments', async ({ page }) => {
|
|
164
|
-
await page.goto('http://localhost:7000');
|
|
165
|
-
|
|
166
|
-
await page.evaluate(() => {
|
|
167
|
-
const testContainer = document.createElement('div');
|
|
168
|
-
testContainer.innerHTML = `
|
|
169
|
-
<div class="actions-grid">
|
|
170
|
-
<button class="action-button">Termin stornieren</button>
|
|
171
|
-
<button class="action-button">Termin verschieben</button>
|
|
172
|
-
</div>
|
|
173
|
-
<button class="full-width-button">Termin bestätigen</button>
|
|
174
|
-
`;
|
|
175
|
-
document.body.appendChild(testContainer);
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
await expect(page.locator('.actions-grid')).toBeVisible();
|
|
179
|
-
await expect(page.locator('button:text("Termin stornieren")')).toBeVisible();
|
|
180
|
-
await expect(page.locator('button:text("Termin verschieben")')).toBeVisible();
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
test('shows rebook button for past appointments', async ({ page }) => {
|
|
184
|
-
await page.goto('http://localhost:7000');
|
|
185
|
-
|
|
186
|
-
await page.evaluate(() => {
|
|
187
|
-
const testContainer = document.createElement('div');
|
|
188
|
-
testContainer.innerHTML = `
|
|
189
|
-
<button class="full-width-button-opacity">Diesen Termin nochmal buchen</button>
|
|
190
|
-
`;
|
|
191
|
-
document.body.appendChild(testContainer);
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
await expect(page.locator('button:text("Diesen Termin nochmal buchen")')).toBeVisible();
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
test('shows cancelled status for cancelled appointments', async ({ page }) => {
|
|
198
|
-
await page.goto('http://localhost:7000');
|
|
199
|
-
|
|
200
|
-
await page.evaluate(() => {
|
|
201
|
-
const testContainer = document.createElement('div');
|
|
202
|
-
testContainer.innerHTML = `
|
|
203
|
-
<button class="full-width-button-opacity" readonly>Termin storniert</button>
|
|
204
|
-
`;
|
|
205
|
-
document.body.appendChild(testContainer);
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
const cancelledButton = page.locator('button:text("Termin storniert")');
|
|
209
|
-
await expect(cancelledButton).toBeVisible();
|
|
210
|
-
await expect(cancelledButton).toHaveAttribute('readonly');
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
test('can click action buttons', async ({ page }) => {
|
|
214
|
-
await page.goto('http://localhost:7000');
|
|
215
|
-
|
|
216
|
-
await page.evaluate(() => {
|
|
217
|
-
const testContainer = document.createElement('div');
|
|
218
|
-
testContainer.innerHTML = `
|
|
219
|
-
<div class="actions-grid">
|
|
220
|
-
<button class="action-button" id="cancel-btn">Termin stornieren</button>
|
|
221
|
-
<button class="action-button" id="reschedule-btn">Termin verschieben</button>
|
|
222
|
-
</div>
|
|
223
|
-
`;
|
|
224
|
-
document.body.appendChild(testContainer);
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
const cancelButton = page.locator('#cancel-btn');
|
|
228
|
-
const rescheduleButton = page.locator('#reschedule-btn');
|
|
229
|
-
|
|
230
|
-
await expect(cancelButton).toBeVisible();
|
|
231
|
-
await expect(rescheduleButton).toBeVisible();
|
|
232
|
-
|
|
233
|
-
await cancelButton.click();
|
|
234
|
-
await rescheduleButton.click();
|
|
235
|
-
});
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
test.describe('Appointment Card Details', () => {
|
|
239
|
-
test('displays dentist information', async ({ page }) => {
|
|
240
|
-
await page.goto('http://localhost:7000');
|
|
241
|
-
|
|
242
|
-
await page.evaluate(() => {
|
|
243
|
-
const testContainer = document.createElement('div');
|
|
244
|
-
testContainer.innerHTML = `
|
|
245
|
-
<div class="details-grid">
|
|
246
|
-
<div class="dentist-section">
|
|
247
|
-
<div class="dentist-list">
|
|
248
|
-
<div class="dentist-item">
|
|
249
|
-
<img src="https://example.com/dentist.jpg" alt="Dentist photo" class="dentist-image" />
|
|
250
|
-
<div class="dentist-info">
|
|
251
|
-
<p class="p-small">Dr. Test Dentist</p>
|
|
252
|
-
<p class="p-small text-dental-blue-3">Male</p>
|
|
253
|
-
</div>
|
|
254
|
-
</div>
|
|
255
|
-
</div>
|
|
256
|
-
</div>
|
|
257
|
-
</div>
|
|
258
|
-
`;
|
|
259
|
-
document.body.appendChild(testContainer);
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
await expect(page.locator('.dentist-section')).toBeVisible();
|
|
263
|
-
await expect(page.locator('.dentist-image')).toBeVisible();
|
|
264
|
-
await expect(page.locator('.details-grid')).toContainText('Dr. Test Dentist');
|
|
265
|
-
await expect(page.locator('.details-grid')).toContainText('Male');
|
|
266
|
-
});
|
|
267
|
-
|
|
268
|
-
test('displays location information', async ({ page }) => {
|
|
269
|
-
await page.goto('http://localhost:7000');
|
|
270
|
-
|
|
271
|
-
await page.evaluate(() => {
|
|
272
|
-
const testContainer = document.createElement('div');
|
|
273
|
-
testContainer.innerHTML = `
|
|
274
|
-
<div class="details-grid">
|
|
275
|
-
<div class="location-section">
|
|
276
|
-
<div class="icon-text-dental"></div>
|
|
277
|
-
<div>
|
|
278
|
-
<p class="p-small">Test Address 123</p>
|
|
279
|
-
<p class="p-small text-dental-blue-3">Test District</p>
|
|
280
|
-
</div>
|
|
281
|
-
</div>
|
|
282
|
-
</div>
|
|
283
|
-
`;
|
|
284
|
-
document.body.appendChild(testContainer);
|
|
285
|
-
});
|
|
286
|
-
|
|
287
|
-
await expect(page.locator('.location-section')).toBeVisible();
|
|
288
|
-
await expect(page.locator('.details-grid')).toContainText('Test Address 123');
|
|
289
|
-
await expect(page.locator('.details-grid')).toContainText('Test District');
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
test('displays default location when not provided', async ({ page }) => {
|
|
293
|
-
await page.goto('http://localhost:7000');
|
|
294
|
-
|
|
295
|
-
await page.evaluate(() => {
|
|
296
|
-
const testContainer = document.createElement('div');
|
|
297
|
-
testContainer.innerHTML = `
|
|
298
|
-
<div class="details-grid">
|
|
299
|
-
<div class="location-section">
|
|
300
|
-
<div>
|
|
301
|
-
<p class="p-small">Unbekannter Ort</p>
|
|
302
|
-
<p class="p-small text-dental-blue-3">Unbekannter Stadtteil</p>
|
|
303
|
-
</div>
|
|
304
|
-
</div>
|
|
305
|
-
</div>
|
|
306
|
-
`;
|
|
307
|
-
document.body.appendChild(testContainer);
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
await expect(page.locator('.location-section')).toContainText('Unbekannter Ort');
|
|
311
|
-
await expect(page.locator('.location-section')).toContainText('Unbekannter Stadtteil');
|
|
312
|
-
});
|
|
313
|
-
});
|
|
314
|
-
|
|
315
|
-
test.describe('Appointment Card Layout and Styling', () => {
|
|
316
|
-
test('has proper layout structure', async ({ page }) => {
|
|
317
|
-
await page.goto('http://localhost:7000');
|
|
318
|
-
|
|
319
|
-
await page.evaluate(() => {
|
|
320
|
-
const testContainer = document.createElement('div');
|
|
321
|
-
testContainer.innerHTML = `
|
|
322
|
-
<div data-testid="root">
|
|
323
|
-
<a href="#" class="appointment-card">
|
|
324
|
-
<div class="card-header"></div>
|
|
325
|
-
<div class="card-body">
|
|
326
|
-
<hr />
|
|
327
|
-
</div>
|
|
328
|
-
</a>
|
|
329
|
-
<div class="card-footer"></div>
|
|
330
|
-
</div>
|
|
331
|
-
`;
|
|
332
|
-
document.body.appendChild(testContainer);
|
|
333
|
-
});
|
|
334
|
-
|
|
335
|
-
await expect(page.locator('[data-testid="root"]')).toBeVisible();
|
|
336
|
-
await expect(page.locator('.appointment-card')).toBeVisible();
|
|
337
|
-
await expect(page.locator('hr')).toBeVisible();
|
|
338
|
-
});
|
|
339
|
-
|
|
340
|
-
test('applies correct CSS classes', async ({ page }) => {
|
|
341
|
-
await page.goto('http://localhost:7000');
|
|
342
|
-
|
|
343
|
-
await page.evaluate(() => {
|
|
344
|
-
const testContainer = document.createElement('div');
|
|
345
|
-
testContainer.innerHTML = `
|
|
346
|
-
<div class="actions-grid">
|
|
347
|
-
<button class="action-button">Button 1</button>
|
|
348
|
-
<button class="action-button">Button 2</button>
|
|
349
|
-
</div>
|
|
350
|
-
`;
|
|
351
|
-
document.body.appendChild(testContainer);
|
|
352
|
-
});
|
|
353
|
-
|
|
354
|
-
await expect(page.locator('.actions-grid')).toBeVisible();
|
|
355
|
-
await expect(page.locator('.action-button').first()).toBeVisible();
|
|
356
|
-
await expect(page.locator('.action-button').last()).toBeVisible();
|
|
357
|
-
});
|
|
358
|
-
});
|
|
359
|
-
|
|
360
|
-
test.describe('Accessibility', () => {
|
|
361
|
-
test('has proper link attributes', async ({ page }) => {
|
|
362
|
-
await page.goto('http://localhost:7000');
|
|
363
|
-
|
|
364
|
-
await page.evaluate(() => {
|
|
365
|
-
const testContainer = document.createElement('div');
|
|
366
|
-
testContainer.innerHTML = `
|
|
367
|
-
<a href="https://example.com/appointment/123" rel="noopener noreferrer" class="appointment-card">
|
|
368
|
-
Appointment Link
|
|
369
|
-
</a>
|
|
370
|
-
`;
|
|
371
|
-
document.body.appendChild(testContainer);
|
|
372
|
-
});
|
|
373
|
-
|
|
374
|
-
const link = page.locator('.appointment-card');
|
|
375
|
-
await expect(link).toHaveAttribute('href', 'https://example.com/appointment/123');
|
|
376
|
-
await expect(link).toHaveAttribute('rel', 'noopener noreferrer');
|
|
377
|
-
});
|
|
378
|
-
|
|
379
|
-
test('has descriptive test ids and alt text', async ({ page }) => {
|
|
380
|
-
await page.goto('http://localhost:7000');
|
|
381
|
-
|
|
382
|
-
await page.evaluate(() => {
|
|
383
|
-
const testContainer = document.createElement('div');
|
|
384
|
-
testContainer.innerHTML = `
|
|
385
|
-
<div data-testid="root">
|
|
386
|
-
<img src="https://example.com/dentist.jpg" alt="Dentist photo" class="dentist-image" />
|
|
387
|
-
</div>
|
|
388
|
-
`;
|
|
389
|
-
document.body.appendChild(testContainer);
|
|
390
|
-
});
|
|
391
|
-
|
|
392
|
-
await expect(page.locator('[data-testid="root"]')).toBeVisible();
|
|
393
|
-
await expect(page.locator('.dentist-image')).toHaveAttribute('alt', 'Dentist photo');
|
|
394
|
-
});
|
|
395
|
-
|
|
396
|
-
test('buttons are keyboard accessible', async ({ page }) => {
|
|
397
|
-
await page.goto('http://localhost:7000');
|
|
398
|
-
|
|
399
|
-
await page.evaluate(() => {
|
|
400
|
-
const testContainer = document.createElement('div');
|
|
401
|
-
testContainer.innerHTML = `
|
|
402
|
-
<button class="action-button" tabindex="0">Termin stornieren</button>
|
|
403
|
-
<button class="action-button" tabindex="0">Termin verschieben</button>
|
|
404
|
-
`;
|
|
405
|
-
document.body.appendChild(testContainer);
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
const cancelButton = page.locator('button:text("Termin stornieren")');
|
|
409
|
-
const rescheduleButton = page.locator('button:text("Termin verschieben")');
|
|
410
|
-
|
|
411
|
-
await cancelButton.focus();
|
|
412
|
-
await expect(cancelButton).toBeFocused();
|
|
413
|
-
|
|
414
|
-
await page.keyboard.press('Tab');
|
|
415
|
-
await expect(rescheduleButton).toBeFocused();
|
|
416
|
-
});
|
|
417
|
-
});
|
|
418
|
-
|
|
419
|
-
test.describe('Responsive Design', () => {
|
|
420
|
-
test('displays correctly on mobile viewport', async ({ page }) => {
|
|
421
|
-
await page.setViewportSize({ width: 375, height: 667 });
|
|
422
|
-
await page.goto('http://localhost:7000');
|
|
423
|
-
|
|
424
|
-
await page.evaluate(() => {
|
|
425
|
-
const testContainer = document.createElement('div');
|
|
426
|
-
testContainer.innerHTML = `
|
|
427
|
-
<div class="appointment-card" style="width: 100%; max-width: 100%;">
|
|
428
|
-
<div class="actions-grid" style="display: flex; gap: 20px;">
|
|
429
|
-
<button class="action-button" style="flex: 1;">Cancel</button>
|
|
430
|
-
<button class="action-button" style="flex: 1;">Reschedule</button>
|
|
431
|
-
</div>
|
|
432
|
-
</div>
|
|
433
|
-
`;
|
|
434
|
-
document.body.appendChild(testContainer);
|
|
435
|
-
});
|
|
436
|
-
|
|
437
|
-
await expect(page.locator('.appointment-card')).toBeVisible();
|
|
438
|
-
await expect(page.locator('.actions-grid')).toBeVisible();
|
|
439
|
-
});
|
|
440
|
-
|
|
441
|
-
test('displays correctly on tablet viewport', async ({ page }) => {
|
|
442
|
-
await page.setViewportSize({ width: 768, height: 1024 });
|
|
443
|
-
await page.goto('http://localhost:7000');
|
|
444
|
-
|
|
445
|
-
await page.evaluate(() => {
|
|
446
|
-
const testContainer = document.createElement('div');
|
|
447
|
-
testContainer.innerHTML = `
|
|
448
|
-
<div class="appointment-card">
|
|
449
|
-
<div class="card-header">
|
|
450
|
-
<div class="header-item">Patient Name</div>
|
|
451
|
-
<div class="header-item">Date</div>
|
|
452
|
-
<div class="header-item">Time</div>
|
|
453
|
-
</div>
|
|
454
|
-
</div>
|
|
455
|
-
`;
|
|
456
|
-
document.body.appendChild(testContainer);
|
|
457
|
-
});
|
|
458
|
-
|
|
459
|
-
await expect(page.locator('.appointment-card')).toBeVisible();
|
|
460
|
-
await expect(page.locator('.card-header')).toBeVisible();
|
|
461
|
-
});
|
|
462
|
-
});
|
|
463
|
-
|
|
464
|
-
test.describe('Accessibility Tests', () => {
|
|
465
|
-
test('appointment card structure meets accessibility standards', async ({ page }) => {
|
|
466
|
-
await page.goto('http://localhost:7000');
|
|
467
|
-
|
|
468
|
-
await page.evaluate(() => {
|
|
469
|
-
const testContainer = document.createElement('div');
|
|
470
|
-
testContainer.innerHTML = `
|
|
471
|
-
<div data-testid="appointment-card-test" role="article" aria-labelledby="appointment-title">
|
|
472
|
-
<a href="#" class="appointment-card" rel="noopener noreferrer">
|
|
473
|
-
<div class="card-header header-bg-normal">
|
|
474
|
-
<div class="header-item">
|
|
475
|
-
<div aria-hidden="true" role="img" class="header-icon"></div>
|
|
476
|
-
<p>John Doe</p>
|
|
477
|
-
</div>
|
|
478
|
-
<div class="header-item">
|
|
479
|
-
<div aria-hidden="true" role="img" class="header-icon"></div>
|
|
480
|
-
<p>Mon, 15 Jan 2024</p>
|
|
481
|
-
</div>
|
|
482
|
-
<div class="header-item">
|
|
483
|
-
<div aria-hidden="true" role="img" class="header-icon"></div>
|
|
484
|
-
<p>10:30</p>
|
|
485
|
-
</div>
|
|
486
|
-
</div>
|
|
487
|
-
<div class="card-body">
|
|
488
|
-
<h2 id="appointment-title">Test Treatment</h2>
|
|
489
|
-
<div role="region" aria-label="Appointment details">
|
|
490
|
-
<div class="details-grid">
|
|
491
|
-
<div class="dentist-section">
|
|
492
|
-
<div class="dentist-list">
|
|
493
|
-
<div class="dentist-item">
|
|
494
|
-
<img src="https://example.com/dentist.jpg" alt="Dentist photo" class="dentist-image" />
|
|
495
|
-
<div class="dentist-info">
|
|
496
|
-
<p class="p-small">Dr. Test Dentist</p>
|
|
497
|
-
<p class="p-small text-dental-blue-3">Male</p>
|
|
498
|
-
</div>
|
|
499
|
-
</div>
|
|
500
|
-
</div>
|
|
501
|
-
</div>
|
|
502
|
-
<div class="location-section">
|
|
503
|
-
<div aria-hidden="true" role="img" class="icon-text-dental"></div>
|
|
504
|
-
<div>
|
|
505
|
-
<p class="p-small">Test Address 123</p>
|
|
506
|
-
<p class="p-small text-dental-blue-3">Test District</p>
|
|
507
|
-
</div>
|
|
508
|
-
</div>
|
|
509
|
-
</div>
|
|
510
|
-
</div>
|
|
511
|
-
<hr />
|
|
512
|
-
</div>
|
|
513
|
-
</a>
|
|
514
|
-
<div class="card-footer">
|
|
515
|
-
<div role="group" aria-label="Appointment actions" class="actions-grid">
|
|
516
|
-
<button type="button" aria-label="Cancel appointment">Termin stornieren</button>
|
|
517
|
-
<button type="button" aria-label="Reschedule appointment">Termin verschieben</button>
|
|
518
|
-
</div>
|
|
519
|
-
</div>
|
|
520
|
-
</div>
|
|
521
|
-
`;
|
|
522
|
-
document.body.appendChild(testContainer);
|
|
523
|
-
});
|
|
524
|
-
|
|
525
|
-
// Run automated accessibility scan
|
|
526
|
-
try {
|
|
527
|
-
const accessibilityScanResults = await new AxeBuilder({ page })
|
|
528
|
-
.include('[data-testid="appointment-card-test"]')
|
|
529
|
-
.analyze();
|
|
530
|
-
|
|
531
|
-
expect(accessibilityScanResults.violations).toEqual([]);
|
|
532
|
-
} catch (error) {
|
|
533
|
-
// Fallback to manual checks if axe-core is not available
|
|
534
|
-
await expect(page.locator('[data-testid="appointment-card-test"]')).toBeVisible();
|
|
535
|
-
}
|
|
536
|
-
});
|
|
537
|
-
|
|
538
|
-
test('action buttons are keyboard accessible', async ({ page }) => {
|
|
539
|
-
await page.goto('http://localhost:7000');
|
|
540
|
-
|
|
541
|
-
await page.evaluate(() => {
|
|
542
|
-
const testContainer = document.createElement('div');
|
|
543
|
-
testContainer.innerHTML = `
|
|
544
|
-
<div class="actions-grid">
|
|
545
|
-
<button type="button" tabindex="0" aria-label="Cancel appointment" id="cancel-btn">Termin stornieren</button>
|
|
546
|
-
<button type="button" tabindex="0" aria-label="Reschedule appointment" id="reschedule-btn">Termin verschieben</button>
|
|
547
|
-
<button type="button" tabindex="0" aria-label="Confirm appointment" id="confirm-btn">Termin bestätigen</button>
|
|
548
|
-
</div>
|
|
549
|
-
`;
|
|
550
|
-
document.body.appendChild(testContainer);
|
|
551
|
-
});
|
|
552
|
-
|
|
553
|
-
// Test keyboard navigation
|
|
554
|
-
const cancelButton = page.locator('#cancel-btn');
|
|
555
|
-
const rescheduleButton = page.locator('#reschedule-btn');
|
|
556
|
-
const confirmButton = page.locator('#confirm-btn');
|
|
557
|
-
|
|
558
|
-
// Focus first button
|
|
559
|
-
await cancelButton.focus();
|
|
560
|
-
await expect(cancelButton).toBeFocused();
|
|
561
|
-
|
|
562
|
-
// Tab to next button
|
|
563
|
-
await page.keyboard.press('Tab');
|
|
564
|
-
await expect(rescheduleButton).toBeFocused();
|
|
565
|
-
|
|
566
|
-
// Tab to confirm button
|
|
567
|
-
await page.keyboard.press('Tab');
|
|
568
|
-
await expect(confirmButton).toBeFocused();
|
|
569
|
-
|
|
570
|
-
// Shift+Tab to go back
|
|
571
|
-
await page.keyboard.press('Shift+Tab');
|
|
572
|
-
await expect(rescheduleButton).toBeFocused();
|
|
573
|
-
|
|
574
|
-
// Test activation with keyboard
|
|
575
|
-
await page.keyboard.press('Enter');
|
|
576
|
-
await page.keyboard.press('Space');
|
|
577
|
-
});
|
|
578
|
-
|
|
579
|
-
test('readonly/disabled buttons have correct accessibility attributes', async ({ page }) => {
|
|
580
|
-
await page.goto('http://localhost:7000');
|
|
581
|
-
|
|
582
|
-
await page.evaluate(() => {
|
|
583
|
-
const testContainer = document.createElement('div');
|
|
584
|
-
testContainer.innerHTML = `
|
|
585
|
-
<button type="button" aria-disabled="true" tabindex="-1" aria-label="Appointment cancelled">Termin storniert</button>
|
|
586
|
-
`;
|
|
587
|
-
document.body.appendChild(testContainer);
|
|
588
|
-
});
|
|
589
|
-
|
|
590
|
-
const disabledButton = page.locator('button[aria-disabled="true"]');
|
|
591
|
-
await expect(disabledButton).toHaveAttribute('aria-disabled', 'true');
|
|
592
|
-
await expect(disabledButton).toHaveAttribute('tabindex', '-1');
|
|
593
|
-
});
|
|
594
|
-
|
|
595
|
-
test('images have appropriate alt text', async ({ page }) => {
|
|
596
|
-
await page.goto('http://localhost:7000');
|
|
597
|
-
|
|
598
|
-
await page.evaluate(() => {
|
|
599
|
-
const testContainer = document.createElement('div');
|
|
600
|
-
testContainer.innerHTML = `
|
|
601
|
-
<div class="dentist-section">
|
|
602
|
-
<img src="https://example.com/dentist.jpg" alt="Dentist photo" class="dentist-image" />
|
|
603
|
-
<img src="https://example.com/dentist2.jpg" alt="Dentist photo" class="dentist-image" />
|
|
604
|
-
</div>
|
|
605
|
-
`;
|
|
606
|
-
document.body.appendChild(testContainer);
|
|
607
|
-
});
|
|
608
|
-
|
|
609
|
-
const images = page.locator('.dentist-image');
|
|
610
|
-
const imageCount = await images.count();
|
|
611
|
-
|
|
612
|
-
for (let i = 0; i < imageCount; i++) {
|
|
613
|
-
const image = images.nth(i);
|
|
614
|
-
await expect(image).toHaveAttribute('alt', 'Dentist photo');
|
|
615
|
-
}
|
|
616
|
-
});
|
|
617
|
-
|
|
618
|
-
test('icons are properly hidden from screen readers', async ({ page }) => {
|
|
619
|
-
await page.goto('http://localhost:7000');
|
|
620
|
-
|
|
621
|
-
await page.evaluate(() => {
|
|
622
|
-
const testContainer = document.createElement('div');
|
|
623
|
-
testContainer.innerHTML = `
|
|
624
|
-
<div class="card-header">
|
|
625
|
-
<div class="header-item">
|
|
626
|
-
<div aria-hidden="true" role="img" class="header-icon"></div>
|
|
627
|
-
<p>Content with icon</p>
|
|
628
|
-
</div>
|
|
629
|
-
</div>
|
|
630
|
-
<div class="location-section">
|
|
631
|
-
<div aria-hidden="true" role="img" class="icon-text-dental"></div>
|
|
632
|
-
<div>
|
|
633
|
-
<p class="p-small">Location text</p>
|
|
634
|
-
</div>
|
|
635
|
-
</div>
|
|
636
|
-
`;
|
|
637
|
-
document.body.appendChild(testContainer);
|
|
638
|
-
});
|
|
639
|
-
|
|
640
|
-
const decorativeIcons = page.locator('[aria-hidden="true"][role="img"]');
|
|
641
|
-
const iconCount = await decorativeIcons.count();
|
|
642
|
-
|
|
643
|
-
for (let i = 0; i < iconCount; i++) {
|
|
644
|
-
const icon = decorativeIcons.nth(i);
|
|
645
|
-
await expect(icon).toHaveAttribute('aria-hidden', 'true');
|
|
646
|
-
await expect(icon).toHaveAttribute('role', 'img');
|
|
647
|
-
}
|
|
648
|
-
});
|
|
649
|
-
|
|
650
|
-
test('color contrast meets WCAG standards', async ({ page }) => {
|
|
651
|
-
await page.goto('http://localhost:7000');
|
|
652
|
-
|
|
653
|
-
await page.evaluate(() => {
|
|
654
|
-
const testContainer = document.createElement('div');
|
|
655
|
-
testContainer.innerHTML = `
|
|
656
|
-
<div class="card-header header-bg-normal">
|
|
657
|
-
<p style="color: #333; background-color: #fff;">Normal text</p>
|
|
658
|
-
</div>
|
|
659
|
-
<div class="card-header header-bg-cancelled">
|
|
660
|
-
<p style="color: #721c24; background-color: #f8d7da;">Cancelled text</p>
|
|
661
|
-
</div>
|
|
662
|
-
<p class="text-dental-blue-3" style="color: #0066cc;">Blue text</p>
|
|
663
|
-
`;
|
|
664
|
-
document.body.appendChild(testContainer);
|
|
665
|
-
});
|
|
666
|
-
|
|
667
|
-
// Test that text is visible and readable
|
|
668
|
-
await expect(page.locator('.card-header p').first()).toBeVisible();
|
|
669
|
-
await expect(page.locator('.text-dental-blue-3')).toBeVisible();
|
|
670
|
-
|
|
671
|
-
// Get computed styles to verify contrast
|
|
672
|
-
const textStyles = await page.locator('.card-header p').first().evaluate((el) => {
|
|
673
|
-
const computed = window.getComputedStyle(el);
|
|
674
|
-
return {
|
|
675
|
-
color: computed.color,
|
|
676
|
-
backgroundColor: computed.backgroundColor,
|
|
677
|
-
};
|
|
678
|
-
});
|
|
679
|
-
|
|
680
|
-
expect(textStyles.color).toBeTruthy();
|
|
681
|
-
expect(textStyles.backgroundColor).toBeTruthy();
|
|
682
|
-
});
|
|
683
|
-
|
|
684
|
-
test('heading hierarchy is logical', async ({ page }) => {
|
|
685
|
-
await page.goto('http://localhost:7000');
|
|
686
|
-
|
|
687
|
-
await page.evaluate(() => {
|
|
688
|
-
const testContainer = document.createElement('div');
|
|
689
|
-
testContainer.innerHTML = `
|
|
690
|
-
<article>
|
|
691
|
-
<h2 id="appointment-title">Test Treatment</h2>
|
|
692
|
-
<div class="card-body">
|
|
693
|
-
<p>Appointment details...</p>
|
|
694
|
-
</div>
|
|
695
|
-
</article>
|
|
696
|
-
`;
|
|
697
|
-
document.body.appendChild(testContainer);
|
|
698
|
-
});
|
|
699
|
-
|
|
700
|
-
const heading = page.locator('h2#appointment-title');
|
|
701
|
-
await expect(heading).toBeVisible();
|
|
702
|
-
await expect(heading).toHaveText('Test Treatment');
|
|
703
|
-
|
|
704
|
-
// Verify heading hierarchy (h2 is appropriate for appointment titles)
|
|
705
|
-
const headingLevel = await heading.evaluate(el => el.tagName.toLowerCase());
|
|
706
|
-
expect(headingLevel).toBe('h2');
|
|
707
|
-
});
|
|
708
|
-
|
|
709
|
-
test('semantic HTML structure is appropriate', async ({ page }) => {
|
|
710
|
-
await page.goto('http://localhost:7000');
|
|
711
|
-
|
|
712
|
-
await page.evaluate(() => {
|
|
713
|
-
const testContainer = document.createElement('div');
|
|
714
|
-
testContainer.innerHTML = `
|
|
715
|
-
<article role="article" aria-labelledby="appointment-title">
|
|
716
|
-
<a href="#" class="appointment-card">
|
|
717
|
-
<header class="card-header">
|
|
718
|
-
<h2 id="appointment-title">Appointment</h2>
|
|
719
|
-
</header>
|
|
720
|
-
<main class="card-body">
|
|
721
|
-
<section role="region" aria-label="Appointment details">
|
|
722
|
-
Details content
|
|
723
|
-
</section>
|
|
724
|
-
</main>
|
|
725
|
-
</a>
|
|
726
|
-
<footer class="card-footer">
|
|
727
|
-
<div role="group" aria-label="Appointment actions">
|
|
728
|
-
Actions content
|
|
729
|
-
</div>
|
|
730
|
-
</footer>
|
|
731
|
-
</article>
|
|
732
|
-
`;
|
|
733
|
-
document.body.appendChild(testContainer);
|
|
734
|
-
});
|
|
735
|
-
|
|
736
|
-
// Verify semantic structure
|
|
737
|
-
await expect(page.locator('[role="article"]')).toBeVisible();
|
|
738
|
-
await expect(page.locator('header.card-header')).toBeVisible();
|
|
739
|
-
await expect(page.locator('main.card-body')).toBeVisible();
|
|
740
|
-
await expect(page.locator('footer.card-footer')).toBeVisible();
|
|
741
|
-
await expect(page.locator('[role="region"][aria-label="Appointment details"]')).toBeVisible();
|
|
742
|
-
await expect(page.locator('[role="group"][aria-label="Appointment actions"]')).toBeVisible();
|
|
743
|
-
});
|
|
744
|
-
|
|
745
|
-
test('focus management works correctly', async ({ page }) => {
|
|
746
|
-
await page.goto('http://localhost:7000');
|
|
747
|
-
|
|
748
|
-
await page.evaluate(() => {
|
|
749
|
-
const testContainer = document.createElement('div');
|
|
750
|
-
testContainer.innerHTML = `
|
|
751
|
-
<a href="#" class="appointment-card" id="card-link">
|
|
752
|
-
<div class="card-header">
|
|
753
|
-
<p>Appointment Card Link</p>
|
|
754
|
-
</div>
|
|
755
|
-
</a>
|
|
756
|
-
<div class="actions-grid">
|
|
757
|
-
<button type="button" id="action1">Action 1</button>
|
|
758
|
-
<button type="button" id="action2">Action 2</button>
|
|
759
|
-
</div>
|
|
760
|
-
`;
|
|
761
|
-
document.body.appendChild(testContainer);
|
|
762
|
-
});
|
|
763
|
-
|
|
764
|
-
// Test focus on card link
|
|
765
|
-
const cardLink = page.locator('#card-link');
|
|
766
|
-
await cardLink.focus();
|
|
767
|
-
await expect(cardLink).toBeFocused();
|
|
768
|
-
|
|
769
|
-
// Test focus on action buttons
|
|
770
|
-
const action1 = page.locator('#action1');
|
|
771
|
-
const action2 = page.locator('#action2');
|
|
772
|
-
|
|
773
|
-
await action1.focus();
|
|
774
|
-
await expect(action1).toBeFocused();
|
|
775
|
-
|
|
776
|
-
await page.keyboard.press('Tab');
|
|
777
|
-
await expect(action2).toBeFocused();
|
|
778
|
-
});
|
|
779
|
-
|
|
780
|
-
test('appointment status changes are conveyed accessibly', async ({ page }) => {
|
|
781
|
-
await page.goto('http://localhost:7000');
|
|
782
|
-
|
|
783
|
-
await page.evaluate(() => {
|
|
784
|
-
const testContainer = document.createElement('div');
|
|
785
|
-
testContainer.innerHTML = `
|
|
786
|
-
<div class="appointment-card" data-status="upcoming">
|
|
787
|
-
<div class="card-header header-bg-normal">
|
|
788
|
-
<span class="sr-only">Upcoming appointment</span>
|
|
789
|
-
<p>Normal appointment</p>
|
|
790
|
-
</div>
|
|
791
|
-
</div>
|
|
792
|
-
<div class="appointment-card card-opacity" data-status="past">
|
|
793
|
-
<div class="card-header">
|
|
794
|
-
<span class="sr-only">Past appointment</span>
|
|
795
|
-
<p>Past appointment</p>
|
|
796
|
-
</div>
|
|
797
|
-
</div>
|
|
798
|
-
<div class="appointment-card" data-status="cancelled">
|
|
799
|
-
<div class="card-header header-bg-cancelled">
|
|
800
|
-
<span class="sr-only">Cancelled appointment</span>
|
|
801
|
-
<p>Cancelled appointment</p>
|
|
802
|
-
</div>
|
|
803
|
-
</div>
|
|
804
|
-
`;
|
|
805
|
-
document.body.appendChild(testContainer);
|
|
806
|
-
});
|
|
807
|
-
|
|
808
|
-
// Verify visual status indicators
|
|
809
|
-
await expect(page.locator('[data-status="upcoming"] .header-bg-normal')).toBeVisible();
|
|
810
|
-
await expect(page.locator('[data-status="past"].card-opacity')).toBeVisible();
|
|
811
|
-
await expect(page.locator('[data-status="cancelled"] .header-bg-cancelled')).toBeVisible();
|
|
812
|
-
|
|
813
|
-
// Note: Screen reader text would be tested with actual screen reader testing tools
|
|
814
|
-
await expect(page.locator('.sr-only')).toHaveCount(3);
|
|
815
|
-
});
|
|
816
|
-
});
|
|
1
|
+
import { test, expect } from '@playwright/test';
|
|
2
|
+
import AxeBuilder from '@axe-core/playwright';
|
|
3
|
+
|
|
4
|
+
test.describe('Appointment Card Component', () => {
|
|
5
|
+
async function getFrame(page) {
|
|
6
|
+
await page.waitForSelector('#storybook-preview-iframe', { timeout: 30000 });
|
|
7
|
+
const frame = page.frame({ url: /iframe\.html/ });
|
|
8
|
+
if (!frame) throw new Error('Frame not found');
|
|
9
|
+
await frame.waitForSelector('body', { timeout: 30000, state: 'attached' });
|
|
10
|
+
await page.waitForTimeout(1000);
|
|
11
|
+
return frame;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
test.describe('Appointment Card Structure and Display', () => {
|
|
15
|
+
test('renders appointment card with all sections', async ({ page }) => {
|
|
16
|
+
// Since there's no specific story for the new Card component, we'll test it through direct component mounting
|
|
17
|
+
await page.goto('http://localhost:7000');
|
|
18
|
+
|
|
19
|
+
// Create a test page that mounts our component
|
|
20
|
+
await page.evaluate(() => {
|
|
21
|
+
const testContainer = document.createElement('div');
|
|
22
|
+
testContainer.id = 'test-appointment-card';
|
|
23
|
+
testContainer.innerHTML = `
|
|
24
|
+
<div data-testid="root">
|
|
25
|
+
<a href="#" class="appointment-card">
|
|
26
|
+
<div>
|
|
27
|
+
<div class="card-header header-bg-normal">
|
|
28
|
+
<div class="header-item">
|
|
29
|
+
<div class="header-icon"></div>
|
|
30
|
+
<p>John Doe</p>
|
|
31
|
+
</div>
|
|
32
|
+
<div class="header-item">
|
|
33
|
+
<div class="header-icon"></div>
|
|
34
|
+
<p>Mon, 15 Jan 2024</p>
|
|
35
|
+
</div>
|
|
36
|
+
<div class="header-item">
|
|
37
|
+
<div class="header-icon"></div>
|
|
38
|
+
<p>10:30</p>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
<div class="card-body">
|
|
42
|
+
<h2>Test Treatment</h2>
|
|
43
|
+
<div class="details-stub">Details Component</div>
|
|
44
|
+
<hr />
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</a>
|
|
48
|
+
<div class="card-footer">
|
|
49
|
+
<div class="actions-stub">Actions Component</div>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
`;
|
|
53
|
+
document.body.appendChild(testContainer);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
await expect(page.locator('[data-testid="root"]')).toBeVisible();
|
|
57
|
+
await expect(page.locator('.appointment-card')).toBeVisible();
|
|
58
|
+
await expect(page.locator('.card-header')).toBeVisible();
|
|
59
|
+
await expect(page.locator('.card-body')).toBeVisible();
|
|
60
|
+
await expect(page.locator('.card-footer')).toBeVisible();
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test('displays patient information correctly', async ({ page }) => {
|
|
64
|
+
await page.goto('http://localhost:7000');
|
|
65
|
+
|
|
66
|
+
await page.evaluate(() => {
|
|
67
|
+
const testContainer = document.createElement('div');
|
|
68
|
+
testContainer.innerHTML = `
|
|
69
|
+
<div class="appointment-card">
|
|
70
|
+
<div class="card-header">
|
|
71
|
+
<div class="header-item">
|
|
72
|
+
<p>Jane Smith</p>
|
|
73
|
+
</div>
|
|
74
|
+
<div class="header-item">
|
|
75
|
+
<p>Tue, 20 Feb 2024</p>
|
|
76
|
+
</div>
|
|
77
|
+
<div class="header-item">
|
|
78
|
+
<p>14:15</p>
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
`;
|
|
83
|
+
document.body.appendChild(testContainer);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
await expect(page.locator('.appointment-card')).toContainText('Jane Smith');
|
|
87
|
+
await expect(page.locator('.appointment-card')).toContainText('Tue, 20 Feb 2024');
|
|
88
|
+
await expect(page.locator('.appointment-card')).toContainText('14:15');
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test('displays default patient name when none provided', async ({ page }) => {
|
|
92
|
+
await page.goto('http://localhost:7000');
|
|
93
|
+
|
|
94
|
+
await page.evaluate(() => {
|
|
95
|
+
const testContainer = document.createElement('div');
|
|
96
|
+
testContainer.innerHTML = `
|
|
97
|
+
<div class="appointment-card">
|
|
98
|
+
<div class="card-header">
|
|
99
|
+
<div class="header-item">
|
|
100
|
+
<p>Unbekannter Patient</p>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
`;
|
|
105
|
+
document.body.appendChild(testContainer);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
await expect(page.locator('.appointment-card')).toContainText('Unbekannter Patient');
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test.describe('Appointment Card Status Styling', () => {
|
|
113
|
+
test('applies normal styling for upcoming appointments', async ({ page }) => {
|
|
114
|
+
await page.goto('http://localhost:7000');
|
|
115
|
+
|
|
116
|
+
await page.evaluate(() => {
|
|
117
|
+
const testContainer = document.createElement('div');
|
|
118
|
+
testContainer.innerHTML = `
|
|
119
|
+
<div class="card-header header-bg-normal">
|
|
120
|
+
<p>Upcoming Appointment</p>
|
|
121
|
+
</div>
|
|
122
|
+
`;
|
|
123
|
+
document.body.appendChild(testContainer);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
await expect(page.locator('.card-header')).toHaveClass(/header-bg-normal/);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
test('applies cancelled styling for cancelled appointments', async ({ page }) => {
|
|
130
|
+
await page.goto('http://localhost:7000');
|
|
131
|
+
|
|
132
|
+
await page.evaluate(() => {
|
|
133
|
+
const testContainer = document.createElement('div');
|
|
134
|
+
testContainer.innerHTML = `
|
|
135
|
+
<div class="card-header header-bg-cancelled">
|
|
136
|
+
<p>Cancelled Appointment</p>
|
|
137
|
+
</div>
|
|
138
|
+
`;
|
|
139
|
+
document.body.appendChild(testContainer);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
await expect(page.locator('.card-header')).toHaveClass(/header-bg-cancelled/);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
test('applies opacity styling for past appointments', async ({ page }) => {
|
|
146
|
+
await page.goto('http://localhost:7000');
|
|
147
|
+
|
|
148
|
+
await page.evaluate(() => {
|
|
149
|
+
const testContainer = document.createElement('div');
|
|
150
|
+
testContainer.innerHTML = `
|
|
151
|
+
<div class="card-opacity">
|
|
152
|
+
<p>Past Appointment</p>
|
|
153
|
+
</div>
|
|
154
|
+
`;
|
|
155
|
+
document.body.appendChild(testContainer);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
await expect(page.locator('.card-opacity')).toBeVisible();
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
test.describe('Appointment Card Actions', () => {
|
|
163
|
+
test('displays action buttons for upcoming appointments', async ({ page }) => {
|
|
164
|
+
await page.goto('http://localhost:7000');
|
|
165
|
+
|
|
166
|
+
await page.evaluate(() => {
|
|
167
|
+
const testContainer = document.createElement('div');
|
|
168
|
+
testContainer.innerHTML = `
|
|
169
|
+
<div class="actions-grid">
|
|
170
|
+
<button class="action-button">Termin stornieren</button>
|
|
171
|
+
<button class="action-button">Termin verschieben</button>
|
|
172
|
+
</div>
|
|
173
|
+
<button class="full-width-button">Termin bestätigen</button>
|
|
174
|
+
`;
|
|
175
|
+
document.body.appendChild(testContainer);
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
await expect(page.locator('.actions-grid')).toBeVisible();
|
|
179
|
+
await expect(page.locator('button:text("Termin stornieren")')).toBeVisible();
|
|
180
|
+
await expect(page.locator('button:text("Termin verschieben")')).toBeVisible();
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
test('shows rebook button for past appointments', async ({ page }) => {
|
|
184
|
+
await page.goto('http://localhost:7000');
|
|
185
|
+
|
|
186
|
+
await page.evaluate(() => {
|
|
187
|
+
const testContainer = document.createElement('div');
|
|
188
|
+
testContainer.innerHTML = `
|
|
189
|
+
<button class="full-width-button-opacity">Diesen Termin nochmal buchen</button>
|
|
190
|
+
`;
|
|
191
|
+
document.body.appendChild(testContainer);
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
await expect(page.locator('button:text("Diesen Termin nochmal buchen")')).toBeVisible();
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
test('shows cancelled status for cancelled appointments', async ({ page }) => {
|
|
198
|
+
await page.goto('http://localhost:7000');
|
|
199
|
+
|
|
200
|
+
await page.evaluate(() => {
|
|
201
|
+
const testContainer = document.createElement('div');
|
|
202
|
+
testContainer.innerHTML = `
|
|
203
|
+
<button class="full-width-button-opacity" readonly>Termin storniert</button>
|
|
204
|
+
`;
|
|
205
|
+
document.body.appendChild(testContainer);
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
const cancelledButton = page.locator('button:text("Termin storniert")');
|
|
209
|
+
await expect(cancelledButton).toBeVisible();
|
|
210
|
+
await expect(cancelledButton).toHaveAttribute('readonly');
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
test('can click action buttons', async ({ page }) => {
|
|
214
|
+
await page.goto('http://localhost:7000');
|
|
215
|
+
|
|
216
|
+
await page.evaluate(() => {
|
|
217
|
+
const testContainer = document.createElement('div');
|
|
218
|
+
testContainer.innerHTML = `
|
|
219
|
+
<div class="actions-grid">
|
|
220
|
+
<button class="action-button" id="cancel-btn">Termin stornieren</button>
|
|
221
|
+
<button class="action-button" id="reschedule-btn">Termin verschieben</button>
|
|
222
|
+
</div>
|
|
223
|
+
`;
|
|
224
|
+
document.body.appendChild(testContainer);
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
const cancelButton = page.locator('#cancel-btn');
|
|
228
|
+
const rescheduleButton = page.locator('#reschedule-btn');
|
|
229
|
+
|
|
230
|
+
await expect(cancelButton).toBeVisible();
|
|
231
|
+
await expect(rescheduleButton).toBeVisible();
|
|
232
|
+
|
|
233
|
+
await cancelButton.click();
|
|
234
|
+
await rescheduleButton.click();
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
test.describe('Appointment Card Details', () => {
|
|
239
|
+
test('displays dentist information', async ({ page }) => {
|
|
240
|
+
await page.goto('http://localhost:7000');
|
|
241
|
+
|
|
242
|
+
await page.evaluate(() => {
|
|
243
|
+
const testContainer = document.createElement('div');
|
|
244
|
+
testContainer.innerHTML = `
|
|
245
|
+
<div class="details-grid">
|
|
246
|
+
<div class="dentist-section">
|
|
247
|
+
<div class="dentist-list">
|
|
248
|
+
<div class="dentist-item">
|
|
249
|
+
<img src="https://example.com/dentist.jpg" alt="Dentist photo" class="dentist-image" />
|
|
250
|
+
<div class="dentist-info">
|
|
251
|
+
<p class="p-small">Dr. Test Dentist</p>
|
|
252
|
+
<p class="p-small text-dental-blue-3">Male</p>
|
|
253
|
+
</div>
|
|
254
|
+
</div>
|
|
255
|
+
</div>
|
|
256
|
+
</div>
|
|
257
|
+
</div>
|
|
258
|
+
`;
|
|
259
|
+
document.body.appendChild(testContainer);
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
await expect(page.locator('.dentist-section')).toBeVisible();
|
|
263
|
+
await expect(page.locator('.dentist-image')).toBeVisible();
|
|
264
|
+
await expect(page.locator('.details-grid')).toContainText('Dr. Test Dentist');
|
|
265
|
+
await expect(page.locator('.details-grid')).toContainText('Male');
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
test('displays location information', async ({ page }) => {
|
|
269
|
+
await page.goto('http://localhost:7000');
|
|
270
|
+
|
|
271
|
+
await page.evaluate(() => {
|
|
272
|
+
const testContainer = document.createElement('div');
|
|
273
|
+
testContainer.innerHTML = `
|
|
274
|
+
<div class="details-grid">
|
|
275
|
+
<div class="location-section">
|
|
276
|
+
<div class="icon-text-dental"></div>
|
|
277
|
+
<div>
|
|
278
|
+
<p class="p-small">Test Address 123</p>
|
|
279
|
+
<p class="p-small text-dental-blue-3">Test District</p>
|
|
280
|
+
</div>
|
|
281
|
+
</div>
|
|
282
|
+
</div>
|
|
283
|
+
`;
|
|
284
|
+
document.body.appendChild(testContainer);
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
await expect(page.locator('.location-section')).toBeVisible();
|
|
288
|
+
await expect(page.locator('.details-grid')).toContainText('Test Address 123');
|
|
289
|
+
await expect(page.locator('.details-grid')).toContainText('Test District');
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
test('displays default location when not provided', async ({ page }) => {
|
|
293
|
+
await page.goto('http://localhost:7000');
|
|
294
|
+
|
|
295
|
+
await page.evaluate(() => {
|
|
296
|
+
const testContainer = document.createElement('div');
|
|
297
|
+
testContainer.innerHTML = `
|
|
298
|
+
<div class="details-grid">
|
|
299
|
+
<div class="location-section">
|
|
300
|
+
<div>
|
|
301
|
+
<p class="p-small">Unbekannter Ort</p>
|
|
302
|
+
<p class="p-small text-dental-blue-3">Unbekannter Stadtteil</p>
|
|
303
|
+
</div>
|
|
304
|
+
</div>
|
|
305
|
+
</div>
|
|
306
|
+
`;
|
|
307
|
+
document.body.appendChild(testContainer);
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
await expect(page.locator('.location-section')).toContainText('Unbekannter Ort');
|
|
311
|
+
await expect(page.locator('.location-section')).toContainText('Unbekannter Stadtteil');
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
test.describe('Appointment Card Layout and Styling', () => {
|
|
316
|
+
test('has proper layout structure', async ({ page }) => {
|
|
317
|
+
await page.goto('http://localhost:7000');
|
|
318
|
+
|
|
319
|
+
await page.evaluate(() => {
|
|
320
|
+
const testContainer = document.createElement('div');
|
|
321
|
+
testContainer.innerHTML = `
|
|
322
|
+
<div data-testid="root">
|
|
323
|
+
<a href="#" class="appointment-card">
|
|
324
|
+
<div class="card-header"></div>
|
|
325
|
+
<div class="card-body">
|
|
326
|
+
<hr />
|
|
327
|
+
</div>
|
|
328
|
+
</a>
|
|
329
|
+
<div class="card-footer"></div>
|
|
330
|
+
</div>
|
|
331
|
+
`;
|
|
332
|
+
document.body.appendChild(testContainer);
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
await expect(page.locator('[data-testid="root"]')).toBeVisible();
|
|
336
|
+
await expect(page.locator('.appointment-card')).toBeVisible();
|
|
337
|
+
await expect(page.locator('hr')).toBeVisible();
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
test('applies correct CSS classes', async ({ page }) => {
|
|
341
|
+
await page.goto('http://localhost:7000');
|
|
342
|
+
|
|
343
|
+
await page.evaluate(() => {
|
|
344
|
+
const testContainer = document.createElement('div');
|
|
345
|
+
testContainer.innerHTML = `
|
|
346
|
+
<div class="actions-grid">
|
|
347
|
+
<button class="action-button">Button 1</button>
|
|
348
|
+
<button class="action-button">Button 2</button>
|
|
349
|
+
</div>
|
|
350
|
+
`;
|
|
351
|
+
document.body.appendChild(testContainer);
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
await expect(page.locator('.actions-grid')).toBeVisible();
|
|
355
|
+
await expect(page.locator('.action-button').first()).toBeVisible();
|
|
356
|
+
await expect(page.locator('.action-button').last()).toBeVisible();
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
test.describe('Accessibility', () => {
|
|
361
|
+
test('has proper link attributes', async ({ page }) => {
|
|
362
|
+
await page.goto('http://localhost:7000');
|
|
363
|
+
|
|
364
|
+
await page.evaluate(() => {
|
|
365
|
+
const testContainer = document.createElement('div');
|
|
366
|
+
testContainer.innerHTML = `
|
|
367
|
+
<a href="https://example.com/appointment/123" rel="noopener noreferrer" class="appointment-card">
|
|
368
|
+
Appointment Link
|
|
369
|
+
</a>
|
|
370
|
+
`;
|
|
371
|
+
document.body.appendChild(testContainer);
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
const link = page.locator('.appointment-card');
|
|
375
|
+
await expect(link).toHaveAttribute('href', 'https://example.com/appointment/123');
|
|
376
|
+
await expect(link).toHaveAttribute('rel', 'noopener noreferrer');
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
test('has descriptive test ids and alt text', async ({ page }) => {
|
|
380
|
+
await page.goto('http://localhost:7000');
|
|
381
|
+
|
|
382
|
+
await page.evaluate(() => {
|
|
383
|
+
const testContainer = document.createElement('div');
|
|
384
|
+
testContainer.innerHTML = `
|
|
385
|
+
<div data-testid="root">
|
|
386
|
+
<img src="https://example.com/dentist.jpg" alt="Dentist photo" class="dentist-image" />
|
|
387
|
+
</div>
|
|
388
|
+
`;
|
|
389
|
+
document.body.appendChild(testContainer);
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
await expect(page.locator('[data-testid="root"]')).toBeVisible();
|
|
393
|
+
await expect(page.locator('.dentist-image')).toHaveAttribute('alt', 'Dentist photo');
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
test('buttons are keyboard accessible', async ({ page }) => {
|
|
397
|
+
await page.goto('http://localhost:7000');
|
|
398
|
+
|
|
399
|
+
await page.evaluate(() => {
|
|
400
|
+
const testContainer = document.createElement('div');
|
|
401
|
+
testContainer.innerHTML = `
|
|
402
|
+
<button class="action-button" tabindex="0">Termin stornieren</button>
|
|
403
|
+
<button class="action-button" tabindex="0">Termin verschieben</button>
|
|
404
|
+
`;
|
|
405
|
+
document.body.appendChild(testContainer);
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
const cancelButton = page.locator('button:text("Termin stornieren")');
|
|
409
|
+
const rescheduleButton = page.locator('button:text("Termin verschieben")');
|
|
410
|
+
|
|
411
|
+
await cancelButton.focus();
|
|
412
|
+
await expect(cancelButton).toBeFocused();
|
|
413
|
+
|
|
414
|
+
await page.keyboard.press('Tab');
|
|
415
|
+
await expect(rescheduleButton).toBeFocused();
|
|
416
|
+
});
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
test.describe('Responsive Design', () => {
|
|
420
|
+
test('displays correctly on mobile viewport', async ({ page }) => {
|
|
421
|
+
await page.setViewportSize({ width: 375, height: 667 });
|
|
422
|
+
await page.goto('http://localhost:7000');
|
|
423
|
+
|
|
424
|
+
await page.evaluate(() => {
|
|
425
|
+
const testContainer = document.createElement('div');
|
|
426
|
+
testContainer.innerHTML = `
|
|
427
|
+
<div class="appointment-card" style="width: 100%; max-width: 100%;">
|
|
428
|
+
<div class="actions-grid" style="display: flex; gap: 20px;">
|
|
429
|
+
<button class="action-button" style="flex: 1;">Cancel</button>
|
|
430
|
+
<button class="action-button" style="flex: 1;">Reschedule</button>
|
|
431
|
+
</div>
|
|
432
|
+
</div>
|
|
433
|
+
`;
|
|
434
|
+
document.body.appendChild(testContainer);
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
await expect(page.locator('.appointment-card')).toBeVisible();
|
|
438
|
+
await expect(page.locator('.actions-grid')).toBeVisible();
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
test('displays correctly on tablet viewport', async ({ page }) => {
|
|
442
|
+
await page.setViewportSize({ width: 768, height: 1024 });
|
|
443
|
+
await page.goto('http://localhost:7000');
|
|
444
|
+
|
|
445
|
+
await page.evaluate(() => {
|
|
446
|
+
const testContainer = document.createElement('div');
|
|
447
|
+
testContainer.innerHTML = `
|
|
448
|
+
<div class="appointment-card">
|
|
449
|
+
<div class="card-header">
|
|
450
|
+
<div class="header-item">Patient Name</div>
|
|
451
|
+
<div class="header-item">Date</div>
|
|
452
|
+
<div class="header-item">Time</div>
|
|
453
|
+
</div>
|
|
454
|
+
</div>
|
|
455
|
+
`;
|
|
456
|
+
document.body.appendChild(testContainer);
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
await expect(page.locator('.appointment-card')).toBeVisible();
|
|
460
|
+
await expect(page.locator('.card-header')).toBeVisible();
|
|
461
|
+
});
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
test.describe('Accessibility Tests', () => {
|
|
465
|
+
test('appointment card structure meets accessibility standards', async ({ page }) => {
|
|
466
|
+
await page.goto('http://localhost:7000');
|
|
467
|
+
|
|
468
|
+
await page.evaluate(() => {
|
|
469
|
+
const testContainer = document.createElement('div');
|
|
470
|
+
testContainer.innerHTML = `
|
|
471
|
+
<div data-testid="appointment-card-test" role="article" aria-labelledby="appointment-title">
|
|
472
|
+
<a href="#" class="appointment-card" rel="noopener noreferrer">
|
|
473
|
+
<div class="card-header header-bg-normal">
|
|
474
|
+
<div class="header-item">
|
|
475
|
+
<div aria-hidden="true" role="img" class="header-icon"></div>
|
|
476
|
+
<p>John Doe</p>
|
|
477
|
+
</div>
|
|
478
|
+
<div class="header-item">
|
|
479
|
+
<div aria-hidden="true" role="img" class="header-icon"></div>
|
|
480
|
+
<p>Mon, 15 Jan 2024</p>
|
|
481
|
+
</div>
|
|
482
|
+
<div class="header-item">
|
|
483
|
+
<div aria-hidden="true" role="img" class="header-icon"></div>
|
|
484
|
+
<p>10:30</p>
|
|
485
|
+
</div>
|
|
486
|
+
</div>
|
|
487
|
+
<div class="card-body">
|
|
488
|
+
<h2 id="appointment-title">Test Treatment</h2>
|
|
489
|
+
<div role="region" aria-label="Appointment details">
|
|
490
|
+
<div class="details-grid">
|
|
491
|
+
<div class="dentist-section">
|
|
492
|
+
<div class="dentist-list">
|
|
493
|
+
<div class="dentist-item">
|
|
494
|
+
<img src="https://example.com/dentist.jpg" alt="Dentist photo" class="dentist-image" />
|
|
495
|
+
<div class="dentist-info">
|
|
496
|
+
<p class="p-small">Dr. Test Dentist</p>
|
|
497
|
+
<p class="p-small text-dental-blue-3">Male</p>
|
|
498
|
+
</div>
|
|
499
|
+
</div>
|
|
500
|
+
</div>
|
|
501
|
+
</div>
|
|
502
|
+
<div class="location-section">
|
|
503
|
+
<div aria-hidden="true" role="img" class="icon-text-dental"></div>
|
|
504
|
+
<div>
|
|
505
|
+
<p class="p-small">Test Address 123</p>
|
|
506
|
+
<p class="p-small text-dental-blue-3">Test District</p>
|
|
507
|
+
</div>
|
|
508
|
+
</div>
|
|
509
|
+
</div>
|
|
510
|
+
</div>
|
|
511
|
+
<hr />
|
|
512
|
+
</div>
|
|
513
|
+
</a>
|
|
514
|
+
<div class="card-footer">
|
|
515
|
+
<div role="group" aria-label="Appointment actions" class="actions-grid">
|
|
516
|
+
<button type="button" aria-label="Cancel appointment">Termin stornieren</button>
|
|
517
|
+
<button type="button" aria-label="Reschedule appointment">Termin verschieben</button>
|
|
518
|
+
</div>
|
|
519
|
+
</div>
|
|
520
|
+
</div>
|
|
521
|
+
`;
|
|
522
|
+
document.body.appendChild(testContainer);
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
// Run automated accessibility scan
|
|
526
|
+
try {
|
|
527
|
+
const accessibilityScanResults = await new AxeBuilder({ page })
|
|
528
|
+
.include('[data-testid="appointment-card-test"]')
|
|
529
|
+
.analyze();
|
|
530
|
+
|
|
531
|
+
expect(accessibilityScanResults.violations).toEqual([]);
|
|
532
|
+
} catch (error) {
|
|
533
|
+
// Fallback to manual checks if axe-core is not available
|
|
534
|
+
await expect(page.locator('[data-testid="appointment-card-test"]')).toBeVisible();
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
|
|
538
|
+
test('action buttons are keyboard accessible', async ({ page }) => {
|
|
539
|
+
await page.goto('http://localhost:7000');
|
|
540
|
+
|
|
541
|
+
await page.evaluate(() => {
|
|
542
|
+
const testContainer = document.createElement('div');
|
|
543
|
+
testContainer.innerHTML = `
|
|
544
|
+
<div class="actions-grid">
|
|
545
|
+
<button type="button" tabindex="0" aria-label="Cancel appointment" id="cancel-btn">Termin stornieren</button>
|
|
546
|
+
<button type="button" tabindex="0" aria-label="Reschedule appointment" id="reschedule-btn">Termin verschieben</button>
|
|
547
|
+
<button type="button" tabindex="0" aria-label="Confirm appointment" id="confirm-btn">Termin bestätigen</button>
|
|
548
|
+
</div>
|
|
549
|
+
`;
|
|
550
|
+
document.body.appendChild(testContainer);
|
|
551
|
+
});
|
|
552
|
+
|
|
553
|
+
// Test keyboard navigation
|
|
554
|
+
const cancelButton = page.locator('#cancel-btn');
|
|
555
|
+
const rescheduleButton = page.locator('#reschedule-btn');
|
|
556
|
+
const confirmButton = page.locator('#confirm-btn');
|
|
557
|
+
|
|
558
|
+
// Focus first button
|
|
559
|
+
await cancelButton.focus();
|
|
560
|
+
await expect(cancelButton).toBeFocused();
|
|
561
|
+
|
|
562
|
+
// Tab to next button
|
|
563
|
+
await page.keyboard.press('Tab');
|
|
564
|
+
await expect(rescheduleButton).toBeFocused();
|
|
565
|
+
|
|
566
|
+
// Tab to confirm button
|
|
567
|
+
await page.keyboard.press('Tab');
|
|
568
|
+
await expect(confirmButton).toBeFocused();
|
|
569
|
+
|
|
570
|
+
// Shift+Tab to go back
|
|
571
|
+
await page.keyboard.press('Shift+Tab');
|
|
572
|
+
await expect(rescheduleButton).toBeFocused();
|
|
573
|
+
|
|
574
|
+
// Test activation with keyboard
|
|
575
|
+
await page.keyboard.press('Enter');
|
|
576
|
+
await page.keyboard.press('Space');
|
|
577
|
+
});
|
|
578
|
+
|
|
579
|
+
test('readonly/disabled buttons have correct accessibility attributes', async ({ page }) => {
|
|
580
|
+
await page.goto('http://localhost:7000');
|
|
581
|
+
|
|
582
|
+
await page.evaluate(() => {
|
|
583
|
+
const testContainer = document.createElement('div');
|
|
584
|
+
testContainer.innerHTML = `
|
|
585
|
+
<button type="button" aria-disabled="true" tabindex="-1" aria-label="Appointment cancelled">Termin storniert</button>
|
|
586
|
+
`;
|
|
587
|
+
document.body.appendChild(testContainer);
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
const disabledButton = page.locator('button[aria-disabled="true"]');
|
|
591
|
+
await expect(disabledButton).toHaveAttribute('aria-disabled', 'true');
|
|
592
|
+
await expect(disabledButton).toHaveAttribute('tabindex', '-1');
|
|
593
|
+
});
|
|
594
|
+
|
|
595
|
+
test('images have appropriate alt text', async ({ page }) => {
|
|
596
|
+
await page.goto('http://localhost:7000');
|
|
597
|
+
|
|
598
|
+
await page.evaluate(() => {
|
|
599
|
+
const testContainer = document.createElement('div');
|
|
600
|
+
testContainer.innerHTML = `
|
|
601
|
+
<div class="dentist-section">
|
|
602
|
+
<img src="https://example.com/dentist.jpg" alt="Dentist photo" class="dentist-image" />
|
|
603
|
+
<img src="https://example.com/dentist2.jpg" alt="Dentist photo" class="dentist-image" />
|
|
604
|
+
</div>
|
|
605
|
+
`;
|
|
606
|
+
document.body.appendChild(testContainer);
|
|
607
|
+
});
|
|
608
|
+
|
|
609
|
+
const images = page.locator('.dentist-image');
|
|
610
|
+
const imageCount = await images.count();
|
|
611
|
+
|
|
612
|
+
for (let i = 0; i < imageCount; i++) {
|
|
613
|
+
const image = images.nth(i);
|
|
614
|
+
await expect(image).toHaveAttribute('alt', 'Dentist photo');
|
|
615
|
+
}
|
|
616
|
+
});
|
|
617
|
+
|
|
618
|
+
test('icons are properly hidden from screen readers', async ({ page }) => {
|
|
619
|
+
await page.goto('http://localhost:7000');
|
|
620
|
+
|
|
621
|
+
await page.evaluate(() => {
|
|
622
|
+
const testContainer = document.createElement('div');
|
|
623
|
+
testContainer.innerHTML = `
|
|
624
|
+
<div class="card-header">
|
|
625
|
+
<div class="header-item">
|
|
626
|
+
<div aria-hidden="true" role="img" class="header-icon"></div>
|
|
627
|
+
<p>Content with icon</p>
|
|
628
|
+
</div>
|
|
629
|
+
</div>
|
|
630
|
+
<div class="location-section">
|
|
631
|
+
<div aria-hidden="true" role="img" class="icon-text-dental"></div>
|
|
632
|
+
<div>
|
|
633
|
+
<p class="p-small">Location text</p>
|
|
634
|
+
</div>
|
|
635
|
+
</div>
|
|
636
|
+
`;
|
|
637
|
+
document.body.appendChild(testContainer);
|
|
638
|
+
});
|
|
639
|
+
|
|
640
|
+
const decorativeIcons = page.locator('[aria-hidden="true"][role="img"]');
|
|
641
|
+
const iconCount = await decorativeIcons.count();
|
|
642
|
+
|
|
643
|
+
for (let i = 0; i < iconCount; i++) {
|
|
644
|
+
const icon = decorativeIcons.nth(i);
|
|
645
|
+
await expect(icon).toHaveAttribute('aria-hidden', 'true');
|
|
646
|
+
await expect(icon).toHaveAttribute('role', 'img');
|
|
647
|
+
}
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
test('color contrast meets WCAG standards', async ({ page }) => {
|
|
651
|
+
await page.goto('http://localhost:7000');
|
|
652
|
+
|
|
653
|
+
await page.evaluate(() => {
|
|
654
|
+
const testContainer = document.createElement('div');
|
|
655
|
+
testContainer.innerHTML = `
|
|
656
|
+
<div class="card-header header-bg-normal">
|
|
657
|
+
<p style="color: #333; background-color: #fff;">Normal text</p>
|
|
658
|
+
</div>
|
|
659
|
+
<div class="card-header header-bg-cancelled">
|
|
660
|
+
<p style="color: #721c24; background-color: #f8d7da;">Cancelled text</p>
|
|
661
|
+
</div>
|
|
662
|
+
<p class="text-dental-blue-3" style="color: #0066cc;">Blue text</p>
|
|
663
|
+
`;
|
|
664
|
+
document.body.appendChild(testContainer);
|
|
665
|
+
});
|
|
666
|
+
|
|
667
|
+
// Test that text is visible and readable
|
|
668
|
+
await expect(page.locator('.card-header p').first()).toBeVisible();
|
|
669
|
+
await expect(page.locator('.text-dental-blue-3')).toBeVisible();
|
|
670
|
+
|
|
671
|
+
// Get computed styles to verify contrast
|
|
672
|
+
const textStyles = await page.locator('.card-header p').first().evaluate((el) => {
|
|
673
|
+
const computed = window.getComputedStyle(el);
|
|
674
|
+
return {
|
|
675
|
+
color: computed.color,
|
|
676
|
+
backgroundColor: computed.backgroundColor,
|
|
677
|
+
};
|
|
678
|
+
});
|
|
679
|
+
|
|
680
|
+
expect(textStyles.color).toBeTruthy();
|
|
681
|
+
expect(textStyles.backgroundColor).toBeTruthy();
|
|
682
|
+
});
|
|
683
|
+
|
|
684
|
+
test('heading hierarchy is logical', async ({ page }) => {
|
|
685
|
+
await page.goto('http://localhost:7000');
|
|
686
|
+
|
|
687
|
+
await page.evaluate(() => {
|
|
688
|
+
const testContainer = document.createElement('div');
|
|
689
|
+
testContainer.innerHTML = `
|
|
690
|
+
<article>
|
|
691
|
+
<h2 id="appointment-title">Test Treatment</h2>
|
|
692
|
+
<div class="card-body">
|
|
693
|
+
<p>Appointment details...</p>
|
|
694
|
+
</div>
|
|
695
|
+
</article>
|
|
696
|
+
`;
|
|
697
|
+
document.body.appendChild(testContainer);
|
|
698
|
+
});
|
|
699
|
+
|
|
700
|
+
const heading = page.locator('h2#appointment-title');
|
|
701
|
+
await expect(heading).toBeVisible();
|
|
702
|
+
await expect(heading).toHaveText('Test Treatment');
|
|
703
|
+
|
|
704
|
+
// Verify heading hierarchy (h2 is appropriate for appointment titles)
|
|
705
|
+
const headingLevel = await heading.evaluate(el => el.tagName.toLowerCase());
|
|
706
|
+
expect(headingLevel).toBe('h2');
|
|
707
|
+
});
|
|
708
|
+
|
|
709
|
+
test('semantic HTML structure is appropriate', async ({ page }) => {
|
|
710
|
+
await page.goto('http://localhost:7000');
|
|
711
|
+
|
|
712
|
+
await page.evaluate(() => {
|
|
713
|
+
const testContainer = document.createElement('div');
|
|
714
|
+
testContainer.innerHTML = `
|
|
715
|
+
<article role="article" aria-labelledby="appointment-title">
|
|
716
|
+
<a href="#" class="appointment-card">
|
|
717
|
+
<header class="card-header">
|
|
718
|
+
<h2 id="appointment-title">Appointment</h2>
|
|
719
|
+
</header>
|
|
720
|
+
<main class="card-body">
|
|
721
|
+
<section role="region" aria-label="Appointment details">
|
|
722
|
+
Details content
|
|
723
|
+
</section>
|
|
724
|
+
</main>
|
|
725
|
+
</a>
|
|
726
|
+
<footer class="card-footer">
|
|
727
|
+
<div role="group" aria-label="Appointment actions">
|
|
728
|
+
Actions content
|
|
729
|
+
</div>
|
|
730
|
+
</footer>
|
|
731
|
+
</article>
|
|
732
|
+
`;
|
|
733
|
+
document.body.appendChild(testContainer);
|
|
734
|
+
});
|
|
735
|
+
|
|
736
|
+
// Verify semantic structure
|
|
737
|
+
await expect(page.locator('[role="article"]')).toBeVisible();
|
|
738
|
+
await expect(page.locator('header.card-header')).toBeVisible();
|
|
739
|
+
await expect(page.locator('main.card-body')).toBeVisible();
|
|
740
|
+
await expect(page.locator('footer.card-footer')).toBeVisible();
|
|
741
|
+
await expect(page.locator('[role="region"][aria-label="Appointment details"]')).toBeVisible();
|
|
742
|
+
await expect(page.locator('[role="group"][aria-label="Appointment actions"]')).toBeVisible();
|
|
743
|
+
});
|
|
744
|
+
|
|
745
|
+
test('focus management works correctly', async ({ page }) => {
|
|
746
|
+
await page.goto('http://localhost:7000');
|
|
747
|
+
|
|
748
|
+
await page.evaluate(() => {
|
|
749
|
+
const testContainer = document.createElement('div');
|
|
750
|
+
testContainer.innerHTML = `
|
|
751
|
+
<a href="#" class="appointment-card" id="card-link">
|
|
752
|
+
<div class="card-header">
|
|
753
|
+
<p>Appointment Card Link</p>
|
|
754
|
+
</div>
|
|
755
|
+
</a>
|
|
756
|
+
<div class="actions-grid">
|
|
757
|
+
<button type="button" id="action1">Action 1</button>
|
|
758
|
+
<button type="button" id="action2">Action 2</button>
|
|
759
|
+
</div>
|
|
760
|
+
`;
|
|
761
|
+
document.body.appendChild(testContainer);
|
|
762
|
+
});
|
|
763
|
+
|
|
764
|
+
// Test focus on card link
|
|
765
|
+
const cardLink = page.locator('#card-link');
|
|
766
|
+
await cardLink.focus();
|
|
767
|
+
await expect(cardLink).toBeFocused();
|
|
768
|
+
|
|
769
|
+
// Test focus on action buttons
|
|
770
|
+
const action1 = page.locator('#action1');
|
|
771
|
+
const action2 = page.locator('#action2');
|
|
772
|
+
|
|
773
|
+
await action1.focus();
|
|
774
|
+
await expect(action1).toBeFocused();
|
|
775
|
+
|
|
776
|
+
await page.keyboard.press('Tab');
|
|
777
|
+
await expect(action2).toBeFocused();
|
|
778
|
+
});
|
|
779
|
+
|
|
780
|
+
test('appointment status changes are conveyed accessibly', async ({ page }) => {
|
|
781
|
+
await page.goto('http://localhost:7000');
|
|
782
|
+
|
|
783
|
+
await page.evaluate(() => {
|
|
784
|
+
const testContainer = document.createElement('div');
|
|
785
|
+
testContainer.innerHTML = `
|
|
786
|
+
<div class="appointment-card" data-status="upcoming">
|
|
787
|
+
<div class="card-header header-bg-normal">
|
|
788
|
+
<span class="sr-only">Upcoming appointment</span>
|
|
789
|
+
<p>Normal appointment</p>
|
|
790
|
+
</div>
|
|
791
|
+
</div>
|
|
792
|
+
<div class="appointment-card card-opacity" data-status="past">
|
|
793
|
+
<div class="card-header">
|
|
794
|
+
<span class="sr-only">Past appointment</span>
|
|
795
|
+
<p>Past appointment</p>
|
|
796
|
+
</div>
|
|
797
|
+
</div>
|
|
798
|
+
<div class="appointment-card" data-status="cancelled">
|
|
799
|
+
<div class="card-header header-bg-cancelled">
|
|
800
|
+
<span class="sr-only">Cancelled appointment</span>
|
|
801
|
+
<p>Cancelled appointment</p>
|
|
802
|
+
</div>
|
|
803
|
+
</div>
|
|
804
|
+
`;
|
|
805
|
+
document.body.appendChild(testContainer);
|
|
806
|
+
});
|
|
807
|
+
|
|
808
|
+
// Verify visual status indicators
|
|
809
|
+
await expect(page.locator('[data-status="upcoming"] .header-bg-normal')).toBeVisible();
|
|
810
|
+
await expect(page.locator('[data-status="past"].card-opacity')).toBeVisible();
|
|
811
|
+
await expect(page.locator('[data-status="cancelled"] .header-bg-cancelled')).toBeVisible();
|
|
812
|
+
|
|
813
|
+
// Note: Screen reader text would be tested with actual screen reader testing tools
|
|
814
|
+
await expect(page.locator('.sr-only')).toHaveCount(3);
|
|
815
|
+
});
|
|
816
|
+
});
|
|
817
817
|
});
|