[MM-49724] More robust check for startup before starting E2E tests (#2504)

* [MM-49724] More robust check for startup before starting E2E tests

* Fix a few more tests
This commit is contained in:
Devin Binnie 2023-01-18 05:11:11 -05:00 committed by GitHub
parent 7d79cab916
commit c8c88a274f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 11 deletions

View file

@ -214,16 +214,16 @@ module.exports = {
// // this changes the default debugging port so chromedriver can run without issues.
// options.chromeDriverArgs.push('remote-debugging-port=9222');
//}
return electron.launch(options).then(async (app) => {
// Make sure the app has time to fully load and that the window is focused
await asyncSleep(1000);
const mainWindow = app.windows().find((window) => window.url().includes('index'));
const browserWindow = await app.browserWindow(mainWindow);
await browserWindow.evaluate((win) => {
win.show();
return true;
return electron.launch(options).then(async (eapp) => {
await eapp.evaluate(async ({app}) => {
const promise = new Promise((resolve) => {
app.on('e2e-app-loaded', () => {
resolve();
});
return app;
});
return promise;
});
return eapp;
});
},

View file

@ -44,7 +44,7 @@ describe('popup', function desc() {
await firstServer.click('#sidebarItem_suscipit-4');
await firstServer.click('#post_textbox');
await firstServer.type('#post_textbox', '/github connect ');
await firstServer.press('#post_textbox', 'Enter');
await firstServer.click('button[data-testid="SendMessageButton"]');
const githubLink = await firstServer.waitForSelector('a.theme.markdown__link:has-text("GitHub account")');
githubLink.click();
@ -100,7 +100,7 @@ describe('popup', function desc() {
await firstServer.click('#sidebarItem_suscipit-4');
await firstServer.click('#post_textbox');
await firstServer.type('#post_textbox', '/github connect ');
await firstServer.press('#post_textbox', 'Enter');
await firstServer.click('button[data-testid="SendMessageButton"]');
const githubLink = await firstServer.waitForSelector('a.theme.markdown__link:has-text("GitHub account")');
githubLink.click();

View file

@ -92,6 +92,18 @@ export function handleShowOnboardingScreens(showWelcomeScreen: boolean, showNewS
const showWelcomeScreenFunc = () => {
if (showWelcomeScreen) {
handleWelcomeScreenModal();
if (process.env.NODE_ENV === 'test') {
const welcomeScreen = ModalManager.modalQueue.find((modal) => modal.key === 'welcomeScreen');
if (welcomeScreen?.view.webContents.isLoading()) {
welcomeScreen?.view.webContents.once('did-finish-load', () => {
app.emit('e2e-app-loaded');
});
} else {
app.emit('e2e-app-loaded');
}
}
return;
}
if (showNewServerModal) {

View file

@ -667,6 +667,10 @@ export class WindowManager {
if (this.viewManager) {
this.viewManager.hideLoadingScreen();
}
if (process.env.NODE_ENV === 'test') {
app.emit('e2e-app-loaded');
}
}
updateLoadingScreenDarkMode = (darkMode: boolean) => {