diff --git a/cypress/e2e/1-dx/2-datasets.cy.ts b/cypress/e2e/1-dx/2-datasets.cy.ts index 9c5c5f27a..b86f71ca4 100644 --- a/cypress/e2e/1-dx/2-datasets.cy.ts +++ b/cypress/e2e/1-dx/2-datasets.cy.ts @@ -31,6 +31,22 @@ describe("Testing connecting data on DX", () => { cy.get('[data-cy="home-connect-dataset-button"]').click(); }); + it("Can filter results by source in the federated search", () => { + cy.intercept(`${apiUrl}/external-sources/search?q=*`).as("getDefaultData"); + cy.wait("@getDefaultData").then((interception) => { + cy.get('[data-cy="external-search-card-Kaggle"]').should( + "have.length.greaterThan", + 1 + ); + }); + + cy.contains('[data-cy="source-category-button"]', "WHO").click(); + cy.wait("@getDefaultData"); + + cy.get('[data-cy="external-search-card-Kaggle"]').should("have.length", 0); + cy.get('[data-cy="external-search-card-WHO"]').should("be.visible"); + }); + it("Can import data from External Search", () => { cy.intercept(`${apiUrl}/external-sources/search?q=*`).as("getDefaultData"); diff --git a/cypress/e2e/1-dx/4-reports.cy.ts b/cypress/e2e/1-dx/4-reports.cy.ts index e9fec3630..7ecc50251 100644 --- a/cypress/e2e/1-dx/4-reports.cy.ts +++ b/cypress/e2e/1-dx/4-reports.cy.ts @@ -241,6 +241,33 @@ describe("Edit, duplicate and delete report", () => { cy.contains(`${reportTestName} - Edited`).should("be.visible"); }); + it("Can drag and drop rows in a report", () => { + cy.get("[data-cy=home-search-button]").click(); + cy.get("[data-cy=home-search-input]").type( + `{selectall}{backspace}${reportTestName}` + ); + + cy.wait("@fetchReports"); + + cy.contains('[data-cy="report-grid-item"]', `${reportTestName} - Edited`) + .first() + .scrollIntoView() + .within(() => { + cy.get('[data-cy="report-grid-item-menu-btn"]').click(); + }); + + cy.intercept(`${apiUrl}/report/*`).as("fetchReport"); + + cy.get('[data-cy="report-grid-item-edit-btn"]').click(); + + cy.wait("@fetchReport"); + + cy.get('[data-cy="row-frame-container-0"]').within(() => { + cy.get('[data-cy="row-frame-handle"]').drag(); + }); + cy.get('[data-cy="report-row-placeholder"]').eq(2).scrollIntoView().drop(); + }); + it("Can Duplicate a report", () => { cy.get("[data-cy=home-search-button]").click(); cy.get("[data-cy=home-search-input]").type( @@ -386,6 +413,101 @@ describe("Edit, duplicate and delete report", () => { ); }); + it("Can edit a chart from a report", () => { + cy.get("[data-cy=home-search-button]").click(); + cy.get("[data-cy=home-search-input]").type( + `{selectall}{backspace}${reportTestName}` + ); + + cy.wait("@fetchReports"); + + cy.contains( + '[data-cy="report-grid-item"]', + `${reportTestName} - Edited (Copy)` + ) + .first() + .scrollIntoView() + .within(() => { + cy.get('[data-cy="report-grid-item-menu-btn"]').click(); + }); + + cy.intercept(`${apiUrl}/report/*`).as("fetchReport"); + + cy.get('[data-cy="report-grid-item-edit-btn"]').click(); + + cy.wait("@fetchReport"); + + cy.intercept(`${apiUrl}/chart/*`).as("renderChart"); + cy.intercept(`${apiUrl}/chart/*/render`).as("renderChart2"); + + cy.get('[data-cy="row-frame-chart-item-0-1"]') + .trigger("mouseover") + .within(() => { + cy.get('[data-cy="edit-chart-button"]').click(); + }); + + cy.wait("@renderChart"); + cy.wait("@renderChart2"); + + cy.get('[data-cy="chart-toolbox-mapping-tab"]') + .invoke("attr", "disabled", false) + .trigger("mouseover") + .click(); + + cy.get('[data-cy="chart-toolbox-mapping-tab"]').click(); + + cy.location("pathname").should("include", "/mapping"); + cy.intercept(`${apiUrl}/chart/*`).as("saveChart2"); + + cy.get('[data-cy="report-sub-header-title-input"]').type( + `{selectall}{backspace}${chartTestName}-Edited` + ); + + cy.get('[data-cy="nonstatic-dimension-container"]') + .first() + .within(() => { + cy.get('[data-cy="chart-dimension-mapping-item"]').click(); + }); + + cy.get('[data-cy="chart-dimension-mapping-item"]').eq(2).click(); + + cy.intercept(`${apiUrl}/chart/*/render`).as("renderChart"); + + cy.get('[data-cy="chart-dimension-mapping-item"]').first().click(); + + cy.wait("@renderChart"); + + cy.get('[data-cy="common-chart-container"]').should("be.visible"); + + cy.get('[data-cy="toolbox-chart-next"]').click(); + + // cy.wait("@renderChart"); + + cy.get('[data-cy="toolbox-chart-next"]').click(); + + // cy.wait("@renderChart"); + + cy.get('[data-cy="toolbox-chart-next"]').click(); + + cy.wait("@saveChart2"); + + cy.intercept(`${apiUrl}/charts?filter=*`).as("fetchCharts"); + + cy.get('[data-cy="back-to-report-button"]').click(); + + cy.wait("@fetchCharts"); + + cy.get('[data-cy="report-panel-chart-search-input"]').type( + `${chartTestName}-Edited` + ); + cy.wait("@fetchCharts"); + + cy.contains( + '[data-cy="report-panel-chart-item"]', + `${chartTestName}-Edited` + ).should("be.visible"); + }); + it("Can delete a report", () => { cy.intercept("DELETE", `${apiUrl}/report/*`).as("deleteReport"); diff --git a/cypress/e2e/1-dx/5-dashboard.cy.ts b/cypress/e2e/1-dx/5-dashboard.cy.ts new file mode 100644 index 000000000..20de02a0a --- /dev/null +++ b/cypress/e2e/1-dx/5-dashboard.cy.ts @@ -0,0 +1,89 @@ +/// + +describe("Dashboard", () => { + const apiUrl = Cypress.env("api_url"); + beforeEach(() => { + cy.intercept("GET", `${apiUrl}/assets**`).as("fetchAssets"); + cy.intercept("GET", `${apiUrl}/datasets?filter=*`).as("fetchDatasets"); + cy.intercept("GET", `${apiUrl}/charts*`).as("fetchCharts"); + cy.intercept(`${apiUrl}/reports?filter=*`).as("fetchReports"); + + cy.restoreLocalStorageCache(); + cy.visit("/"); + + cy.get('[data-cy="cookie-btn"]').click(); + }); + + it("Can view all asset types on the dashboard", () => { + cy.get('[data-cy="home-all-tab"]').scrollIntoView().click(); + cy.wait("@fetchAssets"); + cy.get('[data-cy="dataset-grid-item"]').should("be.visible"); + cy.get('[data-cy="report-grid-item"]').should("be.visible"); + cy.get('[data-cy="dataset-grid-item"]').should("be.visible"); + }); + + it("Can filter datasets by category", () => { + cy.get('[data-cy="home-data-tab"]').scrollIntoView().click(); + cy.wait("@fetchDatasets"); + + cy.contains('[data-cy="dataset-category-button"]', "Social").click(); + cy.wait("@fetchDatasets"); + + cy.get('[data-cy="dataset-grid-item"]').should( + "have.length.greaterThan", + 0 + ); + }); + it("Can get to assets from the table view", () => { + cy.get('[data-cy="home-all-tab"]').scrollIntoView().click(); + cy.wait("@fetchAssets"); + + cy.get('[data-cy="home-table-view-button"]').click(); + + cy.get('[data-cy="homepage-table"]').within(() => { + cy.get('[data-cy="table-row-chart"]').first().click(); + }); + + cy.location("pathname").should("include", "/chart/"); + cy.visit("/"); + + cy.get('[data-cy="home-data-tab"]').scrollIntoView().click(); + cy.wait("@fetchDatasets"); + + cy.get('[data-cy="home-table-view-button"]').click(); + + cy.get('[data-cy="homepage-table"]').within(() => { + cy.get('[data-cy="table-row-dataset"]').first().click(); + }); + + cy.location("pathname").should("include", "/dataset/"); + + cy.visit("/"); + + cy.get('[data-cy="home-charts-tab"]').scrollIntoView().click(); + cy.wait("@fetchCharts"); + + cy.get('[data-cy="home-table-view-button"]').click(); + + cy.get('[data-cy="homepage-table"]').within(() => { + cy.get('[data-cy="table-row-chart"]').first().click(); + }); + + cy.location("pathname").should("include", "/chart/"); + + cy.visit("/"); + + cy.get('[data-cy="home-reports-tab"]').scrollIntoView().click(); + cy.wait("@fetchReports"); + + cy.get('[data-cy="home-table-view-button"]').click(); + + cy.get('[data-cy="homepage-table"]').within(() => { + cy.get('[data-cy="table-row-report"]').first().click(); + }); + + cy.location("pathname").should("include", "/report/"); + + cy.visit("/"); + }); +}); diff --git a/cypress/e2e/1-dx/5-home.cy.ts b/cypress/e2e/1-dx/6-home.cy.ts similarity index 100% rename from cypress/e2e/1-dx/5-home.cy.ts rename to cypress/e2e/1-dx/6-home.cy.ts diff --git a/cypress/support/e2e.ts b/cypress/support/e2e.ts index f80f74f8e..6a173d6fc 100644 --- a/cypress/support/e2e.ts +++ b/cypress/support/e2e.ts @@ -14,7 +14,7 @@ // *********************************************************** // Import commands.js using ES2015 syntax: -import './commands' +import "./commands"; // Alternatively you can use CommonJS syntax: -// require('./commands') \ No newline at end of file +// require('./commands') diff --git a/src/app/modules/dataset-upload-module/component/externalSourcesList.tsx b/src/app/modules/dataset-upload-module/component/externalSourcesList.tsx index 24356ce29..77d09b78d 100644 --- a/src/app/modules/dataset-upload-module/component/externalSourcesList.tsx +++ b/src/app/modules/dataset-upload-module/component/externalSourcesList.tsx @@ -59,6 +59,7 @@ export default function SourceCategoryList(props: Readonly) { props.setSources(fSource); } }} + data-cy="source-category-button" style={ props.sources.includes(s.value) ? { diff --git a/src/app/modules/home-module/components/Datasets/datasetCategoryList.tsx b/src/app/modules/home-module/components/Datasets/datasetCategoryList.tsx index 268042967..043738397 100644 --- a/src/app/modules/home-module/components/Datasets/datasetCategoryList.tsx +++ b/src/app/modules/home-module/components/Datasets/datasetCategoryList.tsx @@ -56,6 +56,7 @@ export default function DatasetCategoryList(props: Readonly) { props.setCategories(fCategory); } }} + data-cy="dataset-category-button" style={ props.categories.includes(c) ? { diff --git a/src/app/modules/home-module/components/Table/index.tsx b/src/app/modules/home-module/components/Table/index.tsx index 8bd42037f..84f278d2a 100644 --- a/src/app/modules/home-module/components/Table/index.tsx +++ b/src/app/modules/home-module/components/Table/index.tsx @@ -54,6 +54,7 @@ export function HomepageTable(props: { } } `} + data-cy="homepage-table" > {index + 1} {data.name} diff --git a/src/app/modules/home-module/index.tsx b/src/app/modules/home-module/index.tsx index ef0bf87ab..f21d7e085 100644 --- a/src/app/modules/home-module/index.tsx +++ b/src/app/modules/home-module/index.tsx @@ -371,6 +371,7 @@ export default function HomeModule() { setTableView(!tableView); }} css={iconButtonCss(tableView)} + data-cy="home-table-view-button" > diff --git a/src/app/modules/report-module/components/order-container/index.tsx b/src/app/modules/report-module/components/order-container/index.tsx index 6daa6df7c..b115fac41 100644 --- a/src/app/modules/report-module/components/order-container/index.tsx +++ b/src/app/modules/report-module/components/order-container/index.tsx @@ -70,6 +70,7 @@ export function ItemComponent(props: ItemComponentProps) { ? "none" : "flex"}; `} + data-cy="row-frame-handle" > diff --git a/src/app/modules/report-module/sub-module/rowStructure/rowStructureDisplay.tsx b/src/app/modules/report-module/sub-module/rowStructure/rowStructureDisplay.tsx index c18d4df51..4298101e7 100644 --- a/src/app/modules/report-module/sub-module/rowStructure/rowStructureDisplay.tsx +++ b/src/app/modules/report-module/sub-module/rowStructure/rowStructureDisplay.tsx @@ -551,6 +551,7 @@ const Box = (props: { ref={textResizableRef} onMouseEnter={() => setDisplayBoxIcons(true)} onMouseLeave={() => setDisplayBoxIcons(false)} + data-cy={`row-frame-text-item-${props.rowIndex}-${props.itemIndex}`} > {!viewOnlyMode && displayBoxIcons && ( setDisplayBoxIcons(false)} onFocus={() => setDisplayBoxIcons(true)} onBlur={() => setDisplayBoxIcons(false)} + data-cy={`row-frame-chart-item-${props.rowIndex}-${props.itemIndex}`} > {!viewOnlyMode && displayBoxIcons && (
@@ -662,6 +664,7 @@ const Box = (props: { setDisplayBoxIcons(true)} onMouseLeave={() => setDisplayBoxIcons(false)} + data-cy={`row-frame-video-item-${props.rowIndex}-${props.itemIndex}`} > {!viewOnlyMode && displayBoxIcons && ( setDisplayBoxIcons(true)} onMouseLeave={() => setDisplayBoxIcons(false)} + data-cy={`row-frame-image-item-${props.rowIndex}-${props.itemIndex}`} > {!viewOnlyMode && displayBoxIcons && ( { return ( -
+
{index === 0 && (