diff --git a/package.json b/package.json index b2d2360a17..5e68103448 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/tests/browser/browser.js b/tests/browser/browser.js index aa4e15ba19..4952f1dd23 100644 --- a/tests/browser/browser.js +++ b/tests/browser/browser.js @@ -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) + } + }) +})