-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update Cypress configuration and tests for improved stability a…
…nd functionality
- Loading branch information
Showing
25 changed files
with
433 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
FROM cypress/browsers:chrome67 | ||
# FROM cypress/browsers:node16.13.0-chrome95-ff94 | ||
|
||
ENV APP /usr/src/app | ||
WORKDIR $APP | ||
|
||
COPY package.json $APP/package.json | ||
RUN npm run cypress:install > /dev/null | ||
COPY viz-lib $APP/viz-lib | ||
COPY plywood $APP/plywood | ||
COPY client $APP/client | ||
|
||
COPY client/cypress $APP/client/cypress | ||
COPY cypress.json $APP/cypress.json | ||
COPY . $APP | ||
|
||
RUN ./node_modules/.bin/cypress verify |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const { defineConfig } = require("cypress"); | ||
|
||
module.exports = defineConfig({ | ||
e2e: { | ||
baseUrl: "http://localhost:5000", | ||
defaultCommandTimeout: 20000, | ||
downloadsFolder: "cypress/downloads", | ||
fixturesFolder: "cypress/fixtures", | ||
requestTimeout: 15000, | ||
screenshotsFolder: "cypress/screenshots", | ||
specPattern: "cypress/integration/", | ||
supportFile: "cypress/support/index.js", | ||
video: true, | ||
videoUploadOnPasses: false, | ||
videosFolder: "cypress/videos", | ||
viewportHeight: 1024, | ||
viewportWidth: 1280, | ||
env: { | ||
coverage: false, | ||
}, | ||
}, | ||
|
||
component: { | ||
devServer: { | ||
framework: "react", | ||
bundler: "webpack", | ||
}, | ||
}, | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
describe("Dashboard list sort", () => { | ||
beforeEach(() => { | ||
cy.login(); | ||
}); | ||
|
||
it("creates one dashboard", () => { | ||
cy.visit("/dashboards"); | ||
cy.getByTestId("CreateButton").click(); | ||
cy.getByTestId("CreateDashboardMenuItem").click(); | ||
cy.getByTestId("CreateDashboardDialog").within(() => { | ||
cy.get("input").type("A Foo Bar"); | ||
cy.getByTestId("DashboardSaveButton").click(); | ||
}); | ||
}); | ||
|
||
describe("Sorting table does not crash page ", () => { | ||
it("sorts", () => { | ||
cy.visit("/dashboards"); | ||
cy.contains("Name").click(); | ||
cy.wait(1000); // eslint-disable-line cypress/no-unnecessary-waiting | ||
cy.getByTestId("ErrorMessage").should("not.exist"); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import { createQueryAndAddWidget } from "../../support/dashboard"; | ||
|
||
describe("Dashboard Parameters", () => { | ||
const parameters = [ | ||
{ name: "param1", title: "Parameter 1", type: "text", value: "example1" }, | ||
{ name: "param2", title: "Parameter 2", type: "text", value: "example2" }, | ||
]; | ||
|
||
beforeEach(function() { | ||
cy.login(); | ||
cy.createDashboard("Foo Bar") | ||
.then(({ id }) => { | ||
this.dashboardId = id; | ||
this.dashboardUrl = `/dashboards/${id}`; | ||
}) | ||
.then(() => { | ||
const queryData = { | ||
name: "Text Parameter", | ||
query: "SELECT '{{param1}}', '{{param2}}' AS parameter", | ||
options: { | ||
parameters, | ||
}, | ||
}; | ||
const widgetOptions = { position: { col: 0, row: 0, sizeX: 3, sizeY: 10, autoHeight: false } }; | ||
createQueryAndAddWidget(this.dashboardId, queryData, widgetOptions).then(widgetTestId => { | ||
cy.visit(this.dashboardUrl); | ||
this.widgetTestId = widgetTestId; | ||
}); | ||
}); | ||
}); | ||
|
||
const openMappingOptions = widgetTestId => { | ||
cy.getByTestId(widgetTestId).within(() => { | ||
cy.getByTestId("WidgetDropdownButton").click(); | ||
}); | ||
|
||
cy.getByTestId("WidgetDropdownButtonMenu") | ||
.contains("Edit Parameters") | ||
.click(); | ||
}; | ||
|
||
const saveMappingOptions = (closeMappingMenu = false) => { | ||
return cy | ||
.getByTestId("EditParamMappingPopover") | ||
.filter(":visible") | ||
.as("Popover") | ||
.within(() => { | ||
// This is needed to grant the element will have finished loading | ||
// eslint-disable-next-line cypress/no-unnecessary-waiting | ||
cy.wait(500); | ||
cy.contains("button", "OK").click(); | ||
}) | ||
.then(() => { | ||
if (closeMappingMenu) { | ||
cy.contains("button", "OK").click(); | ||
} | ||
return cy.get("@Popover").should("not.be.visible"); | ||
}); | ||
}; | ||
|
||
it("supports widget parameters", function() { | ||
// widget parameter mapping is the default for the API | ||
cy.getByTestId(this.widgetTestId).within(() => { | ||
cy.getByTestId("TableVisualization").should("contain", "example1"); | ||
|
||
cy.getByTestId("ParameterName-param1") | ||
.find("input") | ||
.type("{selectall}Redash"); | ||
|
||
cy.getByTestId("ParameterApplyButton").click(); | ||
|
||
cy.getByTestId("TableVisualization").should("contain", "Redash"); | ||
}); | ||
|
||
cy.getByTestId("DashboardParameters").should("not.exist"); | ||
}); | ||
|
||
it("supports static values for parameters", function() { | ||
openMappingOptions(this.widgetTestId); | ||
cy.getByTestId("EditParamMappingButton-param1").click(); | ||
|
||
cy.getByTestId("StaticValueOption").click(); | ||
|
||
cy.getByTestId("EditParamMappingPopover").within(() => { | ||
cy.getByTestId("ParameterValueInput") | ||
.find("input") | ||
.type("{selectall}StaticValue"); | ||
}); | ||
|
||
saveMappingOptions(true); | ||
|
||
cy.getByTestId(this.widgetTestId).within(() => { | ||
cy.getByTestId("ParameterName-param1").should("not.exist"); | ||
}); | ||
|
||
cy.getByTestId("DashboardParameters").should("not.exist"); | ||
|
||
cy.getByTestId(this.widgetTestId).within(() => { | ||
cy.getByTestId("TableVisualization").should("contain", "StaticValue"); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.