Skip to content
Snippets Groups Projects
Commit ae5ffb09 authored by Atte Keinänen's avatar Atte Keinänen
Browse files

Remove old dashboards selenium tests

parent 499c39dd
Branches test-flakiness
Tags
No related merge requests found
/* eslint-disable */
// NOTE Atte Keinänen 28/8/17: Should be converted to Jest/Enzyme, should be pretty straight-forward.
import {
ensureLoggedIn,
describeE2E
} from "../support/utils";
import {
createDashboardInEmptyState, getLatestDashboardUrl, getPreviousDashboardUrl,
incrementDashboardCount, removeCurrentDash
} from "./dashboards.utils"
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
describeE2E("dashboards/dashboards", () => {
describe("dashboards list", () => {
beforeEach(async () => {
await ensureLoggedIn(server, driver, "bob@metabase.com", "12341234");
});
// TODO Atte Keinänen 6/22/17: Failing test, disabled until converted to use Jest and Enzyme
xit("should let you create new dashboards, see them, filter them and enter them", async () => {
await d.get("/dashboards");
await d.screenshot("screenshots/dashboards.png");
await createDashboardInEmptyState();
// Return to the dashboard list and re-enter the card through the list item
await driver.get(`${server.host}/dashboards`);
await d.select(".Grid-cell > a").wait().click();
await d.waitUrl(getLatestDashboardUrl());
// Create another one
await d.get(`${server.host}/dashboards`);
await d.select(".Icon.Icon-add").wait().click();
await d.select("#CreateDashboardModal input[name='name']").wait().sendKeys("Some Excessively Long Dashboard Title Just For Fun");
await d.select("#CreateDashboardModal input[name='description']").wait().sendKeys("");
await d.select("#CreateDashboardModal .Button--primary").wait().click();
incrementDashboardCount();
await d.waitUrl(getLatestDashboardUrl());
// Test filtering
await d.get(`${server.host}/dashboards`);
await d.select("input[type='text']").wait().sendKeys("this should produce no results");
await d.select("img[src*='empty_dashboard']");
// Should search from both title and description
await d.select("input[type='text']").wait().clear().sendKeys("usual response times");
await d.select(".Grid-cell > a").wait().click();
await d.waitUrl(getPreviousDashboardUrl(1));
// Should be able to favorite and unfavorite dashboards
await d.get("/dashboards")
await d.select(".Grid-cell > a .favoriting-button").wait().click();
await d.select(":react(ListFilterWidget)").wait().click();
await d.select(".PopoverBody--withArrow li > h4:contains(Favorites)").wait().click();
await d.select(".Grid-cell > a .favoriting-button").wait().click();
await d.select("img[src*='empty_dashboard']");
await d.select(":react(ListFilterWidget)").wait().click();
await d.select(".PopoverBody--withArrow li > h4:contains(All dashboards)").wait().click();
// Should be able to archive and unarchive dashboards
// TODO: How to test objects that are in hover?
// await d.select(".Grid-cell > a .archival-button").wait().click();
// await d.select(".Icon.Icon-viewArchive").wait().click();
// Remove the created dashboards to prevent clashes with other tests
await d.get(getPreviousDashboardUrl(1));
await removeCurrentDash();
// Should return to dashboard page where only one dash left
await d.select(".Grid-cell > a").wait().click();
await removeCurrentDash();
});
});
});
/* eslint-disable */
export var dashboardCount = 0
export const incrementDashboardCount = () => {
dashboardCount += 1;
}
export const getLatestDashboardUrl = () => {
return `/dashboard/${dashboardCount}`
}
export const getPreviousDashboardUrl = (nFromLatest) => {
return `/dashboard/${dashboardCount - nFromLatest}`
}
export const createDashboardInEmptyState = async () => {
await d.get("/dashboards");
// Create a new dashboard in the empty state (EmptyState react component)
await d.select(".Button.Button--primary").wait().click();
await d.select("#CreateDashboardModal input[name='name']").wait().sendKeys("Customer Feedback Analysis");
await d.select("#CreateDashboardModal input[name='description']").wait().sendKeys("For seeing the usual response times, feedback topics, our response rate, how often customers are directed to our knowledge base instead of providing a customized response");
await d.select("#CreateDashboardModal .Button--primary").wait().click();
incrementDashboardCount();
await d.waitUrl(getLatestDashboardUrl());
}
export const removeCurrentDash = async () => {
await d.select(".Icon.Icon-pencil").wait().click();
await d.select(".EditHeader .flex-align-right a:nth-of-type(2)").wait().click();
await d.select(".Button.Button--danger").wait().click();
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment