Merge pull request #7026 from Budibase/cypress-testing

Cypress: Test changes for UI + Components
This commit is contained in:
Mitch-Budibase 2022-08-01 17:52:52 +01:00 committed by GitHub
commit c189b1264f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 16 deletions

View File

@ -10,10 +10,8 @@ filterTests(['smoke', 'all'], () => {
it("should disable the autogenerated screen options if no sources are available", () => { it("should disable the autogenerated screen options if no sources are available", () => {
cy.createApp("First Test App", false) cy.createApp("First Test App", false)
cy.closeModal(); cy.closeModal();
cy.contains("Design").click()
cy.navigateToAutogeneratedModal() cy.navigateToAutogeneratedModal()
cy.get(interact.CONFIRM_WRAP_SPE_BUTTON).should('be.disabled') cy.get(interact.CONFIRM_WRAP_SPE_BUTTON).should('be.disabled')

View File

@ -179,7 +179,7 @@ filterTests(["all"], () => {
cy.get(".nav-item").should("contain", queryName) cy.get(".nav-item").should("contain", queryName)
}) })
xit("should duplicate a query", () => { it("should duplicate a query", () => {
/// Get query nav item - QueryName /// Get query nav item - QueryName
cy.get(".nav-item") cy.get(".nav-item")
.contains(queryName) .contains(queryName)

View File

@ -204,7 +204,7 @@ filterTests(["all"], () => {
cy.get(".spectrum-Table").eq(1).should("contain", queryName) cy.get(".spectrum-Table").eq(1).should("contain", queryName)
}) })
xit("should duplicate a query", () => { it("should duplicate a query", () => {
// Locate previously created query // Locate previously created query
cy.get(".nav-item") cy.get(".nav-item")
.contains(queryName) .contains(queryName)

View File

@ -2,7 +2,7 @@ import filterTests from "../support/filterTests"
const interact = require('../support/interact') const interact = require('../support/interact')
filterTests(["smoke", "all"], () => { filterTests(["smoke", "all"], () => {
xcontext("Query Level Transformers", () => { context("Query Level Transformers", () => {
before(() => { before(() => {
cy.login() cy.login()
cy.createTestApp() cy.createTestApp()

View File

@ -543,16 +543,23 @@ Cypress.Commands.add("addCustomSourceOptions", totalOptions => {
// DESIGN SECTION // DESIGN SECTION
Cypress.Commands.add("searchAndAddComponent", component => { Cypress.Commands.add("searchAndAddComponent", component => {
// Open component menu // Open component menu
cy.get(".spectrum-Button").contains("Component").click({ force: true }) cy.get(".icon-side-nav").within(() => {
cy.get(".icon-side-nav-item").eq(1).click()
})
cy.get(".add-component > .spectrum-Button")
.contains("Add component")
.click({ force: true })
cy.get(".container", { timeout: 1000 }).within(() => {
cy.get(".title").should("contain", "Add component")
// Search and add component // Search and add component
cy.wait(500)
cy.get(".spectrum-Textfield-input").clear().type(component) cy.get(".spectrum-Textfield-input").clear().type(component)
cy.get(".body").within(() => { cy.get(".body").within(() => {
cy.get(".component") cy.get(".component")
.contains(new RegExp("^" + component + "$"), { timeout: 3000 }) .contains(new RegExp("^" + component + "$"), { timeout: 3000 })
.click({ force: true }) .click({ force: true })
}) })
})
cy.wait(1000) cy.wait(1000)
cy.location().then(loc => { cy.location().then(loc => {
const params = loc.pathname.split("/") const params = loc.pathname.split("/")
@ -597,7 +604,7 @@ Cypress.Commands.add("getComponent", componentId => {
Cypress.Commands.add("createScreen", (route, accessLevelLabel) => { Cypress.Commands.add("createScreen", (route, accessLevelLabel) => {
// Blank Screen // Blank Screen
cy.contains("Design").click() cy.contains("Design").click()
cy.get(".header > .add-button").click() cy.get(".spectrum-Button").contains("Add screen").click({ force: true })
cy.get(".spectrum-Modal").within(() => { cy.get(".spectrum-Modal").within(() => {
cy.get("[data-cy='blank-screen']").click() cy.get("[data-cy='blank-screen']").click()
cy.get(".spectrum-Button").contains("Continue").click({ force: true }) cy.get(".spectrum-Button").contains("Continue").click({ force: true })
@ -622,7 +629,7 @@ Cypress.Commands.add(
"createDatasourceScreen", "createDatasourceScreen",
(datasourceNames, accessLevelLabel) => { (datasourceNames, accessLevelLabel) => {
cy.contains("Design").click() cy.contains("Design").click()
cy.get(".header > .add-button").click() cy.get(".spectrum-Button").contains("Add screen").click({ force: true })
cy.get(".spectrum-Modal").within(() => { cy.get(".spectrum-Modal").within(() => {
cy.get(".item").contains("Autogenerated screens").click() cy.get(".item").contains("Autogenerated screens").click()
cy.get(".spectrum-Button").contains("Continue").click({ force: true }) cy.get(".spectrum-Button").contains("Continue").click({ force: true })
@ -742,7 +749,7 @@ Cypress.Commands.add("navigateToDataSection", () => {
Cypress.Commands.add("navigateToAutogeneratedModal", () => { Cypress.Commands.add("navigateToAutogeneratedModal", () => {
// Screen name must already exist within data source // Screen name must already exist within data source
cy.contains("Design").click() cy.contains("Design").click()
cy.get(".header > .add-button").click() cy.get(".spectrum-Button").contains("Add screen").click({ force: true })
cy.get(".spectrum-Modal").within(() => { cy.get(".spectrum-Modal").within(() => {
cy.get(".item", { timeout: 2000 }) cy.get(".item", { timeout: 2000 })
.contains("Autogenerated screens") .contains("Autogenerated screens")