Skip to content

Commit

Permalink
Explore E2E pass 1 - Fix model and explore editing
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaHegde committed Sep 26, 2024
1 parent 7f51d3d commit 611836e
Show file tree
Hide file tree
Showing 16 changed files with 126 additions and 223 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
import MetricsIcon from "@rilldata/web-common/components/icons/Metrics.svelte";
import LocalAvatarButton from "@rilldata/web-common/features/authentication/LocalAvatarButton.svelte";
import GlobalDimensionSearch from "@rilldata/web-common/features/dashboards/dimension-search/GlobalDimensionSearch.svelte";
import { useExplore } from "@rilldata/web-common/features/explores/selectors";
import { Button } from "../../../components/button";
import { runtime } from "../../../runtime-client/runtime-store";
import { featureFlags } from "../../feature-flags";
import ViewAsButton from "../granular-access-policies/ViewAsButton.svelte";
import { useDashboardPolicyCheck } from "../granular-access-policies/useDashboardPolicyCheck";
import { useMetricsView } from "../selectors";
import DeployDashboardCta from "./DeployDashboardCTA.svelte";
export let metricsViewName: string;
export let exploreName: string;
$: metricsViewQuery = useMetricsView($runtime.instanceId, metricsViewName);
$: filePath = $metricsViewQuery.data?.meta?.filePaths?.[0] ?? "";
$: exploreQuery = useExplore($runtime.instanceId, exploreName);
$: filePath = $exploreQuery.data?.explore?.meta?.filePaths?.[0] ?? "";
$: dashboardPolicyCheck = useDashboardPolicyCheck(
$runtime.instanceId,
Expand Down
2 changes: 1 addition & 1 deletion web-common/src/features/file-explorer/new-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export function getBaseNameForNewResourceFile(
? `${baseResource.meta!.name!.name}_explore`
: ResourceKindMap[newKind].baseName;
default:
return ResourceKindMap[newKind].baseFileName;
return ResourceKindMap[newKind].baseName;
}
}

Expand Down
2 changes: 1 addition & 1 deletion web-local/src/routes/(viz)/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
</span>
{#if route.id?.includes("explore") && metricsViewName}
<StateManagersProvider {metricsViewName} exploreName={dashboardName}>
<DashboardCtAs {metricsViewName} />
<DashboardCtAs {metricsViewName} exploreName={dashboardName} />
</StateManagersProvider>
{/if}
</header>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, test } from "@playwright/test";
import { useDashboardFlowTestSetup } from "web-local/tests/dashboards/dashboard-flow-test-setup";
import { useDashboardFlowTestSetup } from "web-local/tests/explores/dashboard-flow-test-setup";
import { startRuntimeForEachTest } from "../utils/startRuntimeForEachTest";

test.describe("~~~~~~~~~~~~~~~~~~~~FIXME RENAME THIS~~~~~~~~~~~~~~~~~~~~~~~", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createDashboardFromModel } from "web-local/tests/utils/dashboardHelpers";
import { createMetricsViewFromModel } from "web-local/tests/utils/metricsViewHelpers";
import { createAdBidsModel } from "web-local/tests/utils/dataSpecifcHelpers";
import { test } from "../utils/test";
import { waitForFileNavEntry } from "../utils/waitHelpers";
Expand All @@ -14,7 +14,7 @@ export function useDashboardFlowTestSetup() {
`/dashboards/AdBids_model_dashboard.yaml`,
true,
),
createDashboardFromModel(page, "/models/AdBids_model.sql"),
createMetricsViewFromModel(page, "/models/AdBids_model.sql"),
]);
});
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from "@playwright/test";
import { useDashboardFlowTestSetup } from "web-local/tests/dashboards/dashboard-flow-test-setup";
import { useDashboardFlowTestSetup } from "web-local/tests/explores/dashboard-flow-test-setup";
import { test } from "../utils/test";
import { clickMenuButton } from "../utils/commonHelpers";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { expect } from "@playwright/test";
import {
createExploreFromModel,
createExploreFromSource,
} from "web-local/tests/utils/exploreHelpers";
import { ResourceWatcher } from "web-local/tests/utils/ResourceWatcher";
import { updateCodeEditor, wrapRetryAssertion } from "../utils/commonHelpers";
import {
assertLeaderboards,
createDashboardFromModel,
createDashboardFromSource,
createMetricsViewFromModel,
createMetricsViewFromSource,
interactWithTimeRangeMenu,
} from "../utils/dashboardHelpers";
} from "web-local/tests/utils/metricsViewHelpers";
import {
assertAdBidsDashboard,
createAdBidsModel,
Expand All @@ -15,26 +19,38 @@ import { createSource } from "../utils/sourceHelpers";
import { test } from "../utils/test";
import { waitForFileNavEntry } from "../utils/waitHelpers";

test.describe("dashboard", () => {
test("Autogenerate dashboard from source", async ({ page }) => {
test.describe("explores", () => {
test("Autogenerate explore from source", async ({ page }) => {
await createSource(page, "AdBids.csv", "/sources/AdBids.yaml");
await createDashboardFromSource(page, "/sources/AdBids.yaml");
await waitForFileNavEntry(page, `/dashboards/AdBids_dashboard.yaml`, true);
await createExploreFromSource(
page,
"/sources/AdBids.yaml",
"/metrics/AdBids_metrics.yaml",
);
await waitForFileNavEntry(
page,
"/explore-dashboards/AdBids_metrics_explore.yaml",
true,
);
await page.getByRole("button", { name: "Preview" }).click();
// Temporary timeout while the issue is looked into
await page.waitForTimeout(1000);
await assertAdBidsDashboard(page);
});

test("Autogenerate dashboard from model", async ({ page }) => {
test("Autogenerate explore from model", async ({ page }) => {
await createAdBidsModel(page);
await Promise.all([
waitForFileNavEntry(
page,
`/dashboards/AdBids_model_dashboard.yaml`,
"/explore-dashboards/AdBids_model_metrics_explore.yaml",
true,
),
createDashboardFromModel(page, "/models/AdBids_model.sql"),
createExploreFromModel(
page,
"/models/AdBids_model.sql",
"/metrics/AdBids_model_metrics.yaml",
),
]);

await page.getByRole("button", { name: "Preview" }).click();
Expand Down Expand Up @@ -69,7 +85,7 @@ test.describe("dashboard", () => {
const watcher = new ResourceWatcher(page);

await createAdBidsModel(page);
await createDashboardFromModel(page, "/models/AdBids_model.sql");
await createMetricsViewFromModel(page, "/models/AdBids_model.sql");
await page.getByRole("button", { name: "Preview" }).click();

// Check the total records are 100k
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, type Locator } from "@playwright/test";
import { useDashboardFlowTestSetup } from "web-local/tests/dashboards/dashboard-flow-test-setup";
import { useDashboardFlowTestSetup } from "web-local/tests/explores/dashboard-flow-test-setup";
import { test } from "../utils/test";

async function assertAAboveB(locA: Locator, locB: Locator) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from "@playwright/test";
import { ResourceWatcher } from "web-local/tests/utils/ResourceWatcher";
import { clickMenuButton } from "../utils/commonHelpers";
import { interactWithTimeRangeMenu } from "../utils/dashboardHelpers";
import { interactWithTimeRangeMenu } from "web-local/tests/utils/metricsViewHelpers";
import { test } from "../utils/test";
import { useDashboardFlowTestSetup } from "./dashboard-flow-test-setup";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useDashboardFlowTestSetup } from "web-local/tests/dashboards/dashboard-flow-test-setup";
import { useDashboardFlowTestSetup } from "web-local/tests/explores/dashboard-flow-test-setup";
import { ResourceWatcher } from "web-local/tests/utils/ResourceWatcher";
import { interactWithTimeRangeMenu } from "../utils/dashboardHelpers";
import { interactWithTimeRangeMenu } from "web-local/tests/utils/metricsViewHelpers";
import { expect } from "@playwright/test";
import { test } from "../utils/test";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from "@playwright/test";
import { useDashboardFlowTestSetup } from "web-local/tests/dashboards/dashboard-flow-test-setup";
import { interactWithTimeRangeMenu } from "web-local/tests/utils/dashboardHelpers";
import { useDashboardFlowTestSetup } from "web-local/tests/explores/dashboard-flow-test-setup";
import { interactWithTimeRangeMenu } from "web-local/tests/utils/metricsViewHelpers";
import { ResourceWatcher } from "web-local/tests/utils/ResourceWatcher";
import { test } from "../utils/test";

Expand Down
195 changes: 0 additions & 195 deletions web-local/tests/utils/dashboardHelpers.ts

This file was deleted.

2 changes: 1 addition & 1 deletion web-local/tests/utils/dataSpecifcHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
waitForProfiling,
wrapRetryAssertion,
} from "./commonHelpers";
import { assertLeaderboards } from "./dashboardHelpers";
import { assertLeaderboards } from "web-local/tests/utils/metricsViewHelpers";
import { createModel } from "./modelHelpers";
import { uploadFile, waitForSource } from "./sourceHelpers";

Expand Down
Loading

0 comments on commit 611836e

Please sign in to comment.