@@ -9,62 +9,69 @@ test.describe('Download Modal Flow', () => {
99 await expect ( modal ) . toBeVisible ( ) ;
1010
1111 // Should show download header
12- await expect ( page . getByText ( / d o w n l o a d c r y f s / i) ) . toBeVisible ( ) ;
12+ await expect ( modal . getByText ( / d o w n l o a d c r y f s / i) ) . toBeVisible ( ) ;
1313 } ) ;
1414
1515 test ( 'should display OS selection tabs' , async ( { page } ) => {
1616 await page . goto ( '/#download' ) ;
1717
18- await expect ( page . getByText ( 'Ubuntu' ) ) . toBeVisible ( ) ;
19- await expect ( page . getByText ( 'Debian' ) ) . toBeVisible ( ) ;
20- await expect ( page . getByText ( 'Other' ) ) . toBeVisible ( ) ;
18+ const modal = page . locator ( '.modal' ) ;
19+ // Check for tab elements with OS names
20+ await expect ( modal . getByRole ( 'tab' , { name : / u b u n t u / i } ) ) . toBeVisible ( ) ;
21+ await expect ( modal . getByRole ( 'tab' , { name : / d e b i a n / i } ) ) . toBeVisible ( ) ;
22+ await expect ( modal . getByRole ( 'tab' , { name : / o t h e r / i } ) ) . toBeVisible ( ) ;
2123 } ) ;
2224
2325 test ( 'should show Ubuntu instructions by default' , async ( { page } ) => {
2426 await page . goto ( '/#download' ) ;
2527
28+ const modal = page . locator ( '.modal' ) ;
2629 // Ubuntu Easy Install should be visible
27- await expect ( page . getByText ( 'Easy Install' ) ) . toBeVisible ( ) ;
28- await expect ( page . getByText ( / u b u n t u 1 7 .0 4 a n d l a t e r / i) ) . toBeVisible ( ) ;
29- await expect ( page . getByText ( 'sudo apt install cryfs' ) ) . toBeVisible ( ) ;
30+ await expect ( modal . getByText ( 'Easy Install' ) . first ( ) ) . toBeVisible ( ) ;
31+ await expect ( modal . getByText ( / u b u n t u 1 7 .0 4 a n d l a t e r / i) ) . toBeVisible ( ) ;
32+ await expect ( modal . getByText ( 'sudo apt install cryfs' ) . first ( ) ) . toBeVisible ( ) ;
3033 } ) ;
3134
3235 test ( 'should switch to Debian tab' , async ( { page } ) => {
3336 await page . goto ( '/#download' ) ;
3437
35- await page . getByText ( 'Debian' ) . click ( ) ;
38+ const modal = page . locator ( '.modal' ) ;
39+ await modal . getByRole ( 'tab' , { name : / d e b i a n / i } ) . click ( ) ;
3640
3741 // Debian instructions should be visible
38- await expect ( page . getByText ( / d e b i a n s t r e t c h a n d l a t e r / i) ) . toBeVisible ( ) ;
42+ await expect ( modal . getByText ( / d e b i a n s t r e t c h a n d l a t e r / i) ) . toBeVisible ( ) ;
3943 } ) ;
4044
4145 test ( 'should switch to Other tab and show macOS instructions' , async ( { page } ) => {
4246 await page . goto ( '/#download' ) ;
4347
44- await page . getByText ( 'Other' ) . click ( ) ;
48+ const modal = page . locator ( '.modal' ) ;
49+ await modal . getByRole ( 'tab' , { name : / o t h e r / i } ) . click ( ) ;
4550
4651 // macOS instructions should be visible
47- await expect ( page . getByText ( 'Mac OS X' ) ) . toBeVisible ( ) ;
48- await expect ( page . getByText ( 'brew install --cask macfuse' ) ) . toBeVisible ( ) ;
49- await expect ( page . getByText ( 'brew install cryfs/tap/cryfs' ) ) . toBeVisible ( ) ;
52+ await expect ( modal . getByText ( 'Mac OS X' ) . first ( ) ) . toBeVisible ( ) ;
53+ await expect ( modal . getByText ( 'brew install --cask macfuse' ) . first ( ) ) . toBeVisible ( ) ;
54+ await expect ( modal . getByText ( 'brew install cryfs/tap/cryfs' ) . first ( ) ) . toBeVisible ( ) ;
5055 } ) ;
5156
5257 test ( 'should show Windows instructions in Other tab' , async ( { page } ) => {
5358 await page . goto ( '/#download' ) ;
5459
55- await page . getByText ( 'Other' ) . click ( ) ;
60+ const modal = page . locator ( '.modal' ) ;
61+ await modal . getByRole ( 'tab' , { name : / o t h e r / i } ) . click ( ) ;
5662
5763 // Windows instructions should be visible
58- await expect ( page . getByText ( 'Windows' ) ) . toBeVisible ( ) ;
59- await expect ( page . getByText ( / w i n d o w s s u p p o r t i s h i g h l y e x p e r i m e n t a l / i) ) . toBeVisible ( ) ;
64+ await expect ( modal . getByText ( 'Windows' ) . first ( ) ) . toBeVisible ( ) ;
65+ await expect ( modal . getByText ( / w i n d o w s s u p p o r t i s h i g h l y e x p e r i m e n t a l / i) ) . toBeVisible ( ) ;
6066 } ) ;
6167
6268 test ( 'should have DokanY download link' , async ( { page } ) => {
6369 await page . goto ( '/#download' ) ;
6470
65- await page . getByText ( 'Other' ) . click ( ) ;
71+ const modal = page . locator ( '.modal' ) ;
72+ await modal . getByRole ( 'tab' , { name : / o t h e r / i } ) . click ( ) ;
6673
67- const dokanLink = page . getByRole ( 'link' , { name : / d o k a n y / i } ) ;
74+ const dokanLink = modal . getByRole ( 'link' , { name : / d o k a n y / i } ) ;
6875 await expect ( dokanLink ) . toBeVisible ( ) ;
6976 await expect ( dokanLink ) . toHaveAttribute ( 'href' , 'https://github.com/dokan-dev/dokany/releases' ) ;
7077 } ) ;
@@ -73,21 +80,23 @@ test.describe('Download Modal Flow', () => {
7380 await page . goto ( '/#download' ) ;
7481
7582 // Modal should be visible
76- await expect ( page . locator ( '.modal' ) ) . toBeVisible ( ) ;
83+ const modal = page . locator ( '.modal' ) ;
84+ await expect ( modal ) . toBeVisible ( ) ;
7785
7886 // Click close button
79- const closeButton = page . getByRole ( 'button' , { name : / c l o s e / i } ) ;
87+ const closeButton = modal . getByRole ( 'button' , { name : / c l o s e / i } ) ;
8088 await closeButton . click ( ) ;
8189
8290 // Modal should be hidden
83- await expect ( page . locator ( '. modal' ) ) . not . toBeVisible ( ) ;
91+ await expect ( modal ) . not . toBeVisible ( ) ;
8492 } ) ;
8593
8694 test ( 'should update URL hash when modal closes' , async ( { page } ) => {
8795 await page . goto ( '/#download' ) ;
8896
97+ const modal = page . locator ( '.modal' ) ;
8998 // Close modal
90- const closeButton = page . getByRole ( 'button' , { name : / c l o s e / i } ) ;
99+ const closeButton = modal . getByRole ( 'button' , { name : / c l o s e / i } ) ;
91100 await closeButton . click ( ) ;
92101
93102 // URL should no longer have #download
@@ -97,19 +106,18 @@ test.describe('Download Modal Flow', () => {
97106 test ( 'should display OS logos' , async ( { page } ) => {
98107 await page . goto ( '/#download' ) ;
99108
100- await expect ( page . getByAltText ( 'Ubuntu' ) ) . toBeVisible ( ) ;
101- await expect ( page . getByAltText ( 'Debian' ) ) . toBeVisible ( ) ;
102- await expect ( page . getByAltText ( 'Other' ) ) . toBeVisible ( ) ;
109+ const modal = page . locator ( '.modal' ) ;
110+ await expect ( modal . getByAltText ( 'Ubuntu' ) ) . toBeVisible ( ) ;
111+ await expect ( modal . getByAltText ( 'Debian' ) ) . toBeVisible ( ) ;
112+ await expect ( modal . getByAltText ( 'Other' ) ) . toBeVisible ( ) ;
103113 } ) ;
104114
105115 test ( 'should link to GitHub releases for older versions' , async ( { page } ) => {
106116 await page . goto ( '/#download' ) ;
107117
108- const releasesLink = page . getByRole ( 'link' , { name : / h e r e / i } ) . filter ( {
109- has : page . locator ( '[href*="github.com/cryfs/cryfs/releases"]' ) ,
110- } ) ;
111-
112- await expect ( releasesLink ) . toBeVisible ( ) ;
118+ const modal = page . locator ( '.modal' ) ;
119+ const releasesLink = modal . locator ( 'a[href*="github.com/cryfs/cryfs/releases"]' ) ;
120+ await expect ( releasesLink . first ( ) ) . toBeVisible ( ) ;
113121 } ) ;
114122
115123 test ( 'should open modal from download link on homepage' , async ( { page } ) => {
@@ -120,7 +128,8 @@ test.describe('Download Modal Flow', () => {
120128 await downloadLink . click ( ) ;
121129
122130 // Modal should appear
123- await expect ( page . locator ( '.modal' ) ) . toBeVisible ( ) ;
124- await expect ( page . getByText ( / d o w n l o a d c r y f s / i) ) . toBeVisible ( ) ;
131+ const modal = page . locator ( '.modal' ) ;
132+ await expect ( modal ) . toBeVisible ( ) ;
133+ await expect ( modal . getByText ( / d o w n l o a d c r y f s / i) ) . toBeVisible ( ) ;
125134 } ) ;
126135} ) ;
0 commit comments