Skip to content

Commit

Permalink
Use ar for banner test
Browse files Browse the repository at this point in the history
Signed-off-by: Olga Bulat <[email protected]>
  • Loading branch information
obulat committed Mar 20, 2024
1 parent 898a2fc commit 13326d6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
12 changes: 1 addition & 11 deletions frontend/test/locales/scripts/valid-locales.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"iso": "ar",
"wpLocale": "ar",
"dir": "rtl",
"translated": 100,
"translated": 48,
"file": "ar.json"
},
{
Expand All @@ -18,15 +18,5 @@
"dir": "ltr",
"translated": 100,
"file": "es.json"
},
{
"code": "ru",
"name": "Russian",
"nativeName": "Русский",
"iso": "ru",
"wpLocale": "ru_RU",
"dir": "ltr",
"translated": 48,
"file": "ru.json"
}
]
14 changes: 7 additions & 7 deletions frontend/test/playwright/e2e/translation-banner.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ import { test, expect } from "@playwright/test"
import { preparePageForTests } from "~~/test/playwright/utils/navigation"

// Do not use one of the test locales, as those all have "complete" generated translations
const russianSearchPath = "/ru/search?q=dog"
const localeSearchPath = "/ar/search?q=dog"

test.describe.configure({ mode: "parallel" })

test.describe("translation banner", () => {
test("Can see the translation banner and go to the correct link", async ({
page,
}) => {
await page.goto(russianSearchPath)
await page.goto(localeSearchPath)
await expect(page.locator("text=100%")).toBeVisible({ timeout: 500 })

const [page1] = await Promise.all([
page.waitForEvent("popup"),
page.click("text=contributing a translation"),
])
await expect(page1).toHaveURL(
"https://translate.wordpress.org/projects/meta/openverse/ru/default/"
"https://translate.wordpress.org/projects/meta/openverse/ar/default/"
)
})

Expand All @@ -28,23 +28,23 @@ test.describe("translation banner", () => {
}) => {
await preparePageForTests(page, "xl", { dismissBanners: true })

await page.goto(russianSearchPath)
await page.goto(localeSearchPath)
await expect(page.locator('[data-testid="banner-translation"]')).toBeHidden(
{ timeout: 500 }
)
})

test("Can close the translation banner", async ({ page }) => {
await page.goto(russianSearchPath)
await page.goto(localeSearchPath)
await page.click('[data-testid="banner-translation"] button:visible')

const banner = page.locator('.span:has-text("Help us get to 100 percent")')
await expect(banner).toBeHidden({ timeout: 500 })
// Test that the banner does not re-appear when navigating to the 'About us' page
await page.locator('li a[href="/ru/about"]').click()
await page.locator('li a[href="/ar/about"]').click()
await expect(banner).toBeHidden({ timeout: 500 })

await page.goto(russianSearchPath)
await page.goto(localeSearchPath)
await expect(banner).toBeHidden({ timeout: 500 })
})
})

0 comments on commit 13326d6

Please sign in to comment.