@@ -27,109 +27,30 @@ const components = [
2727 } ,
2828] ;
2929
30- describe . each ( components ) (
31- "Perf testing $name component with iterations complexity if '$iterations' and depth complexity of '$depth'" ,
32- ( { component, iterations } ) => {
33- beforeEach ( ( ) => {
34- render ( component ) ;
35- } ) ;
36-
37- it ( "getByRole selector performance" , async ( ) => {
38- for ( const index of Array . from ( { length : iterations } ) . keys ( ) ) {
39- const button = screen . getByRole ( "button" , {
40- name : `Button label ${ index } ` ,
41- } ) ;
42- await userEvent . click ( button ) ;
43- await waitFor ( ( ) =>
44- expect (
45- screen . getByRole ( "paragraph" , {
46- name : `Service label ${ index } ` ,
47- } ) ,
48- ) ,
49- ) ;
50- }
51- } ) ;
52-
53- it ( "getByLabelText selector performance" , async ( ) => {
54- for ( const index of Array . from ( { length : iterations } ) . keys ( ) ) {
55- const button = screen . getByLabelText ( `Button label ${ index } ` ) ;
56- await userEvent . click ( button ) ;
57- await waitFor ( ( ) =>
58- expect ( screen . getByLabelText ( `Service label ${ index } ` ) ) ,
59- ) ;
60- }
61- } ) ;
62-
63- it ( "getByPlaceholderText selector performance" , async ( ) => {
64- for ( const index of Array . from ( { length : iterations } ) . keys ( ) ) {
65- const input = screen . getByPlaceholderText (
66- `Button input placeholder ${ index } ` ,
67- ) ;
68- await userEvent . click ( input ) ;
69- await waitFor ( ( ) =>
70- expect (
71- screen . getByPlaceholderText (
72- `Service textarea placeholder ${ index } ` ,
30+ describe ( "App defaultHidden test" , ( ) => {
31+ // The hidden attribute is only only affecting `ByRole` queries
32+ describe . each ( components ) (
33+ "Perf testing $name component with iterations complexity if '$iterations' and depth complexity of '$depth'" ,
34+ ( { component, iterations } ) => {
35+ beforeEach ( ( ) => {
36+ render ( component ) ;
37+ } ) ;
38+
39+ it ( "getByRole selector performance" , async ( ) => {
40+ for ( const index of Array . from ( { length : iterations } ) . keys ( ) ) {
41+ const button = screen . getByRole ( "button" , {
42+ name : `Button label ${ index } ` ,
43+ } ) ;
44+ await userEvent . click ( button ) ;
45+ await waitFor ( ( ) =>
46+ expect (
47+ screen . getByRole ( "paragraph" , {
48+ name : `Service label ${ index } ` ,
49+ } ) ,
7350 ) ,
74- ) ,
75- ) ;
76- }
77- } ) ;
78-
79- it ( "getByText selector performance" , async ( ) => {
80- for ( const index of Array . from ( { length : iterations } ) . keys ( ) ) {
81- const button = screen . getByText ( `Button text ${ index } ` ) ;
82- await userEvent . click ( button ) ;
83- await waitFor ( ( ) =>
84- expect ( screen . getByText ( `Service text ${ index } ` ) ) . toBeInTheDocument ( ) ,
85- ) ;
86- }
87- } ) ;
88-
89- it ( "getByDisplayValue selector performance" , async ( ) => {
90- for ( const index of Array . from ( { length : iterations } ) . keys ( ) ) {
91- const input = screen . getByDisplayValue ( `Button input value ${ index } ` ) ;
92- await userEvent . click ( input ) ;
93- await waitFor ( ( ) =>
94- expect ( screen . getByDisplayValue ( `Service textarea value ${ index } ` ) ) ,
95- ) ;
96- }
97- } ) ;
98-
99- it ( "getByAltText selector performance" , async ( ) => {
100- for ( const index of Array . from ( { length : iterations } ) . keys ( ) ) {
101- const img = screen . getByAltText ( `Button image alt ${ index } ` ) ;
102- await userEvent . click ( img ) ;
103- await waitFor ( ( ) =>
104- expect (
105- screen . getByAltText ( `Service image alt ${ index } ` ) ,
106- ) . toBeInTheDocument ( ) ,
107- ) ;
108- }
109- } ) ;
110-
111- it ( "getByTitle selector performance" , async ( ) => {
112- for ( const index of Array . from ( { length : iterations } ) . keys ( ) ) {
113- const button = screen . getByTitle ( `Button title ${ index } ` ) ;
114- await userEvent . click ( button ) ;
115- await waitFor ( ( ) =>
116- expect (
117- screen . getByTitle ( `Service title ${ index } ` ) ,
118- ) . toBeInTheDocument ( ) ,
119- ) ;
120- }
121- } ) ;
122-
123- it ( "getByTestId selector performance" , async ( ) => {
124- for ( const index of Array . from ( { length : iterations } ) . keys ( ) ) {
125- const button = screen . getByTestId ( `button-test-id-${ index } ` ) ;
126- await userEvent . click ( button ) ;
127- await waitFor ( ( ) =>
128- expect (
129- screen . getByTestId ( `button-test-id-${ index } ` ) ,
130- ) . toBeInTheDocument ( ) ,
131- ) ;
132- }
133- } ) ;
134- } ,
135- ) ;
51+ ) ;
52+ }
53+ } ) ;
54+ } ,
55+ ) ;
56+ } ) ;
0 commit comments