Translating retry connection error message and fixing E2E tests

This commit is contained in:
David Négrier 2022-01-19 11:36:08 +01:00 committed by Alexis Faizeau
parent 51c3f1d972
commit 0be77164ec
7 changed files with 61 additions and 12 deletions

View file

@ -3,7 +3,7 @@ import {assertLogMessage} from "./utils/log";
const fs = require('fs');
const Docker = require('dockerode');
import { Selector } from 'testcafe';
import {login} from "./utils/roles";
import {login, resetLanguage} from "./utils/roles";
import {findContainer, rebootBack, rebootPusher, resetRedis, startContainer, stopContainer} from "./utils/containers";
fixture `Reconnection`
@ -16,6 +16,8 @@ test("Test that connection can succeed even if WorkAdventure starts while pusher
const errorMessage = Selector('.error-div');
await resetLanguage('en-US');
await t
.navigateTo('http://play.workadventure.localhost/_/global/maps.workadventure.localhost/tests/mousewheel.json')
.expect(errorMessage.innerText).contains('Unable to connect to WorkAdventure')

29
tests/tests/translate.ts Normal file
View file

@ -0,0 +1,29 @@
import { Selector } from 'testcafe';
import {login} from "./utils/roles";
fixture `Translation`
.page `http://play.workadventure.localhost/_/global/maps.workadventure.localhost/tests/mousewheel.json`;
test("Test that I can switch to French", async (t: TestController) => {
const languageSelect = Selector('.languages-switcher');
const languageOption = languageSelect.find('option');
await login(t, 'http://play.workadventure.localhost/_/global/maps.workadventure.localhost/tests/mousewheel.json');
await t.click('.menuIcon img:first-child')
.click(Selector('button').withText('Settings'))
.click('.languages-switcher')
.click(languageOption.withText('Français (France)'))
.click(Selector('button').withText('Save'))
.click('.menuIcon img:first-child')
.expect(Selector('button').withText('Paramètres').innerText).contains('Paramètres');
t.ctx.passed = true;
}).after(async t => {
if (!t.ctx.passed) {
console.log("Test failed. Browser logs:")
console.log(await t.getBrowserConsoleMessages());
}
});

View file

@ -1,6 +1,11 @@
import { Role } from 'testcafe';
import { Role, ClientFunction } from 'testcafe';
export const resetLanguage = ClientFunction((browserLanguage) => window.localStorage.setItem('language', browserLanguage));
export async function login(t: TestController, url: string, userName: string = "Alice", characterNumber: number = 2, browserLanguage: string|null = 'en-US') {
await resetLanguage(browserLanguage);
export function login(t: TestController, url: string, userName: string = "Alice", characterNumber: number = 2) {
t = t
.navigateTo(url)
.typeText('input[name="loginSceneName"]', userName)