From 450de91e22ba1388e14e12ada875c94e0c38f5d3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 24 Nov 2021 10:49:12 +0100 Subject: [PATCH] Fix E2E tests --- client/e2e/src/po/my-account.ts | 2 +- client/e2e/wdio.local-test.conf.ts | 4 ++++ client/e2e/wdio.local.conf.ts | 4 ++++ server/lib/client-html.ts | 5 +++++ server/tests/cli/create-import-video-file-job.ts | 1 - support/doc/development/release.md | 2 +- 6 files changed, 15 insertions(+), 3 deletions(-) diff --git a/client/e2e/src/po/my-account.ts b/client/e2e/src/po/my-account.ts index 8b5e79b5e..b51614fd9 100644 --- a/client/e2e/src/po/my-account.ts +++ b/client/e2e/src/po/my-account.ts @@ -39,7 +39,7 @@ export class MyAccountPage { await container.$('.dropdown-toggle').click() - const dropdownMenu = () => container.$('.dropdown-menu .dropdown-item:nth-child(2)') + const dropdownMenu = () => container.$$('.dropdown-menu .dropdown-item')[1] await dropdownMenu().waitForDisplayed() return dropdownMenu().click() diff --git a/client/e2e/wdio.local-test.conf.ts b/client/e2e/wdio.local-test.conf.ts index 6ae426322..32e6d340c 100644 --- a/client/e2e/wdio.local-test.conf.ts +++ b/client/e2e/wdio.local-test.conf.ts @@ -4,6 +4,9 @@ const prefs = { 'intl.accept_languages': 'en' } +// Chrome headless does not support prefs +process.env.LANG = 'en' + module.exports = { config: { ...mainConfig, @@ -18,6 +21,7 @@ module.exports = { browserName: 'chrome', acceptInsecureCerts: true, 'goog:chromeOptions': { + args: [ '--headless', '--disable-gpu', '--window-size=1280,1024' ], prefs } } diff --git a/client/e2e/wdio.local.conf.ts b/client/e2e/wdio.local.conf.ts index a4c517f5e..43b820ca6 100644 --- a/client/e2e/wdio.local.conf.ts +++ b/client/e2e/wdio.local.conf.ts @@ -3,6 +3,7 @@ import { config as mainConfig } from './wdio.main.conf' const prefs = { 'intl.accept_languages': 'en' } +process.env.LANG = 'en' module.exports = { config: { @@ -16,6 +17,7 @@ module.exports = { { browserName: 'chrome', 'goog:chromeOptions': { + args: [ '--headless', '--disable-gpu', '--window-size=1280,1024' ], prefs } }, @@ -23,6 +25,8 @@ module.exports = { browserName: 'firefox', 'moz:firefoxOptions': { binary: '/usr/bin/firefox-developer-edition', + args: [ '--headless', '--window-size=1280,1024' ], + prefs } } diff --git a/server/lib/client-html.ts b/server/lib/client-html.ts index 84b4ca97d..84eb33348 100644 --- a/server/lib/client-html.ts +++ b/server/lib/client-html.ts @@ -335,6 +335,11 @@ class ClientHtml { lang = req.acceptsLanguages(POSSIBLE_LOCALES) || getDefaultLocale() } + logger.debug( + 'Serving %s HTML language', buildFileLocale(lang), + { cookie: req.cookies?.clientLanguage, paramLang, acceptLanguage: req.headers['accept-language'] } + ) + return join(__dirname, '../../../client/dist/' + buildFileLocale(lang) + '/index.html') } diff --git a/server/tests/cli/create-import-video-file-job.ts b/server/tests/cli/create-import-video-file-job.ts index 17ed67b05..c06b9550c 100644 --- a/server/tests/cli/create-import-video-file-job.ts +++ b/server/tests/cli/create-import-video-file-job.ts @@ -7,7 +7,6 @@ import { cleanupTests, createMultipleServers, doubleFollow, - expectNoFailedTranscodingJob, expectStartWith, makeRawRequest, ObjectStorageCommand, diff --git a/support/doc/development/release.md b/support/doc/development/release.md index deabe5687..bb055b7b7 100644 --- a/support/doc/development/release.md +++ b/support/doc/development/release.md @@ -13,7 +13,7 @@ NODE_APP_INSTANCE=6 NODE_ENV=test npm run start * Run `rm -rf node_modules && rm -rf client/node_modules && yarn install --pure-lockfile && npm run build` to see if all the supported languages compile correctly * Update https://peertube2.cpy.re and check it works correctly * Check CI tests are green - * Run BrowserStack and local E2E tests + * Run BrowserStack **and** local E2E tests * Release: `GITHUB_TOKEN=my_token npm run release -- 1.x.x` * Create a dedicated branch: `git checkout -b release/1.x.x && git push origin release/1.x.x` * Check the release is okay: https://github.com/Chocobozzz/PeerTube/releases