@@ -3,7 +3,6 @@ const { test, expect, selectors, devices } = require('@playwright/test')
33const url = process . env . PLAYWRIGHT_TEST_URL
44 ? process . env . PLAYWRIGHT_TEST_URL . replace ( / [ ^ / ] $ / , '$&/' )
55 : 'https://git-scm.com/'
6- const isRailsApp = process . env . PLAYWRIGHT_ASSUME_RAILS_APP === 'true'
76
87// Whenever a test fails, attach a screenshot to diagnose failures better
98test . afterEach ( async ( { page } , testInfo ) => {
@@ -24,11 +23,7 @@ test.afterEach(async ({ page }, testInfo) => {
2423
2524test ( 'generator is Hugo' , async ( { page} ) => {
2625 await page . goto ( url )
27- if ( isRailsApp ) {
28- await expect ( page . locator ( 'meta[name="generator"]' ) ) . toHaveCount ( 0 )
29- } else {
30- await expect ( page . locator ( 'meta[name="generator"]' ) ) . toHaveAttribute ( 'content' , / ^ H u g o / )
31- }
26+ await expect ( page . locator ( 'meta[name="generator"]' ) ) . toHaveAttribute ( 'content' , / ^ H u g o / )
3227} )
3328
3429async function pretendPlatform ( page , browserName , userAgent , platform ) {
@@ -126,19 +121,11 @@ test('search', async ({ page }) => {
126121 await page . goto ( `${ url } docs/git-commit/fr` )
127122 await searchBox . fill ( 'add' )
128123 await searchBox . press ( 'Shift' )
129- if ( isRailsApp ) {
130- await expect ( searchResults . getByRole ( "link" ) . nth ( 0 ) ) . toHaveAttribute ( 'href' , / \/ d o c s \/ g i t - a d d $ / )
131- } else {
132- await expect ( searchResults . getByRole ( "link" ) . nth ( 0 ) ) . toHaveAttribute ( 'href' , / \/ d o c s \/ g i t - a d d \/ f r ( \. h t m l ) ? $ / )
133- }
124+ await expect ( searchResults . getByRole ( "link" ) . nth ( 0 ) ) . toHaveAttribute ( 'href' , / \/ d o c s \/ g i t - a d d \/ f r ( \. h t m l ) ? $ / )
134125
135126 // pressing the Enter key should navigate to the full search results page
136127 await searchBox . press ( 'Enter' )
137- if ( isRailsApp ) {
138- await expect ( page ) . toHaveURL ( / \/ s e a r c h / )
139- } else {
140- await expect ( page ) . toHaveURL ( / \/ s e a r c h .* l a n g u a g e = f r / )
141- }
128+ await expect ( page ) . toHaveURL ( / \/ s e a r c h .* l a n g u a g e = f r / )
142129} )
143130
144131test ( 'manual pages' , async ( { page } ) => {
@@ -152,11 +139,7 @@ test('manual pages', async ({ page }) => {
152139 // Verify that the drop-downs are shown when clicked
153140 const previousVersionDropdown = page . locator ( '#previous-versions-dropdown' )
154141 await expect ( previousVersionDropdown ) . toBeHidden ( )
155- if ( isRailsApp ) {
156- await page . getByRole ( 'link' , { name : / V e r s i o n \d + \. \d + \. \d + / } ) . click ( )
157- } else {
158- await page . getByRole ( 'link' , { name : 'Latest version' } ) . click ( )
159- }
142+ await page . getByRole ( 'link' , { name : 'Latest version' } ) . click ( )
160143 await expect ( previousVersionDropdown ) . toBeVisible ( )
161144
162145 const topicsDropdown = page . locator ( '#topics-dropdown' )
@@ -188,14 +171,8 @@ test('manual pages', async ({ page }) => {
188171 // Ensure that the French mis-translation of `git remote renom` is not present
189172 await page . goto ( `${ url } docs/git-remote/fr` )
190173 const synopsis = page . locator ( 'xpath=//h2[contains(text(), "SYNOPSIS")]/following-sibling::*[1]' ) . first ( )
191- if ( isRailsApp ) {
192- // This is a bug in the Rails app, and it is unclear what the root cause is
193- await expect ( synopsis ) . not . toHaveText ( / g i t r e m o t e r e n a m e .* < a n c i e n > < n o u v e a u > / )
194- await expect ( synopsis ) . toHaveText ( / g i t r e m o t e r e n o m .* < a n c i e n > < n o u v e a u > / )
195- } else {
196- await expect ( synopsis ) . toHaveText ( / g i t r e m o t e r e n a m e .* < a n c i e n > < n o u v e a u > / )
197- await expect ( synopsis ) . not . toHaveText ( / g i t r e m o t e r e n o m .* < a n c i e n > < n o u v e a u > / )
198- }
174+ await expect ( synopsis ) . toHaveText ( / g i t r e m o t e r e n a m e .* < a n c i e n > < n o u v e a u > / )
175+ await expect ( synopsis ) . not . toHaveText ( / g i t r e m o t e r e n o m .* < a n c i e n > < n o u v e a u > / )
199176} )
200177
201178test ( 'book' , async ( { page } ) => {
@@ -245,12 +222,7 @@ test('book', async ({ page }) => {
245222
246223 // Navigate to a page whose URL contains a question mark
247224 await page . goto ( `${ url } book/az/v2/Başlanğıc-Git-Nədir?` )
248- if ( isRailsApp ) {
249- await expect ( page ) . toHaveURL ( / b o o k \/ a z \/ v 2 $ / )
250- await page . goto ( `${ url } book/az/v2/Başlanğıc-Git-Nədir%3F` )
251- } else {
252- await expect ( page ) . toHaveURL ( / B a % C 5 % 9 F l a n % C 4 % 9 F % C 4 % B 1 c - G i t - N % C 9 % 9 9 d i r % 3 F / )
253- }
225+ await expect ( page ) . toHaveURL ( / B a % C 5 % 9 F l a n % C 4 % 9 F % C 4 % B 1 c - G i t - N % C 9 % 9 9 d i r % 3 F / )
254226 await expect ( page . getByRole ( 'document' ) ) . toHaveText ( / S n a p s h o t ’ l a r , F ə r q l ə r Y o x / )
255227
256228 // the repository URL now points to the Azerbaijani translation
0 commit comments