44 */
55
66import { expect , mergeTests } from '@playwright/test'
7- import { test as randomUserTest } from '../support/fixtures/random-user'
8- import { test as appNavigationTest } from '../support/fixtures/navigation'
97import { test as formTest } from '../support/fixtures/form'
8+ import { test as appNavigationTest } from '../support/fixtures/navigation'
9+ import { test as randomUserTest } from '../support/fixtures/random-user'
1010import { test as topBarTest } from '../support/fixtures/topBar'
11- import { FormsView } from '../support/sections/TopBarSection'
1211import { QuestionType } from '../support/sections/QuestionType'
12+ import { FormsView } from '../support/sections/TopBarSection'
1313
1414const test = mergeTests ( randomUserTest , appNavigationTest , formTest , topBarTest )
1515
@@ -41,7 +41,9 @@ test.describe('Accessibility: aria attributes on question inputs', () => {
4141 await expect ( input ) . toHaveAttribute ( 'aria-labelledby' , 'q1_title' )
4242 await expect ( input ) . toHaveAttribute ( 'aria-describedby' , 'q1_desc' )
4343
44- await expect ( page . getByRole ( 'heading' , { name : 'My question' } ) ) . toHaveId ( 'q1_title' )
44+ await expect ( page . getByRole ( 'heading' , { name : 'My question' } ) ) . toHaveId (
45+ 'q1_title' ,
46+ )
4547 await expect ( page . locator ( '#q1_desc' ) ) . toContainText ( 'Some context' )
4648 } )
4749
@@ -113,7 +115,9 @@ test.describe('Accessibility: aria attributes on question inputs', () => {
113115 await expect ( textarea ) . toHaveAttribute ( 'aria-labelledby' , 'q1_title' )
114116 await expect ( textarea ) . toHaveAttribute ( 'aria-describedby' , 'q1_desc' )
115117
116- await expect ( page . getByRole ( 'heading' , { name : 'My long question' } ) ) . toHaveId ( 'q1_title' )
118+ await expect (
119+ page . getByRole ( 'heading' , { name : 'My long question' } ) ,
120+ ) . toHaveId ( 'q1_title' )
117121 await expect ( page . locator ( '#q1_desc' ) ) . toContainText ( 'Please elaborate' )
118122 } )
119123
@@ -140,7 +144,9 @@ test.describe('Accessibility: aria attributes on question inputs', () => {
140144 await expect ( group ) . toHaveAttribute ( 'aria-labelledby' , 'q1_title' )
141145 await expect ( group ) . toHaveAttribute ( 'aria-describedby' , 'q1_desc' )
142146
143- await expect ( page . getByRole ( 'heading' , { name : 'My dropdown question' } ) ) . toHaveId ( 'q1_title' )
147+ await expect (
148+ page . getByRole ( 'heading' , { name : 'My dropdown question' } ) ,
149+ ) . toHaveId ( 'q1_title' )
144150 await expect ( page . locator ( '#q1_desc' ) ) . toContainText ( 'Choose an option' )
145151 } )
146152
@@ -161,12 +167,14 @@ test.describe('Accessibility: aria attributes on question inputs', () => {
161167 await topBar . toggleView ( FormsView . View )
162168
163169 const question = page . getByRole ( 'listitem' , { name : / Q u e s t i o n n u m b e r 1 / } )
164- const input = question . getByRole ( 'textbox' )
170+ const group = question . getByRole ( 'group' ) . first ( )
165171
166- await expect ( input ) . toHaveAttribute ( 'aria-labelledby' , 'q1_title' )
167- await expect ( input ) . toHaveAttribute ( 'aria-describedby' , 'q1_desc' )
172+ await expect ( group ) . toHaveAttribute ( 'aria-labelledby' , 'q1_title' )
173+ await expect ( group ) . toHaveAttribute ( 'aria-describedby' , 'q1_desc' )
168174
169- await expect ( page . getByRole ( 'heading' , { name : 'My date question' } ) ) . toHaveId ( 'q1_title' )
175+ await expect (
176+ page . getByRole ( 'heading' , { name : 'My date question' } ) ,
177+ ) . toHaveId ( 'q1_title' )
170178 await expect ( page . locator ( '#q1_desc' ) ) . toContainText ( 'Pick a date' )
171179 } )
172180
@@ -192,7 +200,9 @@ test.describe('Accessibility: aria attributes on question inputs', () => {
192200 await expect ( fieldset ) . toHaveAttribute ( 'aria-labelledby' , 'q1_title' )
193201 await expect ( fieldset ) . toHaveAttribute ( 'aria-describedby' , 'q1_desc' )
194202
195- await expect ( page . getByRole ( 'heading' , { name : 'Rate your experience' } ) ) . toHaveId ( 'q1_title' )
203+ await expect (
204+ page . getByRole ( 'heading' , { name : 'Rate your experience' } ) ,
205+ ) . toHaveId ( 'q1_title' )
196206 await expect ( page . locator ( '#q1_desc' ) ) . toContainText ( 'From 1 to 5' )
197207 } )
198208
@@ -218,7 +228,9 @@ test.describe('Accessibility: aria attributes on question inputs', () => {
218228 await expect ( group ) . toHaveAttribute ( 'aria-labelledby' , 'q1_title' )
219229 await expect ( group ) . toHaveAttribute ( 'aria-describedby' , 'q1_desc' )
220230
221- await expect ( page . getByRole ( 'heading' , { name : 'My file question' } ) ) . toHaveId ( 'q1_title' )
231+ await expect (
232+ page . getByRole ( 'heading' , { name : 'My file question' } ) ,
233+ ) . toHaveId ( 'q1_title' )
222234 await expect ( page . locator ( '#q1_desc' ) ) . toContainText ( 'Upload your file' )
223235 } )
224236
@@ -244,7 +256,9 @@ test.describe('Accessibility: aria attributes on question inputs', () => {
244256 await expect ( group ) . toHaveAttribute ( 'aria-labelledby' , 'q1_title' )
245257 await expect ( group ) . toHaveAttribute ( 'aria-describedby' , 'q1_desc' )
246258
247- await expect ( page . getByRole ( 'heading' , { name : 'My color question' } ) ) . toHaveId ( 'q1_title' )
259+ await expect (
260+ page . getByRole ( 'heading' , { name : 'My color question' } ) ,
261+ ) . toHaveId ( 'q1_title' )
248262 await expect ( page . locator ( '#q1_desc' ) ) . toContainText ( 'Pick a color' )
249263 } )
250264} )
0 commit comments