diff --git a/test/integration/project-loading.test.js b/test/integration/project-loading.test.js index 09023632e8a1ac61b8c1598d7c3824c1e9a7ebed..687e11b1314ed01b8ba5039f9da4cc0b41c41098 100644 --- a/test/integration/project-loading.test.js +++ b/test/integration/project-loading.test.js @@ -7,7 +7,8 @@ const { findByXpath, getDriver, getLogs, - loadUri + loadUri, + scope } = new SeleniumHelper(); const uri = path.resolve(__dirname, '../../build/index.html'); @@ -105,5 +106,27 @@ describe('Loading scratch gui', () => { const logs = await getLogs(); await expect(logs).toEqual([]); }); + + test('Creating new project resets active tab to Code tab', async () => { + await loadUri(uri); + await clickText('View 2.0 Project'); + const el = await findByXpath("//input[@placeholder='scratch.mit.edu/projects/123456789']"); + const projectId = '96708228'; + await el.sendKeys(`scratch.mit.edu/projects/${projectId}`); + await clickXpath('//button[@title="View Project"]'); + await new Promise(resolve => setTimeout(resolve, 2000)); + await findByXpath('//*[span[text()="Costumes"]]'); + await clickText('Costumes'); + await clickXpath( + '//div[contains(@class, "menu-bar_menu-bar-item") and ' + + 'contains(@class, "menu-bar_hoverable")][span[text()="File"]]' + ); + await clickXpath('//li[span[text()="New"]]'); + driver.switchTo() + .alert() + .accept(); + await findByXpath('//*[div[@class="scratchCategoryMenu"]]'); + await clickText('Operators', scope.blocksTab); + }); }); });