tests: Fix E2E tests for Spectron 11.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2020-08-25 15:33:40 -07:00
parent 8d4d168988
commit 6404bed519
4 changed files with 6 additions and 5 deletions

View File

@@ -10,7 +10,7 @@ test('app runs', async t => {
try {
await setup.waitForLoad(app, t);
await app.client.windowByIndex(1); // Focus on webview
await app.client.waitForExist('//*[@id="connect"]'); // Id of the connect button
await (await app.client.$('//*[@id="connect"]')).waitForExist(); // Id of the connect button
await setup.endTest(app, t);
} catch (error) {
await setup.endTest(app, t, error || 'error');

View File

@@ -67,6 +67,7 @@ async function wait(ms) {
// Quit the app, end the test, either in success (!err) or failure (err)
async function endTest(app, t, err) {
await app.client.windowByIndex(0);
await app.stop();
t.end(err);
}

View File

@@ -10,12 +10,12 @@ test('add-organization', async t => {
try {
await setup.waitForLoad(app, t);
await app.client.windowByIndex(1); // Focus on webview
await app.client.setValue('.setting-input-value', 'chat.zulip.org');
await app.client.click('#connect');
await (await app.client.$('.setting-input-value')).setValue('chat.zulip.org');
await (await app.client.$('#connect')).click();
await setup.wait(5000);
await app.client.windowByIndex(0); // Switch focus back to main win
await app.client.windowByIndex(1); // Switch focus back to org webview
await app.client.waitForExist('//*[@id="id_username"]');
await (await app.client.$('//*[@id="id_username"]')).waitForExist();
await setup.endTest(app, t);
} catch (error) {
await setup.endTest(app, t, error || 'error');

View File

@@ -12,7 +12,7 @@ test('new-org-link', async t => {
try {
await setup.waitForLoad(app, t);
await app.client.windowByIndex(1); // Focus on webview
await app.client.click('#open-create-org-link'); // Click on new org link button
await (await app.client.$('#open-create-org-link')).click(); // Click on new org link button
await setup.wait(5000);
await setup.endTest(app, t);
} catch (error) {