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

fix: failed tests because of new dashboard building #5866

Open
wants to merge 1 commit 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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (C) 2021-2024 GoodData Corporation
// (C) 2021-2025 GoodData Corporation

import * as Navigation from "../../tools/navigation";
import { Dashboard, FilterBar, TopBar } from "../../tools/dashboards";
Expand Down Expand Up @@ -129,7 +129,7 @@ describe("Dashboard actions", () => {
"should able to scroll vertical/ horizontal on widget",
{ tags: ["checklist_integrated_tiger"] },
() => {
const table = new Table(".s-dash-item-0");
const table = new Table(".s-dash-item-0_0");

Navigation.visit("dashboard/dashboard-many-rows-columns");
editMode.edit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { DashboardHeader } from "../../tools/dashboardHeader";
import { DashboardMenu } from "../../tools/dashboardMenu";

const editMode = new EditMode();
const widget = new Widget(1);
const widget = new Widget(0, 1);
const addedWidget = new Widget(0);
const header = new DashboardHeader();
const layoutRow = new LayoutRow(0);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// (C) 2024 GoodData Corporation
// (C) 2024-2025 GoodData Corporation

import * as Navigation from "../../tools/navigation";
import { Chart } from "../../tools/chart";

describe("Scatter Plot - Segmentation", { tags: ["pre-merge_isolated_tiger"] }, () => {
it("should grouped points by segmentation", () => {
Navigation.visit("dashboard/dashboard-scatter-plot-segmentation");
const chart = new Chart(".s-dash-item-0");
const chart = new Chart(".s-dash-item-0_0");
chart
.waitLoaded()
.waitComputed()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
// (C) 2023 GoodData Corporation
// (C) 2023-2025 GoodData Corporation

import { Dashboard } from "../../tools/dashboards";
import * as Navigation from "../../tools/navigation";
import { Widget } from "../../tools/widget";

const LEGEND_NAME_CSS = ".series-name";
const TOOLTIP_TITLE_CSS = ".gd-viz-tooltip-title";
const dashboard = new Dashboard();

describe("Dashboard Shorten Metric Name", { tags: ["checklist_integrated_tiger"] }, () => {
beforeEach(() => {
Navigation.visit("dashboard/shorten-metric-name");
dashboard.isLoaded();
});

it("Table should shorten metric name", () => {
const table = new Widget(0).waitTableLoaded();
table.getTable().assertShortenMetricName(496);
table.getTable().assertShortenMetricName(504);
});

it("Column chart should shorten metric name in legend", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (C) 2021 GoodData Corporation
// (C) 2021-2025 GoodData Corporation

import * as Navigation from "../../tools/navigation";
import { Dashboard } from "../../tools/dashboards";
Expand All @@ -20,11 +20,11 @@ describe("Dashboard with charts", { tags: ["pre-merge_isolated_tiger"] }, () =>

// the internals are already covered in storybook,
// let's just check charts were rendered
new Widget(0).getChart().isHighchartsChart();
new Widget(1).getChart().isHighchartsChart();
new Widget(2).getChart().isHighchartsChart();
new Widget(3).getChart().isHighchartsChart();
new Widget(4).getChart().isHighchartsChart();
new Widget(0, 0).getChart().isHighchartsChart();
new Widget(1, 0).getChart().isHighchartsChart();
new Widget(2, 0).getChart().isHighchartsChart();
new Widget(3, 0).getChart().isHighchartsChart();
new Widget(0, 1).getChart().isHighchartsChart();
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const stateFilter = new AttributeFilter("State");
const cityFilter = new AttributeFilter("City");
const product = new AttributeFilter("Product");
const stageName = new AttributeFilter("Stage Name");
const table = new Table(".s-dash-item-0");
const table = new Table(".s-dash-item-0_0");
const topBar = new TopBar();

describe("Dependent filter", () => {
Expand Down Expand Up @@ -111,7 +111,6 @@ describe("Dependent filter", () => {

it("should test parent - child interaction in edit mode", { tags: "checklist_integrated_tiger" }, () => {
topBar.enterEditMode().editButtonIsVisible(false);

table
.waitLoaded()
.getColumnValues(1)
Expand Down Expand Up @@ -241,7 +240,7 @@ describe("Dependent filter", () => {
stateFilter.isLoaded().open().hasSubtitle("All").hasFilterListSize(48);
cityFilter.isLoaded().open().hasSubtitle("All").hasFilterListSize(300);
});

it(
"child filter can reduce to zero element by parent filter",
{ tags: "checklist_integrated_tiger" },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (C) 2023-2024 GoodData Corporation
// (C) 2023-2025 GoodData Corporation

import * as Navigation from "../../tools/navigation";
import { Widget } from "../../tools/widget";
Expand Down Expand Up @@ -52,28 +52,30 @@ describe("Insight on dashboard", () => {

//drag to beginning of a row
dashboard.getWidget(0).dragBefore("TableWithHyperlinkAttribute");
dashboard.hasPlaceholderText("Drop here");
dashboard.hasDropTargetBorderActive();
cy.get(".s-cancel_button").trigger("dragleave");

//drag to the end of a row
dashboard.getWidget(2).dragAfter("ComboChart");
dashboard.hasPlaceholderText("Drop to the existing section");
dashboard.hasDropTargetBorderActive();
cy.get(".s-cancel_button").trigger("dragleave");

//drag to between of 2 widgets
dashboard.getWidget(0).dragAfter("Headline");
dashboard.hasPlaceholderText("Drop here");
dashboard.hasDropTargetBorderActive();
});

it("can remove widgets after drap&drop", { tags: ["pre-merge_isolated_tiger"] }, () => {
dashboard.getRow(2).scrollIntoView().addLast("ComboChart");
dashboard.hasRowsCount(4);

new Widget(5).scrollIntoView().removeVizWidget();
new Widget(0, 3).scrollIntoView().removeVizWidget();
dashboard.hasRowsCount(3);
});
});

//Cover ticket: RAIL-4715
//Cover ticket: RAIL-4715
describe("Be able to resize widgeton dashboard", () => {
it(
"should able to resize widget when is placed next to other in one row",
{ tags: ["checklist_integrated_tiger"] },
Expand All @@ -84,8 +86,8 @@ describe("Insight on dashboard", () => {
insightCatalog.waitForCatalogReload();
dashboard.getWidget(0).add("WithOwnDescription", "prev");
dashboard.waitItemLoaded();
dashboard.getWidget(0).hasWidth(6).resizeWidthTo(4).hasWidth(4);
dashboard.getWidget(1).hasWidth(6).resizeWidthTo(12).hasWidth(8);
dashboard.getWidget(0).hasWidth(4).resizeWidthTo(2).hasWidth(2);
dashboard.getWidget(1).hasWidth(6).resizeWidthTo(12).hasWidth(10);
},
);
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (C) 2021-2024 GoodData Corporation
// (C) 2021-2025 GoodData Corporation

import * as Navigation from "../../tools/navigation";

Expand Down Expand Up @@ -46,8 +46,8 @@ describe("Interaction", () => {
new CustomURLDialog().hasItem("Created");
widgetConfig.closeCustomURLDialog().close();

const widget2 = new Widget(2);
const widgetConfig2 = new WidgetConfiguration(2);
const widget2 = new Widget(0, 1);
const widgetConfig2 = new WidgetConfiguration(0, 1);
widget2.scrollIntoView().waitChartLoaded().focus();
widgetConfig2.openInteractions().addInteraction("Sum of Amount", "measure");
widgetConfig2
Expand All @@ -63,7 +63,7 @@ describe("Interaction", () => {
"should display correct insight name on invalid interaction warning",
{ tags: ["checklist_integrated_tiger"] },
() => {
const widget1 = new Widget(1);
const widget1 = new Widget(0, 1);
const message = new Messages();

Navigation.visit("dashboard/dashboard-many-rows-columns");
Expand All @@ -82,7 +82,7 @@ describe("Interaction", () => {
.clickShowMore()
.hasInsightNameIsBolder(true, "Visualization has invalid interaction rename");
widget1.waitChartLoaded().scrollIntoView().focus();
new WidgetConfiguration(1).removeFromDashboard();
new WidgetConfiguration(0, 1).removeFromDashboard();
message.hasWarningMessage(false);
},
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (C) 2023-2024 GoodData Corporation
// (C) 2023-2025 GoodData Corporation

import * as Navigation from "../../tools/navigation";
import { Widget } from "../../tools/widget";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (C) 2023 GoodData Corporation
// (C) 2023-2025 GoodData Corporation
import * as Navigation from "../../tools/navigation";
import { Export } from "../../tools/export";
import { TopBar } from "../../tools/dashboards";
Expand Down Expand Up @@ -36,7 +36,7 @@ describe("Export dashboard", { tags: ["checklist_integrated_tiger_export"] }, ()
describe("Pivot Table with multi format metrics", { tags: ["checklist_integrated_tiger"] }, () => {
it("should render insight with multi format metrics correctly", () => {
Navigation.visit("dashboard/dashboard-pivot-table-scenario");
const table = new Widget(1).waitTableLoaded().getTable();
const table = new Widget(0, 1).waitTableLoaded().getTable();
table.waitLoaded();
table.hasCellValue(6, 1, "Closed Won");
table.hasCellValue(6, 2, "██████████");
Expand Down
8 changes: 8 additions & 0 deletions libs/sdk-ui-tests-e2e/cypress/support/featureHub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ beforeEach(() => {
type: "BOOLEAN",
value: true,
},
{
id: "a1b2c3d4-e5f6-7a8b-9c0d-1e2f3a4b5c6d",
key: "enableDashboardFlexibleLayout",
l: false,
version: 42,
type: "BOOLEAN",
value: true,
},
],
},
],
Expand Down
18 changes: 16 additions & 2 deletions libs/sdk-ui-tests-e2e/cypress/tools/dashboards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class Dashboard {
}

getDashboardBodyElement(): Cypress.Chainable {
return cy.get(".s-fluid-layout-container");
return cy.get(".gd-grid-layout__container--root");
}

topBarExist(exist = true): this {
Expand Down Expand Up @@ -68,7 +68,7 @@ export class Dashboard {
}

hasRowsCount(count: number) {
cy.get(".s-fluid-layout-row").should("have.length", count);
cy.get(".gd-grid-layout__section").should("have.length", count);
return this;
}

Expand All @@ -81,12 +81,26 @@ export class Dashboard {
return this;
}

hasDropTargetBorderActive() {
cy.get(".gd-hotspot-border__drop-target.active").should("exist");
return this;
}

waitItemLoaded() {
cy.wait(500);
this.getDashboardBodyElement()
.find(".dash-item.type-loading", { timeout: getMaximumTimeout() })
.should("not.exist");
}

isLoaded() {
cy.get(".catalog-is-loaded .dash-section").should("exist");
cy.get(".s-loading-spinner").should("not.exist");
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(1000);
cy.get(".s-loading", { timeout: 60000 }).should("not.exist");
return this;
}
}

export class TopBar {
Expand Down
4 changes: 2 additions & 2 deletions libs/sdk-ui-tests-e2e/cypress/tools/layoutRow.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (C) 2021-2024 GoodData Corporation
// (C) 2021-2025 GoodData Corporation

import { InsightsCatalog, InsightTitle } from "./insightsCatalog";
import { SectionHeader } from "./sectionHeader";
Expand All @@ -9,7 +9,7 @@ export class LayoutRow {
constructor(private rowIndex: number) {}

getSelector() {
return `.s-fluid-layout-row:nth-child(${this.rowIndex + 1})`;
return `.gd-grid-layout__section:nth-child(${this.rowIndex + 1})`;
}

getElement() {
Expand Down
2 changes: 1 addition & 1 deletion libs/sdk-ui-tests-e2e/cypress/tools/navigation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (C) 2021-2024 GoodData Corporation
// (C) 2021-2025 GoodData Corporation
import { ISettings } from "@gooddata/sdk-model";
import { getHost } from "../support/constants";
import VisitOptions = Cypress.VisitOptions;
Expand Down
4 changes: 2 additions & 2 deletions libs/sdk-ui-tests-e2e/cypress/tools/richText.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (C) 2021-2024 GoodData Corporation
// (C) 2021-2025 GoodData Corporation

export class RichText {
constructor(private parentSelector: string) {}
Expand Down Expand Up @@ -74,7 +74,7 @@ export class RichText {
}

confirmChanges() {
this.getConfirmButtonElement().click();
this.getConfirmButtonElement().click({ force: true });
this.isView();
return this;
}
Expand Down
6 changes: 3 additions & 3 deletions libs/sdk-ui-tests-e2e/cypress/tools/sectionHeader.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// (C) 2021-2024 GoodData Corporation
// (C) 2021-2025 GoodData Corporation
export class SectionHeader {
constructor(private rowIndex: number) {}

getSelector() {
return `.s-fluid-layout-row:nth-child(${this.rowIndex + 1})`;
return `.gd-grid-layout__section:nth-child(${this.rowIndex + 1})`;
}

getElement() {
Expand Down Expand Up @@ -43,7 +43,7 @@ export class SectionHeader {
}

setTitle(text: string) {
this.getTitleInputWrapper().click().find("textarea").type(`${text}{enter}`);
this.getTitleInputWrapper().click({ force: true }).find("textarea").type(`${text}{enter}`);
return this;
}

Expand Down
10 changes: 5 additions & 5 deletions libs/sdk-ui-tests-e2e/cypress/tools/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import { Headline } from "./headline";
import { RichText } from "./richText";

export class Widget {
constructor(private index: number) {}
constructor(private index: number, private section: number = 0) {}

getElementSelector() {
return `.s-dash-item-${this.index}`;
return `.s-dash-item-${this.section}_${this.index}`;
}

getElement() {
Expand Down Expand Up @@ -118,9 +118,9 @@ export class Widget {
* @returns
*/
hasWidth(size: number) {
this.getElement()
.parents(".s-fluid-layout-column")
.should("have.class", `s-fluid-layout-column-width-${size}`);
cy.get(this.getElementSelector())
.parents(".gd-grid-layout__item")
.should("have.class", `gd-grid-layout__item--span-${size}`);
return this;
}

Expand Down
11 changes: 8 additions & 3 deletions libs/sdk-ui-tests-e2e/cypress/tools/widgetConfiguration.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (C) 2021-2024 GoodData Corporation
// (C) 2021-2025 GoodData Corporation

import { getTestClassByTitle } from "../support/commands/tools/classes";

Expand All @@ -13,14 +13,19 @@ import {

export type InteractionType = "measure" | "attribute";
export class WidgetConfiguration {
constructor(private widgetIndex: number) {}
constructor(private widgetIndex: number, private section: number = 0) {}

getElement() {
return cy.get(".s-gd-configuration-bubble");
}

open() {
new Widget(this.widgetIndex).getElement().click().find(".dash-item-action").first().click();
new Widget(this.widgetIndex, this.section)
.getElement()
.click()
.find(".dash-item-action")
.first()
.click();
this.getElement().should("be.visible");
return this;
}
Expand Down
Loading