зеркало из https://github.com/github/docs.git
Add a test for the WIP language banner link change (#17480)
* Add a test * Try adding de * Let's try all languages
This commit is contained in:
Родитель
612ec766aa
Коммит
4a761418a9
|
@ -161,7 +161,7 @@
|
|||
"test": "jest && eslint . && prettier -c \"**/*.{yml,yaml}\" && npm run check-deps",
|
||||
"prebrowser-test": "npm run build",
|
||||
"browser-test": "start-server-and-test browser-test-server 4001 browser-test-tests",
|
||||
"browser-test-server": "cross-env NODE_ENV=production ENABLED_LANGUAGES='en,ja' PORT=4001 node server.js",
|
||||
"browser-test-server": "cross-env NODE_ENV=production PORT=4001 node server.js",
|
||||
"browser-test-tests": "cross-env BROWSER=1 jest tests/browser/browser.js",
|
||||
"sync-search": "start-server-and-test sync-search-server 4002 sync-search-indices",
|
||||
"sync-search-dry-run": "DRY_RUN=1 npm run sync-search",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* global page, browser */
|
||||
const sleep = require('await-sleep')
|
||||
const { latest } = require('../../lib/enterprise-server-releases')
|
||||
const languages = require('../../lib/languages')
|
||||
|
||||
describe('homepage', () => {
|
||||
jest.setTimeout(60 * 1000)
|
||||
|
@ -264,3 +265,19 @@ describe('card filters', () => {
|
|||
expect(noResultsClasses).not.toContain('d-none')
|
||||
})
|
||||
})
|
||||
|
||||
describe('language banner', () => {
|
||||
it('directs user to the English version of the article', async () => {
|
||||
const wipLanguageKey = Object.keys(languages).find(key => languages[key].wip)
|
||||
|
||||
// This kinda sucks, but if we don't have a WIP language, we currently can't
|
||||
// run a reliable test. But hey, on the bright side, if we don't have a WIP
|
||||
// language then this code will never run anyway!
|
||||
if (wipLanguageKey) {
|
||||
const res = await page.goto(`http://localhost:4001/${wipLanguageKey}/actions`)
|
||||
expect(res.ok()).toBe(true)
|
||||
const href = await page.$eval('a#to-english-doc', el => el.href)
|
||||
expect(href.endsWith('/en/actions')).toBe(true)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
Загрузка…
Ссылка в новой задаче