Skip to content
Snippets Groups Projects
Commit b14577ce authored by Lewis Liu's avatar Lewis Liu
Browse files

Added setup tests

parent d5ba81a3
No related branches found
No related tags found
No related merge requests found
......@@ -55,7 +55,8 @@ case $CIRCLE_NODE_INDEX in
npm run test
;;
6) ./bin/build version frontend sample-dataset uberjar
npm run test-e2e
USE_SAUCE=true \
npm run test-e2e
node_modules/.bin/babel-node ./bin/compare-screenshots
;;
esac
......@@ -133,12 +133,12 @@ export default class UserStep extends Component {
<FormField className="Grid mb3" fieldName="first_name" formError={formError}>
<div>
<FormLabel title="First name" fieldName="first_name" formError={formError}></FormLabel>
<input ref="firstName" className="Form-input Form-offset full" name="name" defaultValue={(userDetails) ? userDetails.first_name : ""} placeholder="Johnny" autoFocus={true} onChange={this.onChange.bind(this)} />
<input ref="firstName" className="Form-input Form-offset full" name="firstName" defaultValue={(userDetails) ? userDetails.first_name : ""} placeholder="Johnny" autoFocus={true} onChange={this.onChange.bind(this)} />
<span className="Form-charm"></span>
</div>
<div>
<FormLabel title="Last name" fieldName="last_name" formError={formError}></FormLabel>
<input ref="lastName" className="Form-input Form-offset" name="name" defaultValue={(userDetails) ? userDetails.last_name : ""} placeholder="Appleseed" required onChange={this.onChange.bind(this)} />
<input ref="lastName" className="Form-input Form-offset" name="lastName" defaultValue={(userDetails) ? userDetails.last_name : ""} placeholder="Appleseed" required onChange={this.onChange.bind(this)} />
<span className="Form-charm"></span>
</div>
</FormField>
......@@ -164,7 +164,7 @@ export default class UserStep extends Component {
<FormField fieldName="site_name" formError={formError}>
<FormLabel title="Your company or team name" fieldName="site_name" formError={formError}></FormLabel>
<input ref="siteName" className="Form-input Form-offset full" name="site_name" type="text" defaultValue={(userDetails) ? userDetails.site_name : ""} placeholder="Department of awesome" required onChange={this.onChange.bind(this)} />
<input ref="siteName" className="Form-input Form-offset full" name="siteName" type="text" defaultValue={(userDetails) ? userDetails.site_name : ""} placeholder="Department of awesome" required onChange={this.onChange.bind(this)} />
<span className="Form-charm"></span>
</FormField>
......
import { isReady } from "../support/start-server";
import { waitForUrl, screenshot } from "../support/utils";
import { setup, cleanup } from "../support/setup";
import { By, until } from "selenium-webdriver";
import { waitForUrl, screenshot } from "../support/utils";
import { delay } from '../../../src/metabase/lib/promise';
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
......
import { isReady } from "../support/start-server";
import { setup, cleanup } from "../support/setup";
import { By, until } from "selenium-webdriver";
import { waitForUrl, screenshot } from "../support/utils";
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
const signupMetabase = async (driver) => {
await driver.findElement(By.css(".Button.Button--primary")).click();
await driver.wait(until.elementLocated(By.css("[name=firstName]")));
const nextButton = driver.findElement(By.css(".Button[disabled]"));
await driver.findElement(By.css("[name=firstName]")).sendKeys('1234');
await driver.findElement(By.css("[name=lastName]")).sendKeys('1234');
await driver.findElement(By.css("[name=email]")).sendKeys('1234@1234.com');
await driver.findElement(By.css("[name=password]")).sendKeys('12341234');
await driver.findElement(By.css("[name=passwordConfirm]")).sendKeys('12341234');
await driver.findElement(By.css("[name=siteName]")).sendKeys('1234');
expect(await nextButton.isEnabled()).toBe(true);
await nextButton.click();
};
describe("setup/setup", () => {
let server, sauceConnect, driver;
beforeAll(async () => {
({ server, sauceConnect, driver } = await setup({ dbKey: "frontend/test/e2e/support/fixtures/init.db" }));
});
it ("should start", async () => {
expect(await isReady(server.host)).toEqual(true);
});
describe("onboarding", () => {
it("should take you to the welcome page", async () => {
await driver.get(`${server.host}/`);
await waitForUrl(driver, `${server.host}/setup`);
const welcomeText = await driver.findElement(By.css("h1.text-brand"))
.getText();
expect(welcomeText).toEqual('Welcome to Metabase');
await screenshot(driver, "screenshots/init-setup.png");
});
it("should allow you to sign up", async () => {
await driver.get(`${server.host}/`);
await waitForUrl(driver, `${server.host}/setup`);
await signupMetabase(driver);
});
});
afterAll(async () => {
await cleanup({ server, sauceConnect, driver });
});
});
File added
......@@ -3,7 +3,7 @@ import { startServer } from "./start-server";
import { createDriver } from "./driver";
export const setup = async ({
dbKey = "frontend/test/e2e/support/fixtures/setup.db"
dbKey = "frontend/test/e2e/support/fixtures/metabase.db"
} = {}) => {
const [server, sauceConnect] = await Promise.all([
startServer(dbKey),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment