diff --git a/test/integration/examples.test.js b/test/integration/examples.test.js index 7e8ff7a10c1736242f58b2c853878d04c720de24..189cb16d54ff310e8e9860870d1b40413320c6f1 100644 --- a/test/integration/examples.test.js +++ b/test/integration/examples.test.js @@ -4,13 +4,15 @@ import path from 'path'; import SeleniumHelper from '../helpers/selenium-helper'; const { + findByText, clickButton, clickText, clickXpath, findByXpath, getDriver, getLogs, - loadUri + loadUri, + waitUntilGone } = new SeleniumHelper(); let driver; @@ -29,7 +31,7 @@ describe('player example', () => { test('Load a project by ID', async () => { const projectId = '96708228'; await loadUri(`${uri}#${projectId}`); - await new Promise(resolve => setTimeout(resolve, 2000)); + await waitUntilGone(findByText('Loading')); await clickXpath('//img[@title="Go"]'); await new Promise(resolve => setTimeout(resolve, 2000)); await clickXpath('//img[@title="Stop"]'); @@ -60,7 +62,7 @@ describe('blocks example', () => { test('Load a project by ID', async () => { const projectId = '96708228'; await loadUri(`${uri}#${projectId}`); - await new Promise(resolve => setTimeout(resolve, 2000)); + await waitUntilGone(findByText('Loading')); await clickXpath('//img[@title="Go"]'); await new Promise(resolve => setTimeout(resolve, 2000)); await clickXpath('//img[@title="Stop"]');