Skip to content

Commit 911e2c8

Browse files
committed
playwright: drop provisions for the original Rails app
https://git-scm.com/ switched away from the Rails app a long time ago. There is literally no site where the Playwright tests could possibly succeed with that flag set. So let's remove it. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 518d2b7 commit 911e2c8

File tree

2 files changed

+7
-40
lines changed

2 files changed

+7
-40
lines changed

.github/workflows/playwright.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ on:
66
description: 'URL to test'
77
required: true
88
default: 'https://git-scm.com'
9-
assume-rails-app:
10-
description: 'Whether the URL points to the original Rails app variant of the site'
11-
required: false
12-
default: 'false'
139
jobs:
1410
test:
1511
timeout-minutes: 60
@@ -24,7 +20,6 @@ jobs:
2420
- name: Run Playwright tests
2521
env:
2622
PLAYWRIGHT_TEST_URL: ${{ github.event.inputs.url }}
27-
PLAYWRIGHT_ASSUME_RAILS_APP: ${{ github.event.inputs.assume-rails-app }}
2823
run: npx playwright test --project=chrome
2924
- uses: actions/upload-artifact@v4
3025
if: always()

tests/git-scm.spec.js

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const { test, expect, selectors, devices } = require('@playwright/test')
33
const 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
98
test.afterEach(async ({ page }, testInfo) => {
@@ -24,11 +23,7 @@ test.afterEach(async ({ page }, testInfo) => {
2423

2524
test('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', /^Hugo /)
31-
}
26+
await expect(page.locator('meta[name="generator"]')).toHaveAttribute('content', /^Hugo /)
3227
})
3328

3429
async 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', /\/docs\/git-add$/)
131-
} else {
132-
await expect(searchResults.getByRole("link").nth(0)).toHaveAttribute('href', /\/docs\/git-add\/fr(\.html)?$/)
133-
}
124+
await expect(searchResults.getByRole("link").nth(0)).toHaveAttribute('href', /\/docs\/git-add\/fr(\.html)?$/)
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(/\/search/)
139-
} else {
140-
await expect(page).toHaveURL(/\/search.*language=fr/)
141-
}
128+
await expect(page).toHaveURL(/\/search.*language=fr/)
142129
})
143130

144131
test('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: /Version \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(/git remote rename.*<ancien> <nouveau>/)
194-
await expect(synopsis).toHaveText(/git remote renom.*<ancien> <nouveau>/)
195-
} else {
196-
await expect(synopsis).toHaveText(/git remote rename.*<ancien> <nouveau>/)
197-
await expect(synopsis).not.toHaveText(/git remote renom.*<ancien> <nouveau>/)
198-
}
174+
await expect(synopsis).toHaveText(/git remote rename.*<ancien> <nouveau>/)
175+
await expect(synopsis).not.toHaveText(/git remote renom.*<ancien> <nouveau>/)
199176
})
200177

201178
test('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(/book\/az\/v2$/)
250-
await page.goto(`${url}book/az/v2/Başlanğıc-Git-Nədir%3F`)
251-
} else {
252-
await expect(page).toHaveURL(/Ba%C5%9Flan%C4%9F%C4%B1c-Git-N%C9%99dir%3F/)
253-
}
225+
await expect(page).toHaveURL(/Ba%C5%9Flan%C4%9F%C4%B1c-Git-N%C9%99dir%3F/)
254226
await expect(page.getByRole('document')).toHaveText(/Snapshotlar, Fərqlər Yox/)
255227

256228
// the repository URL now points to the Azerbaijani translation

0 commit comments

Comments
 (0)