Add await to the dark mode toggle test for Linux (#2518)

This commit is contained in:
Devin Binnie
2023-01-26 08:46:32 -05:00
committed by GitHub
parent cf4cdf5c1c
commit 59c98036ee

View File

@@ -37,7 +37,7 @@ describe('dark_mode', function desc() {
mainWindow.should.not.be.null;
// Toggle Dark Mode
toggleDarkMode();
await toggleDarkMode();
const topBarElementWithDarkMode = await mainWindow.waitForSelector('.topBar');
const topBarElementClassWithDarkMode = await topBarElementWithDarkMode.getAttribute('class');
@@ -45,7 +45,7 @@ describe('dark_mode', function desc() {
topBarElementClassWithDarkMode.should.contain('topBar darkMode row');
// Toggle Light Mode
toggleDarkMode();
await toggleDarkMode();
const topBarElementWithLightMode = await mainWindow.waitForSelector('.topBar');
const topBarElementClassWithLightMode = await topBarElementWithLightMode.getAttribute('class');
@@ -55,11 +55,12 @@ describe('dark_mode', function desc() {
}
});
function toggleDarkMode() {
async function toggleDarkMode() {
robot.keyTap('alt');
robot.keyTap('enter');
robot.keyTap('v');
robot.keyTap('t');
await asyncSleep(500); // Add a sleep because sometimes the second 't' doesn't fire
robot.keyTap('t'); // Click on "Toggle Dark Mode" menu item
robot.keyTap('enter');
}