Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New onboarding tests for setting up datasets and datasources for new users #1737

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 45 additions & 1 deletion thirdeye-ui/e2e/pages/onboarding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { BasePage } from "./base";

export class OnboardingPage extends BasePage {
readonly page: Page;
datasourceApiResponse: any;

constructor(page: Page) {
super(page);
Expand Down Expand Up @@ -65,13 +66,27 @@ export class OnboardingPage extends BasePage {
}

async resolveDataSourcesApi() {
const [datasetsApiResponse] = await Promise.all([
const [datasourceApiResponse] = await Promise.all([
this.page.waitForResponse(
(response) =>
response.url().includes("/api/data-sources") &&
response.status() === 200
),
]);
this.datasourceApiResponse = await datasourceApiResponse.json();
}

async resolveDataSetApi() {
const [dataSetApiResponse] = await Promise.all([
this.page.waitForResponse(
(response) =>
response
.url()
.includes(
`/api/data-sources/${this.datasourceApiResponse[0]?.id}/datasets`
) && response.status() === 200
),
]);
}

async goToWelcomeLanding() {
Expand Down Expand Up @@ -131,4 +146,33 @@ export class OnboardingPage extends BasePage {
async clickConfigureDataButton() {
await this.page.getByRole("button", { name: "Configure Data" }).click();
}

async selectDataSources() {
await this.page.click(
`span:text("${
this.datasourceApiResponse
? this.datasourceApiResponse[0]?.name
: ""
}")`
);
await this.page.getByRole("button", { name: "Next" }).click();
}

async onboardDatasets() {
await expect(this.page.locator("h5").nth(1)).toHaveText(
"Onboard datasets for mypinot"
);

await this.page
.getByRole("button", { name: "Onboard Datasets" })
.click();
}

async selectOtherDataSources() {
await this.page.click(`span:text("Add new Pinot datasource")`);
await this.page.click(`span:text("mypinot")`);
await this.page.press(`span:text("mypinot")`, "Digit2");

await this.page.getByRole("button", { name: "Next" }).click();
}
}
51 changes: 51 additions & 0 deletions thirdeye-ui/e2e/tests/onboarding.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,54 @@ test("Add Datasets Button on Onboarding Page", async ({ page }) => {
await onboardingPage.resolveDataSourcesApi();
await onboardingPage.checkConfigurePageHeader();
});

test("Onboard Datasource", async ({ page }) => {
const onboardingPage = new OnboardingPage(page);
await page.route("*/**/api/alerts/count", async (route) => {
const json = {
count: 0,
};
await route.fulfill({ json });
});
await page.route("*/**/api/datasets", async (route) => {
const json = {};
await route.fulfill({ json });
});
await onboardingPage.goToWelcomeLanding();
await onboardingPage.resolveApis();
await onboardingPage.checkHeader();
await onboardingPage.checkConfigureCardHeader();
await onboardingPage.clickConfigureDataButton();
await onboardingPage.resolveDataSourcesApi();
await onboardingPage.checkConfigurePageHeader();
await onboardingPage.selectDataSources();
await onboardingPage.resolveDataSetApi();
await onboardingPage.onboardDatasets();
});

test("Onboard Datasource When Datasource Empty", async ({ page }) => {
const onboardingPage = new OnboardingPage(page);
await page.route("*/**/api/alerts/count", async (route) => {
const json = {
count: 0,
};
await route.fulfill({ json });
});
await page.route("*/**/api/datasets", async (route) => {
const json = {};
await route.fulfill({ json });
});

await onboardingPage.goToWelcomeLanding();
await onboardingPage.resolveApis();
await onboardingPage.checkHeader();
await onboardingPage.checkConfigureCardHeader();
await page.route("*/**/api/data-sources", async (route) => {
const json = [];
await route.fulfill({ json });
});
await onboardingPage.clickConfigureDataButton();
await onboardingPage.resolveDataSourcesApi();
await onboardingPage.checkConfigurePageHeader();
await onboardingPage.selectOtherDataSources();
});
Loading