From 7eebe9b3550b9d84747f2fdbc8c369c9725cda98 Mon Sep 17 00:00:00 2001
From: Paul Kaplan <pkaplan@media.mit.edu>
Date: Fri, 27 Apr 2018 11:51:51 -0400
Subject: [PATCH] Add a simple smoke test for the how-to library

---
 src/components/menu-bar/menu-bar.jsx |  1 +
 test/integration/how-tos.test.js     | 37 ++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+)
 create mode 100644 test/integration/how-tos.test.js

diff --git a/src/components/menu-bar/menu-bar.jsx b/src/components/menu-bar/menu-bar.jsx
index 16f7cfaf6..7e098b65f 100644
--- a/src/components/menu-bar/menu-bar.jsx
+++ b/src/components/menu-bar/menu-bar.jsx
@@ -224,6 +224,7 @@ const MenuBar = props => (
         </div>
         <div className={styles.accountInfoWrapper}>
             <div
+                aria-label="How-to Library"
                 className={classNames(styles.menuBarItem, styles.hoverable)}
                 onClick={props.onOpenTipLibrary}
             >
diff --git a/test/integration/how-tos.test.js b/test/integration/how-tos.test.js
new file mode 100644
index 000000000..953cfbc7e
--- /dev/null
+++ b/test/integration/how-tos.test.js
@@ -0,0 +1,37 @@
+import path from 'path';
+import SeleniumHelper from '../helpers/selenium-helper';
+
+const {
+    clickText,
+    clickXpath,
+    getDriver,
+    getLogs,
+    loadUri
+} = new SeleniumHelper();
+
+const uri = path.resolve(__dirname, '../../build/index.html');
+
+let driver;
+
+describe('Working with the how-to library', () => {
+    beforeAll(() => {
+        driver = getDriver();
+    });
+
+    afterAll(async () => {
+        await driver.quit();
+    });
+
+    test('Choosing a how-to', async () => {
+        await loadUri(uri);
+        await clickXpath('//button[@title="tryit"]');
+        await clickText('Costumes');
+        await clickXpath('//*[@aria-label="How-to Library"]');
+        await clickText('Say hello'); // Modal should close
+        await clickText('Add a new sprite'); // Make sure first card appears
+        const logs = await getLogs();
+        await expect(logs).toEqual([]);
+    });
+
+    // @todo navigating cards, etc.
+});
-- 
GitLab