Skip to content

Commit

Permalink
Cypress UI testing in OSS
Browse files Browse the repository at this point in the history
  • Loading branch information
peterlau committed Jul 14, 2022
1 parent 1c50920 commit 072ba24
Show file tree
Hide file tree
Showing 21 changed files with 8,126 additions and 1,940 deletions.
2 changes: 1 addition & 1 deletion ui/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "react-app",
"extends": ["react-app", "plugin:cypress/recommended"],
"rules": {
"import/no-anonymous-default-export": 0
}
Expand Down
14 changes: 14 additions & 0 deletions ui/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { defineConfig } from "cypress";

export default defineConfig({
e2e: {
baseUrl: "http://localhost:5000",
},

component: {
devServer: {
framework: "create-react-app",
bundler: "webpack",
},
},
});
43 changes: 43 additions & 0 deletions ui/cypress/e2e/spec.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
describe("Landing Page", () => {
beforeEach(() => {
cy.intercept("/api/workflow/search?**", { fixture: "workflowSearch.json" });
cy.intercept("/api/tasks/search?**", { fixture: "taskSearch.json" });
cy.intercept("/api/metadata/workflow", {
fixture: "metadataWorkflow.json",
});
cy.intercept("/api/metadata/taskdefs", { fixture: "metadataTasks.json" });
});

it("Homepage preloads with default query", () => {
cy.visit("/");
cy.contains("Search Execution");
cy.contains("Page 1 of 5");
cy.get(".rdt_TableCell").contains("feature_value_compute_workflow");
});

it("Workflow name dropdown", () => {
cy.get(".MuiAutocomplete-inputRoot input").first().click();
cy.get("li.MuiAutocomplete-option")
.contains("Do_While_Workflow_Iteration_Fix")
.click();
cy.get(".MuiAutocomplete-tag").contains("Do_While_Workflow_Iteration_Fix");
});

it("Switch to Task Tab - No results", () => {
cy.get("a.MuiTab-root").contains("Tasks").click();
cy.contains("Task Name");
cy.contains("There are no records to display");
});

it("Task Name Dropdown", () => {
cy.get(".MuiAutocomplete-inputRoot input").first().click();
cy.get("li.MuiAutocomplete-option").contains("example_task_2").click();
cy.get(".MuiAutocomplete-tag").contains("example_task_2");
});

it("Execute Task Search", () => {
cy.get("button").contains("Search").click();
cy.contains("Page 1 of 1");
cy.get(".rdt_TableCell").contains("36d24c5c-9c26-46cf-9709-e1bc6963b8a5");
});
});
Loading

0 comments on commit 072ba24

Please sign in to comment.