From a9c10839d3a75bfe695c081e2f1258f01352cedc Mon Sep 17 00:00:00 2001 From: Luke Schlangen <lukeschlangen@gmail.com> Date: Thu, 8 Feb 2018 11:05:00 -0600 Subject: [PATCH] starting driver before "not now" test --- test/integration/project-loading.test.js | 79 ++++++++++++------------ 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/test/integration/project-loading.test.js b/test/integration/project-loading.test.js index 29abfb3eb..9d5cb0384 100644 --- a/test/integration/project-loading.test.js +++ b/test/integration/project-loading.test.js @@ -14,15 +14,6 @@ const uri = path.resolve(__dirname, '../../build/index.html'); let driver; describe('Loading scratch gui', () => { - test('The "Not Now" button sends you to scratch', async () => { - await loadUri(uri); - await clickText('Not Now'); - const currentUrl = await driver.getCurrentUrl(); - await expect(currentUrl).toEqual('https://scratch.mit.edu/'); - }); -}); - -describe('Loading projects by ID', () => { beforeAll(() => { driver = getDriver(); }); @@ -31,40 +22,50 @@ describe('Loading projects by ID', () => { await driver.quit(); }); - test('Load a project by ID', async () => { - const projectId = '96708228'; - await loadUri(`${uri}#${projectId}`); - await clickXpath('//button[@title="tryit"]'); - await new Promise(resolve => setTimeout(resolve, 2000)); - await clickXpath('//img[@title="Go"]'); - await new Promise(resolve => setTimeout(resolve, 2000)); - await clickXpath('//img[@title="Stop"]'); - const logs = await getLogs(); - await expect(logs).toEqual([]); + test('The "Not Now" button sends you to scratch', async () => { + await loadUri(uri); + await clickText('Not Now'); + const currentUrl = await driver.getCurrentUrl(); + await expect(currentUrl).toEqual('https://scratch.mit.edu/'); }); - test('Load a project by ID (fullscreen)', async () => { - const prevSize = driver.manage() - .window() - .getSize(); - await new Promise(resolve => setTimeout(resolve, 2000)); - driver.manage() - .window() - .setSize(1920, 1080); - const projectId = '96708228'; - await loadUri(`${uri}#${projectId}`); - await clickXpath('//button[@title="tryit"]'); - await new Promise(resolve => setTimeout(resolve, 2000)); - await clickXpath('//img[@title="Full Screen Control"]'); - await clickXpath('//img[@title="Go"]'); - await new Promise(resolve => setTimeout(resolve, 2000)); - await clickXpath('//img[@title="Stop"]'); - prevSize.then(value => { + describe('Loading projects by ID', () => { + + test('Load a project by ID', async () => { + const projectId = '96708228'; + await loadUri(`${uri}#${projectId}`); + await clickXpath('//button[@title="tryit"]'); + await new Promise(resolve => setTimeout(resolve, 2000)); + await clickXpath('//img[@title="Go"]'); + await new Promise(resolve => setTimeout(resolve, 2000)); + await clickXpath('//img[@title="Stop"]'); + const logs = await getLogs(); + await expect(logs).toEqual([]); + }); + + test('Load a project by ID (fullscreen)', async () => { + const prevSize = driver.manage() + .window() + .getSize(); + await new Promise(resolve => setTimeout(resolve, 2000)); driver.manage() .window() - .setSize(value.width, value.height); + .setSize(1920, 1080); + const projectId = '96708228'; + await loadUri(`${uri}#${projectId}`); + await clickXpath('//button[@title="tryit"]'); + await new Promise(resolve => setTimeout(resolve, 2000)); + await clickXpath('//img[@title="Full Screen Control"]'); + await clickXpath('//img[@title="Go"]'); + await new Promise(resolve => setTimeout(resolve, 2000)); + await clickXpath('//img[@title="Stop"]'); + prevSize.then(value => { + driver.manage() + .window() + .setSize(value.width, value.height); + }); + const logs = await getLogs(); + await expect(logs).toEqual([]); }); - const logs = await getLogs(); - await expect(logs).toEqual([]); }); }); -- GitLab