Adding tags to tests

Currently there is 'smoke' and 'all' tags
This commit is contained in:
Mitch-Budibase 2022-01-21 12:43:27 +00:00
parent 9034f23fde
commit 8b8cb21ec3
22 changed files with 1770 additions and 1669 deletions

View File

@ -1,4 +1,7 @@
context("Add Multi-Option Datatype", () => { import filterTests from "../support/filterTests"
filterTests(['all'], () => {
context("Add Multi-Option Datatype", () => {
before(() => { before(() => {
cy.login() cy.login()
cy.createTestApp() cy.createTestApp()
@ -39,4 +42,4 @@ context("Add Multi-Option Datatype", () => {
}) })
}) })
}) })
})

View File

@ -1,10 +1,13 @@
context("Add Radio Buttons", () => { import filterTests from "../support/filterTests"
filterTests(['all'], () => {
context("Add Radio Buttons", () => {
before(() => { before(() => {
cy.login() cy.login()
cy.createTestApp() cy.createTestApp()
}) })
it("should add Radio Buttons options picker on form, add data, and confirm", () => { it("should add Radio Buttons options picker on form, add data, and confirm", () => {
cy.navigateToFrontend() cy.navigateToFrontend()
cy.addComponent("Form", "Form") cy.addComponent("Form", "Form")
cy.addComponent("Form", "Options Picker").then((componentId) => { cy.addComponent("Form", "Options Picker").then((componentId) => {
@ -32,4 +35,5 @@ it("should add Radio Buttons options picker on form, add data, and confirm", ()
}) })
cy.addCustomSourceOptions(totalRadioButtons) cy.addCustomSourceOptions(totalRadioButtons)
} }
})
}) })

View File

@ -1,4 +1,7 @@
context("Auto Screens UI", () => { import filterTests from "../support/filterTests"
filterTests(['smoke', 'all'], () => {
context("Auto Screens UI", () => {
before(() => { before(() => {
cy.login() cy.login()
cy.createTestApp() cy.createTestApp()
@ -44,4 +47,5 @@ context("Auto Screens UI", () => {
.and('contain', 'books/new/row') .and('contain', 'books/new/row')
}) })
} }
})
}) })

View File

@ -1,4 +1,7 @@
context("Change Application Icon and Colour", () => { import filterTests from "../support/filterTests"
filterTests(['all'], () => {
context("Change Application Icon and Colour", () => {
before(() => { before(() => {
cy.login() cy.login()
}) })
@ -36,4 +39,5 @@ context("Change Application Icon and Colour", () => {
.should('have.attr', 'style').and('contains', 'color') .should('have.attr', 'style').and('contains', 'color')
}) })
}) })
})
}) })

View File

@ -1,8 +1,12 @@
context("Create an Application", () => { import filterTests from '../support/filterTests'
filterTests(['smoke', 'all'], () => {
context("Create an Application", () => {
it("should create a new application", () => { it("should create a new application", () => {
cy.login() cy.login()
cy.createTestApp() cy.createTestApp()
cy.visit(`${Cypress.config().baseUrl}/builder`) cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.contains("Cypress Tests").should("exist") cy.contains("Cypress Tests").should("exist")
}) })
})
}) })

View File

@ -1,4 +1,7 @@
context("Create a automation", () => { import filterTests from "../support/filterTests"
filterTests(['smoke', 'all'], () => {
context("Create a automation", () => {
before(() => { before(() => {
cy.login() cy.login()
cy.createTestApp() cy.createTestApp()
@ -62,4 +65,5 @@ context("Create a automation", () => {
cy.contains("Data").click() cy.contains("Data").click()
cy.contains("automationGoodboy") cy.contains("automationGoodboy")
}) })
})
}) })

View File

@ -1,4 +1,7 @@
context("Create Bindings", () => { import filterTests from "../support/filterTests"
filterTests(['smoke', 'all'], () => {
context("Create Bindings", () => {
before(() => { before(() => {
cy.login() cy.login()
cy.createTestApp() cy.createTestApp()
@ -42,9 +45,9 @@ context("Create Bindings", () => {
cy.getComponent(componentId).should("have.text", "3") cy.getComponent(componentId).should("have.text", "3")
}) })
}) })
}) })
const addSettingBinding = (setting, bindingText, clickOption = true) => { const addSettingBinding = (setting, bindingText, clickOption = true) => {
cy.get(`[data-cy="setting-${setting}"] [data-cy=text-binding-button]`).click() cy.get(`[data-cy="setting-${setting}"] [data-cy=text-binding-button]`).click()
cy.get(".drawer").within(() => { cy.get(".drawer").within(() => {
if (clickOption) { if (clickOption) {
@ -55,4 +58,5 @@ const addSettingBinding = (setting, bindingText, clickOption = true) => {
} }
cy.contains("Save").click() cy.contains("Save").click()
}) })
} }
})

View File

@ -1,5 +1,9 @@
// TODO for now components are skipped, might not be good to keep doing this // TODO for now components are skipped, might not be good to keep doing this
xcontext("Create Components", () => {
import filterTests from "../support/filterTests"
filterTests(['all'], () => {
xcontext("Create Components", () => {
let headlineId let headlineId
before(() => { before(() => {
@ -89,4 +93,5 @@ xcontext("Create Components", () => {
cy.getComponent(componentId).should("not.exist") cy.getComponent(componentId).should("not.exist")
}) })
}) })
})
}) })

View File

@ -1,4 +1,7 @@
context("Screen Tests", () => { import filterTests from "../support/filterTests"
filterTests(['smoke', 'all'], () => {
context("Screen Tests", () => {
before(() => { before(() => {
cy.login() cy.login()
cy.createTestApp() cy.createTestApp()
@ -18,4 +21,5 @@ context("Screen Tests", () => {
cy.contains("/test-with-spaces").should("exist") cy.contains("/test-with-spaces").should("exist")
}) })
}) })
})
}) })

View File

@ -1,4 +1,7 @@
context("Create a Table", () => { import filterTests from "../support/filterTests"
filterTests(['smoke', 'all'], () => {
context("Create a Table", () => {
before(() => { before(() => {
cy.login() cy.login()
cy.createTestApp() cy.createTestApp()
@ -100,4 +103,5 @@ context("Create a Table", () => {
cy.contains("Delete Table").click() cy.contains("Delete Table").click()
cy.contains("dog").should("not.exist") cy.contains("dog").should("not.exist")
}) })
})
}) })

View File

@ -1,4 +1,8 @@
context("Create a User and Assign Roles", () => { import filterTests from "../support/filterTests"
filterTests(['smoke', 'all'], () => {
context("Create a User and Assign Roles", () => {
before(() => { before(() => {
cy.login() cy.login()
}) })
@ -125,4 +129,5 @@ context("Create a User and Assign Roles", () => {
}) })
cy.get(".spectrum-Table-body").should("not.have.text", "bbuser") cy.get(".spectrum-Table-body").should("not.have.text", "bbuser")
}) })
})
}) })

View File

@ -1,4 +1,7 @@
context("Create a View", () => { import filterTests from "../support/filterTests"
filterTests(['smoke', 'all'], () => {
context("Create a View", () => {
before(() => { before(() => {
cy.login() cy.login()
cy.createTestApp() cy.createTestApp()
@ -141,12 +144,13 @@ context("Create a View", () => {
cy.wait(500) cy.wait(500)
cy.contains("TestView Updated").should("not.exist") cy.contains("TestView Updated").should("not.exist")
}) })
}) })
function removeSpacing(headers) { function removeSpacing(headers) {
let newHeaders = [] let newHeaders = []
for (let header of headers) { for (let header of headers) {
newHeaders.push(header.replace(/\s\s+/g, " ")) newHeaders.push(header.replace(/\s\s+/g, " "))
} }
return newHeaders return newHeaders
} }
})

View File

@ -1,4 +1,7 @@
xcontext("Custom Theming Properties", () => { import filterTests from "../support/filterTests"
filterTests(['all'], () => {
xcontext("Custom Theming Properties", () => {
before(() => { before(() => {
cy.login() cy.login()
cy.createTestApp() cy.createTestApp()
@ -80,4 +83,5 @@ xcontext("Custom Theming Properties", () => {
.parent().find(".container.svelte-z3cm5a").click() .parent().find(".container.svelte-z3cm5a").click()
.get('[title="Gray 800"]').children().find('[aria-label="Checkmark"]') .get('[title="Gray 800"]').children().find('[aria-label="Checkmark"]')
} }
})
}) })

View File

@ -1,4 +1,7 @@
context("Datasource Wizard", () => { import filterTests from "../../support/filterTests"
filterTests(['all'], () => {
context("Datasource Wizard", () => {
before(() => { before(() => {
cy.login() cy.login()
cy.createTestApp() cy.createTestApp()
@ -34,4 +37,5 @@ context("Datasource Wizard", () => {
cy.get("@datasourceConnection").its('response.body') cy.get("@datasourceConnection").its('response.body')
.should('have.property', 'status', 500) .should('have.property', 'status', 500)
}) })
})
}) })

View File

@ -1,4 +1,7 @@
context("MySQL Datasource Testing", () => { import filterTests from "../../support/filterTests"
filterTests(['all'], () => {
context("MySQL Datasource Testing", () => {
if (Cypress.env("TEST_ENV")) { if (Cypress.env("TEST_ENV")) {
before(() => { before(() => {
@ -184,4 +187,5 @@ context("MySQL Datasource Testing", () => {
cy.get(".nav-item").should('not.contain', queryRename) cy.get(".nav-item").should('not.contain', queryRename)
}) })
} }
})
}) })

View File

@ -1,4 +1,7 @@
context("Oracle Datasource Testing", () => { import filterTests from "../../support/filterTests"
filterTests(['all', 'smoke'], () => {
context("Oracle Datasource Testing", () => {
before(() => { before(() => {
cy.login() cy.login()
cy.createTestApp() cy.createTestApp()
@ -188,4 +191,5 @@ context("Oracle Datasource Testing", () => {
// Confirm deletion // Confirm deletion
cy.get(".nav-item").should('not.contain', queryName) cy.get(".nav-item").should('not.contain', queryName)
}) })
})
}) })

View File

@ -1,4 +1,7 @@
context("PostgreSQL Datasource Testing", () => { import filterTests from "../../support/filterTests"
filterTests(['all'], () => {
context("PostgreSQL Datasource Testing", () => {
if (Cypress.env("TEST_ENV")) { if (Cypress.env("TEST_ENV")) {
before(() => { before(() => {
@ -234,4 +237,5 @@ context("PostgreSQL Datasource Testing", () => {
cy.wait(5000) cy.wait(5000)
} }
} }
})
}) })

View File

@ -1,4 +1,7 @@
context("REST Datasource Testing", () => { import filterTests from "../../support/filterTests"
filterTests(['smoke', 'all'], () => {
context("REST Datasource Testing", () => {
before(() => { before(() => {
cy.login() cy.login()
cy.createTestApp() cy.createTestApp()
@ -36,4 +39,5 @@ context("REST Datasource Testing", () => {
.children() .children()
.should('contain', 200) .should('contain', 200)
}) })
})
}) })

View File

@ -1,4 +1,7 @@
context("Query Level Transformers", () => { import filterTests from "../support/filterTests"
filterTests(['smoke', 'all'], () => {
context("Query Level Transformers", () => {
before(() => { before(() => {
cy.login() cy.login()
cy.deleteApp("Cypress Tests") cy.deleteApp("Cypress Tests")
@ -109,4 +112,5 @@ context("Query Level Transformers", () => {
expect(response.body.message).to.include('Invalid body - "transformer" is not allowed to be empty') expect(response.body.message).to.include('Invalid body - "transformer" is not allowed to be empty')
}) })
}) })
})
}) })

View File

@ -1,10 +1,13 @@
context("Rename an App", () => { import filterTests from "../support/filterTests"
filterTests(['all'], () => {
context("Rename an App", () => {
beforeEach(() => { beforeEach(() => {
cy.login() cy.login()
cy.createTestApp() cy.createTestApp()
}) })
it("should rename an unpublished application", () => { it("should rename an unpublished application", () => {
const appName = "Cypress Tests" const appName = "Cypress Tests"
const appRename = "Cypress Renamed" const appRename = "Cypress Renamed"
// Rename app, Search for app, Confirm name was changed // Rename app, Search for app, Confirm name was changed
@ -18,9 +21,9 @@ it("should rename an unpublished application", () => {
cy.reload() cy.reload()
cy.wait(1000) cy.wait(1000)
renameApp(appRename, appName) renameApp(appRename, appName)
}) })
xit("Should rename a published application", () => { xit("Should rename a published application", () => {
// It is not possible to rename a published application // It is not possible to rename a published application
const appName = "Cypress Tests" const appName = "Cypress Tests"
const appRename = "Cypress Renamed" const appRename = "Cypress Renamed"
@ -37,9 +40,9 @@ xit("Should rename a published application", () => {
renameApp(appName, appRename, true) renameApp(appName, appRename, true)
cy.searchForApplication(appRename) cy.searchForApplication(appRename)
cy.get(".appTable").find(".wrapper").should("have.length", 1) cy.get(".appTable").find(".wrapper").should("have.length", 1)
}) })
it("Should try to rename an application to have no name", () => { it("Should try to rename an application to have no name", () => {
const appName = "Cypress Tests" const appName = "Cypress Tests"
cy.get(".home-logo").click() cy.get(".home-logo").click()
renameApp(appName, " ", false, true) renameApp(appName, " ", false, true)
@ -50,9 +53,9 @@ it("Should try to rename an application to have no name", () => {
cy.wait(1000) cy.wait(1000)
cy.searchForApplication(appName) cy.searchForApplication(appName)
cy.get(".appTable").find(".title").should("have.length", 1) cy.get(".appTable").find(".title").should("have.length", 1)
}) })
xit("Should create two applications with the same name", () => { xit("Should create two applications with the same name", () => {
// It is not possible to have applications with the same name // It is not possible to have applications with the same name
const appName = "Cypress Tests" const appName = "Cypress Tests"
cy.visit(`${Cypress.config().baseUrl}/builder`) cy.visit(`${Cypress.config().baseUrl}/builder`)
@ -65,9 +68,9 @@ xit("Should create two applications with the same name", () => {
cy.get(".spectrum-ButtonGroup").contains("Create app").click({force: true}) cy.get(".spectrum-ButtonGroup").contains("Create app").click({force: true})
cy.get(".error").should("have.text", "Another app with the same name already exists") cy.get(".error").should("have.text", "Another app with the same name already exists")
}) })
}) })
it("should validate application names", () => { it("should validate application names", () => {
// App name must be letters, numbers and spaces only // App name must be letters, numbers and spaces only
// This test checks numbers and special characters specifically // This test checks numbers and special characters specifically
const appName = "Cypress Tests" const appName = "Cypress Tests"
@ -87,7 +90,7 @@ it("should validate application names", () => {
cy.reload() cy.reload()
cy.wait(1000) cy.wait(1000)
renameApp(numberName, appName) renameApp(numberName, appName)
}) })
const renameApp = (originalName, changedName, published, noName) => { const renameApp = (originalName, changedName, published, noName) => {
cy.searchForApplication(originalName) cy.searchForApplication(originalName)
@ -123,5 +126,6 @@ it("should validate application names", () => {
}) })
} }
}) })
} }
})
}) })

View File

@ -1,4 +1,7 @@
context("Revert apps", () => { import filterTests from "../support/filterTests"
filterTests(['smoke', 'all'], () => {
context("Revert apps", () => {
before(() => { before(() => {
cy.login() cy.login()
cy.createTestApp() cy.createTestApp()
@ -59,4 +62,5 @@ context("Revert apps", () => {
cy.get(".spectrum-Button").eq(1).should('be.disabled') cy.get(".spectrum-Button").eq(1).should('be.disabled')
}) })
}) })
})
}) })

View File

@ -0,0 +1,16 @@
const filterTests = (testTags, runTest) => {
// testTags is an array of tags
// runTest is all tests
if (Cypress.env('TEST_TAGS')) {
const tags = Cypress.env('TEST_TAGS').split('/');
const found = testTags.some(($testTags) => tags.includes($testTags));
if (found) {
runTest();
}
} else {
runTest();
}
};
export default filterTests;