From ae17793b8531f871040c857fcb69ddd0598c4b7e Mon Sep 17 00:00:00 2001 From: Tom Robinson <tlrobinson@gmail.com> Date: Wed, 10 Aug 2016 17:27:58 -0700 Subject: [PATCH] Screenshots --- .gitignore | 1 + circle.yml | 3 ++- frontend/test/e2e/auth/login.spec.js | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 13f3b3cebe1..6f061d628f4 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,4 @@ bin/release/aws-eb/metabase-aws-eb.zip /reset-password-artifacts /.env /npm-debug.log +/screenshots diff --git a/circle.yml b/circle.yml index 7acaa2aa3e2..4ad14e9b7dc 100644 --- a/circle.yml +++ b/circle.yml @@ -48,4 +48,5 @@ deployment: - ./bin/deploy-webhook $DEPLOY_WEBHOOK general: artifacts: - - "target/uberjar/metabase.jar" + - target/uberjar/metabase.jar + - screenshots diff --git a/frontend/test/e2e/auth/login.spec.js b/frontend/test/e2e/auth/login.spec.js index 9152d197ed0..5daa3dd3eb6 100644 --- a/frontend/test/e2e/auth/login.spec.js +++ b/frontend/test/e2e/auth/login.spec.js @@ -1,5 +1,7 @@ import { startServer, isReady } from "../support/start-server"; import webdriver, { By, until } from "selenium-webdriver"; +import fs from "fs-promise"; +import path from "path"; jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000; @@ -15,6 +17,16 @@ function waitForUrl(driver, url, timeout = 5000) { return driver.wait(async () => await driver.getCurrentUrl() === url, timeout); } +async function screenshot(driver, filename) { + let dir = path.dirname(filename); + if (dir && !(await fs.exists(dir))){ + await fs.mkdir(dir); + } + + let image = await driver.takeScreenshot(); + await fs.writeFile(filename, image, 'base64'); +} + describe("auth/login", () => { let server, driver; @@ -39,6 +51,7 @@ describe("auth/login", () => { await driver.get(`${server.host}/`); await waitForUrl(driver, `${server.host}/auth/login?redirect=%2F`); expect(await driver.isElementPresent(By.css("[name=email]"))).toEqual(true); + await screenshot(driver, "screenshots/auth-login.png"); }); it ("should log you in", async () => { @@ -65,6 +78,11 @@ describe("auth/login", () => { await driver.get(`${server.host}/`); await waitForUrl(driver, `${server.host}/`); }); + + it ("loads the qb", async () => { + await driver.get(`${server.host}/q#eyJuYW1lIjpudWxsLCJkYXRhc2V0X3F1ZXJ5Ijp7ImRhdGFiYXNlIjoxLCJ0eXBlIjoibmF0aXZlIiwibmF0aXZlIjp7InF1ZXJ5Ijoic2VsZWN0ICdvaCBoYWkgZ3Vpc2Ug8J-QsScifSwicGFyYW1ldGVycyI6W119LCJkaXNwbGF5Ijoic2NhbGFyIiwidmlzdWFsaXphdGlvbl9zZXR0aW5ncyI6e319`); + await screenshot(driver, "screenshots/qb.png"); + }); }); afterAll(async () => { -- GitLab