From 3d588321ca22398d01f7423cbab469cce4e5f6ab Mon Sep 17 00:00:00 2001 From: Nikhil Jha <hi@nikhiljha.com> Date: Mon, 28 Jan 2019 17:39:36 -0800 Subject: [PATCH] Different tests fail each time I run them. --- test/integration/connection-modal.test.js | 3 +++ test/integration/costumes.test.js | 5 +++++ test/integration/localization.test.js | 3 +++ test/integration/project-loading.test.js | 3 ++- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/test/integration/connection-modal.test.js b/test/integration/connection-modal.test.js index 68ff893f5..48bff5004 100644 --- a/test/integration/connection-modal.test.js +++ b/test/integration/connection-modal.test.js @@ -33,6 +33,9 @@ describe('Hardware extension connection modal', () => { }); test('Message saying Scratch Link is unavailable (BLE)', async () => { + await driver.quit(); + driver = getDriver(); + await loadUri(uri); await driver.executeScript(websocketFakeoutJs); diff --git a/test/integration/costumes.test.js b/test/integration/costumes.test.js index 62e9b4ef1..3eca880f0 100644 --- a/test/integration/costumes.test.js +++ b/test/integration/costumes.test.js @@ -26,7 +26,12 @@ describe('Working with costumes', () => { }); test('Adding a costume through the library', async () => { + // This is needed when running the tests all at once or it just fails... + await driver.quit(); + driver = getDriver(); + await loadUri(uri); + await driver.sleep(500); await clickText('Costumes'); await clickXpath('//button[@aria-label="Choose a Costume"]'); const el = await findByXpath("//input[@placeholder='Search']"); diff --git a/test/integration/localization.test.js b/test/integration/localization.test.js index e96dd059e..fc04c28b1 100644 --- a/test/integration/localization.test.js +++ b/test/integration/localization.test.js @@ -25,6 +25,9 @@ describe('Localization', () => { }); test('Localization', async () => { + await driver.quit(); + driver = getDriver(); + await loadUri(uri); // Add a sprite to make sure it stays when switching languages diff --git a/test/integration/project-loading.test.js b/test/integration/project-loading.test.js index 0bf85fb4a..84b6723cc 100644 --- a/test/integration/project-loading.test.js +++ b/test/integration/project-loading.test.js @@ -60,8 +60,9 @@ describe('Loading scratch gui', () => { await loadUri(`${uri}#${projectId}`); await new Promise(resolve => setTimeout(resolve, 2000)); await clickXpath('//img[@title="Full Screen Control"]'); + await new Promise(resolve => setTimeout(resolve, 500)); await clickXpath('//img[@title="Go"]'); - await new Promise(resolve => setTimeout(resolve, 2000)); + await new Promise(resolve => setTimeout(resolve, 1000)); await clickXpath('//img[@title="Stop"]'); prevSize.then(value => { driver.manage() -- GitLab