From 2aa0e8d90f9b6311ea59b7c80a984cf0e8b70a0f Mon Sep 17 00:00:00 2001
From: Paul Kaplan <pkaplan@media.mit.edu>
Date: Mon, 7 May 2018 10:46:08 -0400
Subject: [PATCH] Add an integration test for surprise and empty sprites

---
 test/integration/sprites.test.js | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/test/integration/sprites.test.js b/test/integration/sprites.test.js
index 5e02623ee..816d06a1e 100644
--- a/test/integration/sprites.test.js
+++ b/test/integration/sprites.test.js
@@ -5,6 +5,7 @@ const {
     clickText,
     clickXpath,
     findByText,
+    findByXpath,
     getDriver,
     getLogs,
     loadUri,
@@ -25,6 +26,29 @@ describe('Working with sprites', () => {
         await driver.quit();
     });
 
+    test('Adding a sprite through the library', async () => {
+        await loadUri(uri);
+        await clickXpath('//button[@title="tryit"]');
+        await clickText('Costumes');
+        await clickXpath('//button[@aria-label="Choose a Sprite"]');
+        await clickText('Apple', scope.modal); // Closes modal
+        await rightClickText('Apple', scope.spriteTile); // Make sure it is there
+        const logs = await getLogs();
+        await expect(logs).toEqual([]);
+    });
+
+    test('Adding a sprite by surprise button', async () => {
+        await loadUri(uri);
+        await clickXpath('//button[@title="tryit"]');
+        const el = await findByXpath('//button[@aria-label="Choose a Sprite"]');
+        await driver.actions().mouseMove(el)
+            .perform();
+        await driver.sleep(500); // Wait for thermometer menu to come up
+        await clickXpath('//button[@aria-label="Surprise"]');
+        const logs = await getLogs();
+        await expect(logs).toEqual([]);
+    });
+
     test('Deleting only sprite does not crash', async () => {
         await loadUri(uri);
         await clickXpath('//button[@title="tryit"]');
-- 
GitLab