test: add integration test that tests monitor labels after switching languages

This commit is contained in:
Andy O'Neill 2022-12-05 13:04:26 -05:00
parent 97dc338b5a
commit d54c17456d
2 changed files with 34 additions and 2 deletions

BIN
test/fixtures/monitor-variable.sb3 vendored Normal file

Binary file not shown.

View File

@ -4,12 +4,13 @@ import SeleniumHelper from '../helpers/selenium-helper';
const {
clickText,
clickXpath,
findByText,
findByXpath,
getDriver,
getLogs,
loadUri,
scope,
rightClickText,
findByText
scope
} = new SeleniumHelper();
const uri = path.resolve(__dirname, '../../build/index.html');
@ -74,4 +75,35 @@ describe('Localization', () => {
const logs = await getLogs();
await expect(logs).toEqual([]);
});
// Regression test for ENA-142, monitor can lag behind language selection
test('Monitor labels update on locale change', async () => {
await loadUri(uri);
await clickText('File');
await clickText('Load from your computer');
const input = await findByXpath('//input[@accept=".sb,.sb2,.sb3"]');
await input.sendKeys(path.resolve(__dirname, '../fixtures/monitor-variable.sb3'));
// Monitors are present
await findByText('username', scope.monitors);
await findByText('language', scope.monitors);
// Change locale to ja
await clickXpath('//*[@aria-label="language selector"]');
await clickText('日本語');
// Monitor labels updated
await findByText('ユーザー名', scope.monitors);
await findByText('言語', scope.monitors);
// Change locale to ja-hira
await clickText('にほんご');
// Monitor labels updated
await findByText('ユーザーめい', scope.monitors);
await findByText('げんご', scope.monitors);
const logs = await getLogs();
await expect(logs).toEqual([]);
});
});