From d581a0d460eb5e4c5b8de95d34e153abaf54bf0d Mon Sep 17 00:00:00 2001 From: Charlotte Weaver Date: Thu, 11 Apr 2019 17:06:36 -0700 Subject: [PATCH] color by gene smoketest (#707) * add test for color by gene expression gene expression and metadata color by are handled differently * error on console.error not just on thrown errors --- client/__tests__/e2e/e2e.test.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/client/__tests__/e2e/e2e.test.js b/client/__tests__/e2e/e2e.test.js index c7ced1ef..b0665c0b 100644 --- a/client/__tests__/e2e/e2e.test.js +++ b/client/__tests__/e2e/e2e.test.js @@ -25,7 +25,17 @@ beforeAll(async () => { page = await browser.newPage(); await page.setViewport(browserViewport); if (DEV || DEBUG) { - page.on("console", msg => console.log(`PAGE LOG: ${msg.text()}`)); + page.on("console", async msg => { + // If there is a console.error but an error is not thrown, this will ensure the test fails + if (msg.type() === "error") { + const errorMsgText = await Promise.all( + // TODO can we do this without internal properties? + msg.args().map(arg => arg._remoteObject.description) + ); + throw new Error(`Console error: ${errorMsgText}`); + } + console.log(`PAGE LOG: ${msg.text()}`); + }); } page.on("pageerror", err => { throw new Error(`Console error: ${err}`); @@ -272,6 +282,15 @@ describe("ui elements don't error", async () => { } }); + test("color by for gene", async () => { + await utils.typeInto("gene-search", data.genes.search); + await page.keyboard.press("Enter"); + await page.waitForSelector( + `[data-testid='histogram-${data.genes.search}']` + ); + await utils.clickOn(`colorby-${data.genes.search}`); + }); + test("pan and zoom", async () => { await utils.clickOn("mode-pan-zoom"); const panCoords = await cxgActions.calcDragCoordinates(