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

Upgrade cypress #3205

Merged
merged 5 commits into from
Nov 13, 2023
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/test_cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Cypress run
# This is a preconfigured action, maintained by cypress, to run e2e tests
# https://github.com/cypress-io/github-action
uses: cypress-io/github-action@v2
uses: cypress-io/github-action@v6
with:
working-directory: .
start: bash ./scripts/run_e2e_all.sh
Expand Down
12 changes: 12 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { defineConfig } = require('cypress')

module.exports = defineConfig({
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
},
baseUrl: 'http://localhost:8080',
},
})
3 changes: 0 additions & 3 deletions cypress.json

This file was deleted.

14 changes: 14 additions & 0 deletions cypress/e2e/backend-admin-ui/test_0_visitPage.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/// <reference types="cypress" />
import { visitAdminUI } from "../../integration-helpers/visitAdminUI";

context("Visit conquery admin ui", () => {
describe("Access on the start page", () => {
beforeEach(() => {
visitAdminUI();
});

it("Can see the start page", () => {
cy.contains("Conquery Admin");
});
});
});
38 changes: 38 additions & 0 deletions cypress/e2e/backend-admin-ui/test_1_datasets.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/// <reference types="cypress" />
import { visitAdminUI } from "../../integration-helpers/visitAdminUI";

context("Admin UI Datasets", () => {
const testDSLabel = "TestDatasetName";
const testDSID = "TestDatasetID";

describe("Access on the page", () => {
before(() => {
visitAdminUI("datasets");
});

it("Can see the datasets page", () => {
cy.contains("Datasets");
});
});

describe("Create a new dataset", () => {
it("Can create a new dataset", () => {
visitAdminUI("datasets");
cy.get('[data-test-id="entity-name"]').type(testDSLabel);
cy.get('[data-test-id="entity-id"]').type(testDSID);
cy.get('[data-test-id="create-dataset-btn"]').click().as("createDataset");
cy.contains(testDSID);
});
});

describe("Delete a dataset", () => {
before(() => {
visitAdminUI("datasets");
});

it("Can delete the test dataset", () => {
cy.get(`[data-test-id="delete-btn-${testDSID}"]`).click({ force: true });
cy.get(`[data-test-id="delete-btn-${testDSID}"]`).should("not.exist");
});
});
});
220 changes: 220 additions & 0 deletions cypress/e2e/backend-admin-ui/test_2_dataset.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
/// <reference types="cypress" />
import { visitAdminUI } from "../../integration-helpers/visitAdminUI";

context("Admin UI Single Dataset", () => {
const testDSLabel = "TestDatasetName";
const testDSID = "TestDatasetID2";

describe("Create a new dataset", () => {
beforeEach(() => {
visitAdminUI("datasets");
});

it("Can create a new dataset", () => {
cy.get('[data-test-id="entity-name"]').type(testDSLabel);
cy.get('[data-test-id="entity-id"]').type(testDSID);
cy.get('[data-test-id="create-dataset-btn"]').click().as("createDataset");
cy.contains(testDSID);
});
});

describe("Access on the created dataset", () => {
beforeEach(() => {
visitAdminUI(`datasets/${testDSID}`);
});

it("Can see the datasets page", () => {
cy.contains(`Dataset ${testDSLabel}`);
});

it("Can change the label", () => {
cy.get('[data-test-id="editableText-btn"]').click();
cy.get('[data-test-id="editableText-input"]').clear().type(`NEW ${testDSLabel}`);
cy.get('[data-test-id="editableText-form"]').submit();

cy.contains(`Dataset NEW ${testDSLabel}`);
});
});

describe("Can upload test table and concept", () => {
beforeEach(() => {
visitAdminUI(`datasets/${testDSID}`);
});

it("Can upload table", () => {
cy.intercept("/admin/datasets/*/tables").as("apiCall");
cy.get('[data-test-id="upload-select"]').select("Table JSON");
cy.get('[data-test-id="upload-input"]').selectFile(
"./cypress/support/test_data/all_types.table.json"
);
cy.get('[data-test-id="upload-btn"]').click();
cy.wait("@apiCall").reload();
cy.get('[data-test-id="accordion-Tables"]').contains("td", `table`);
});

it("Can upload concept", () => {
cy.intercept("/admin/datasets/*/concepts").as("apiCall");
cy.get('[data-test-id="upload-select"]').select("Concept JSON");
cy.get('[data-test-id="upload-input"]').selectFile(
"./cypress/support/test_data/all_types.concept.json"
);
cy.get('[data-test-id="upload-btn"]').click();
cy.wait("@apiCall").reload();
cy.get('[data-test-id="accordion-Concepts"]').contains("td", `concept1`);
});

it("Can replace concept", () => {
cy.intercept("/admin/datasets/*/concepts*").as("apiCall");
cy.get('[data-test-id="upload-select"]').select("Concept JSON");
cy.get('[data-test-id="upload-input"]').selectFile(
"./cypress/support/test_data/all_types.concept.json"
);
cy.get('[data-test-id="upload-btn"]').click();
cy.wait("@apiCall");
cy.get(`[data-test-id="toast-custom-button"]`).click();
cy.wait("@apiCall");
cy.get('[data-test-id="toast"]').contains("The file has been posted successfully");
cy.reload();
cy.get('[data-test-id="accordion-Concepts"]').contains("td", `concept1`);
});
});

describe("Can visit table info page", () => {
beforeEach(() => {
visitAdminUI(`datasets/${testDSID}/tables/${testDSID}.table`);
});

it("Can use page components", () => {
cy.contains("Table table");
cy.get('[data-test-id="accordion-Tags"]').click();
cy.hash().should("eq", "#Tags");
cy.get('[data-test-id="accordion-Concepts"]').click();
cy.hash().should("eq", "#Concepts");
cy.get('[data-test-id="accordion-Columns"]').click();
cy.hash().should("eq", "#Columns");
});
});

describe("Can visit concept info page", () => {
beforeEach(() => {
visitAdminUI(`datasets/${testDSID}/concepts/${testDSID}.concept1`);
});

it("Can use page components", () => {
cy.contains("Concept Concept1");
cy.get('[data-test-id="accordion-Selects"]').first().click();
cy.hash().should("eq", "#Selects");
cy.get('[data-test-id="accordion-Connectors"]').click();
cy.hash().should("eq", "#Connectors");
});
});

describe("Can visit connector info page", () => {
it("Can use page components", () => {
visitAdminUI(`datasets/${testDSID}/concepts/${testDSID}.concept1`);
cy.get('[data-test-id="accordion-Connectors"]')
.click()
.get(".d-flex > :nth-child(1) > a")
.click();

cy.location("pathname").should(
"equal",
`/admin-ui/datasets/${testDSID}/connectors/${testDSID}.concept1.column`
);
});

it("Counts are right", () => {
visitAdminUI(`datasets/${testDSID}/connectors/${testDSID}.concept1.column`);
cy.get('[data-test-id="accordion-Filters"] > .card-header').contains("20 entries");
cy.get('[data-test-id="accordion-Selects"] > .card-header').contains("16 entries");
});
});

describe("Connector page links work", () => {
beforeEach(() => {
visitAdminUI(`datasets/${testDSID}/connectors/${testDSID}.concept1.column`);
});

it("Goto datasets", () => {
cy.get(".breadcrumb > :nth-child(1) > a").click();
cy.location("pathname").should("equal", `/admin-ui/datasets`);
});

it("Goto dataset", () => {
cy.get(".breadcrumb > :nth-child(2) > a").click();
cy.location("pathname").should("equal", `/admin-ui/datasets/${testDSID}`);
});

it("Goto concepts", () => {
cy.get(".breadcrumb > :nth-child(3) > a").click();
cy.location("pathname")
.should("equal", `/admin-ui/datasets/${testDSID}`)
.location("hash")
.should("equal", "#Concepts");
});

it("Goto concept", () => {
cy.get(".breadcrumb > :nth-child(4) > a").click();
cy.location("pathname").should(
"equal",
`/admin-ui/datasets/${testDSID}/concepts/${testDSID}.concept1`
);
});

it("Goto connectors", () => {
cy.get(".breadcrumb > :nth-child(5) > a").click();
cy.location("pathname")
.should("equal", `/admin-ui/datasets/${testDSID}/concepts/${testDSID}.concept1`)
.location("hash")
.should("equal", "#Connectors");
});
});

describe("Can delete test concept and table", () => {
beforeEach(() => visitAdminUI(`datasets/${testDSID}`));

it("Can delete test concept", () => {
cy.get('[data-test-id="accordion-Concepts"]').click();
cy.get(`[data-test-id="delete-btn-concept-${testDSID}.concept1"]`).click({ force: true });
cy.get(`[data-test-id="delete-btn-${testDSID}.concept1"]`).should("not.exist");
});

it("Can delete test table", () => {
cy.get('[data-test-id="accordion-Tables"]').click();
cy.get(`[data-test-id="delete-btn-table-${testDSID}.table"]`).click({ force: true });
cy.get(`[data-test-id="delete-btn-table-${testDSID}.table"]`).should("not.exist");
});

it("Can force delete test table", () => {
// reupload table and concept
cy.get('[data-test-id="upload-select"]').select("Table JSON");
cy.get('[data-test-id="upload-input"]').selectFile(
"./cypress/support/test_data/all_types.table.json"
);
cy.get('[data-test-id="upload-btn"]').click();
cy.reload();
cy.get('[data-test-id="upload-select"]').select("Concept JSON");
cy.get('[data-test-id="upload-input"]').selectFile(
"./cypress/support/test_data/all_types.concept.json"
);
cy.get('[data-test-id="upload-btn"]').click();
cy.reload();

cy.get('[data-test-id="accordion-Tables"]').click();
cy.get(`[data-test-id="delete-btn-table-${testDSID}.table"]`).click({ force: true });
cy.get(`[data-test-id="toast-custom-button"]`).click({ force: true });
cy.get(`[data-test-id="delete-btn-table-${testDSID}.table"]`).should("not.exist");
});
});

describe("Delete the test dataset", () => {
beforeEach(() => {
visitAdminUI("datasets");
});

it("Can delete the test dataset", () => {
cy.get(`[data-test-id="delete-btn-${testDSID}"]`).click({ force: true });
cy.contains(testDSID).should("not.exist");
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const USER_TOKEN_WITH_PERMISSIONS = "user.user2";

context("Visit conquery ", () => {
describe("As authenticated user without permissions", () => {
before(() => {
beforeEach(() => {
visitWithToken(USER_TOKEN_WITHOUT_PERMISSIONS);
});

Expand All @@ -24,7 +24,7 @@ context("Visit conquery ", () => {
});

describe("As authenticated user with permissions", () => {
before(() => {
beforeEach(() => {
visitWithToken(USER_TOKEN_WITH_PERMISSIONS);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ import { visitWithToken } from "../../integration-helpers/visitWithToken";
const USER_TOKEN_WITH_PERMISSIONS = "user.user2";

describe("Run query", () => {
before(() => {
beforeEach(() => {
visitWithToken(USER_TOKEN_WITH_PERMISSIONS);
});

it("Can execute query and see it in the queries tab", () => {
cy.get('[data-test-id="right-pane-container"] >div:visible').as(
"queryEditor",
);
cy.get('[data-test-id="right-pane-container"] >div:visible').as("queryEditor");

cy.contains("Concept1").trigger("dragstart").trigger("dragleave");
cy.get("@queryEditor")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { visitWithToken } from "../../integration-helpers/visitWithToken";
const USER_TOKEN_WITH_PERMISSIONS = "user.user2";

describe("Visit Form Editor", () => {
before(() => {
beforeEach(() => {
visitWithToken(USER_TOKEN_WITH_PERMISSIONS);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ import { visitWithToken } from "../../integration-helpers/visitWithToken";
const USER_TOKEN_WITH_PERMISSIONS = "user.user2";

describe("Visit Form Editor", () => {
before(() => {
beforeEach(() => {
visitWithToken(USER_TOKEN_WITH_PERMISSIONS);
});

it("Can open help menu", () => {

cy.get('[data-test-id="help-menu"]').click()
cy.get('[data-test-id="help-menu"]').click();

cy.get('[data-test-id="help-manual"]').should("have.attr", "href", "https://example.org");

cy.get('[data-test-id="help-email"]').should("have.attr", "href", "mailto:[email protected]");
});
});
12 changes: 0 additions & 12 deletions cypress/integration/backend-admin-ui/test_0_visitPage.js

This file was deleted.

Loading
Loading