From a14f1741835d80db952b0a22e7abf270c78e9eef Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Tue, 16 Nov 2021 17:41:31 -0800 Subject: [PATCH] Fix browser name change test not actually changing name --- test/automated/browser/main.test.js | 35 ++++++++++++++-------------- test/automated/browser/tests/chat.js | 6 +++++ 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/test/automated/browser/main.test.js b/test/automated/browser/main.test.js index 2e273c167..081f36615 100644 --- a/test/automated/browser/main.test.js +++ b/test/automated/browser/main.test.js @@ -23,24 +23,25 @@ const desktop = { const devices = [desktop, phone, tablet, tabletLandscape]; describe('Frontend web page', () => { - beforeAll(async () => { - listenForErrors(browser, page); - await page.goto('http://localhost:5309'); - await page.waitForTimeout(3000); - }); + beforeAll(async () => { + listenForErrors(browser, page); + await page.goto('http://localhost:5309'); + await page.waitForTimeout(3000); + }); - devices.forEach(async function (device) { - const newName = 'frontend-browser-test-name-change-'+device.name; - const fakeMessage = - 'this is a test chat message sent via the automated browser tests on the main web frontend from ' + device.name; - - interactiveChatTest(browser, page, newName, fakeMessage, device.name); - videoTest(browser, page); + devices.forEach(async function (device) { + const newName = 'frontend-browser-test-name-change-' + device.name; + const fakeMessage = + 'this is a test chat message sent via the automated browser tests on the main web frontend from ' + + device.name; - await page.waitForTimeout(2000); - await page.screenshot({ - path: 'screenshots/screenshot_main-' + device.name + '.png', - fullPage: true, - }); + interactiveChatTest(browser, page, newName, fakeMessage, device.name); + videoTest(browser, page); + + await page.waitForTimeout(2000); + await page.screenshot({ + path: 'screenshots/screenshot_main-' + device.name + '.png', + fullPage: true, }); + }); }); diff --git a/test/automated/browser/tests/chat.js b/test/automated/browser/tests/chat.js index c9dfc58d2..b5065b870 100644 --- a/test/automated/browser/tests/chat.js +++ b/test/automated/browser/tests/chat.js @@ -32,11 +32,17 @@ async function interactiveChatTest( await page.evaluate(() => document.querySelector('#username-change-input').click() ); + + await page.type('#username-change-input', newName); + await page.waitForSelector('#button-update-username'); await page.evaluate(() => document.querySelector('#button-update-username').click() ); + + // page.keyboard.press('Enter'); + await page.waitForTimeout(3000); }); it('should allow typing a chat message', async () => {