From 570815262c16d6eb3b68b7dcb9e6d430b3d7d7b7 Mon Sep 17 00:00:00 2001
From: Ben Wheeler <wheeler.benjamin@gmail.com>
Date: Mon, 10 Dec 2018 14:42:58 -0500
Subject: [PATCH] added test for resetting to code tab after file new

---
 test/integration/project-loading.test.js | 25 +++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/test/integration/project-loading.test.js b/test/integration/project-loading.test.js
index 09023632e..687e11b13 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);
+        });
     });
 });
-- 
GitLab