From 130bd3f05cd737b2d4f782efb067c033cb3aa092 Mon Sep 17 00:00:00 2001
From: Paul Kaplan <pkaplan@media.mit.edu>
Date: Tue, 30 Oct 2018 14:05:30 -0400
Subject: [PATCH] Add integration test for changing languages not clearing
 project

---
 test/integration/localization.test.js | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/test/integration/localization.test.js b/test/integration/localization.test.js
index cf02aa86b..4fb1e8d59 100644
--- a/test/integration/localization.test.js
+++ b/test/integration/localization.test.js
@@ -6,7 +6,9 @@ const {
     clickXpath,
     getDriver,
     getLogs,
-    loadUri
+    loadUri,
+    scope,
+    rightClickText
 } = new SeleniumHelper();
 
 const uri = path.resolve(__dirname, '../../build/index.html');
@@ -25,6 +27,13 @@ describe('Localization', () => {
     test('Localization', async () => {
         await loadUri(uri);
         await clickXpath('//button[@title="Try It"]');
+
+        // Add a sprite to make sure it stays when switching languages
+        await clickText('Costumes');
+        await clickXpath('//button[@aria-label="Choose a Sprite"]');
+        await clickText('Apple', scope.modal); // Closes modal
+
+        await clickText('Code');
         await clickXpath('//*[@aria-label="language selector"]');
         await clickText('Deutsch');
         await new Promise(resolve => setTimeout(resolve, 1000)); // wait for blocks refresh
@@ -37,6 +46,9 @@ describe('Localization', () => {
         // Change to the costumes tab to confirm other parts of the GUI are translating
         await clickText('Kostüme');
 
+        // After switching languages, make sure Apple sprite still exists
+        await rightClickText('Apple', scope.spriteTile); // Make sure it is there
+
         const logs = await getLogs();
         await expect(logs).toEqual([]);
     });
-- 
GitLab