Update commands.js

This commit is contained in:
Mitch-Budibase 2021-10-08 10:56:44 +01:00
parent 2ee4c13826
commit 58a40be2e5
1 changed files with 50 additions and 39 deletions

View File

@ -101,7 +101,9 @@ Cypress.Commands.add("createTable", tableName => {
cy.contains(tableName).should("be.visible")
})
Cypress.Commands.add("addColumn", (tableName, columnName, type, multiOptions = null) => {
Cypress.Commands.add(
"addColumn",
(tableName, columnName, type, multiOptions = null) => {
// Select Table
cy.selectTable(tableName)
cy.contains(".nav-item", tableName).click()
@ -123,7 +125,8 @@ Cypress.Commands.add("addColumn", (tableName, columnName, type, multiOptions = n
cy.contains("Save Column").click()
})
})
}
)
Cypress.Commands.add("addRow", values => {
cy.contains("Create row").click()
@ -137,13 +140,15 @@ Cypress.Commands.add("addRow", values => {
Cypress.Commands.add("addRowMultiValue", values => {
cy.contains("Create row").click()
cy.get(".spectrum-Form-itemField").click().then(() => {
cy.get(".spectrum-Form-itemField")
.click()
.then(() => {
cy.get(".spectrum-Popover").within(() => {
for (let i = 0; i < values.length; i++) {
cy.get(".spectrum-Menu-item").eq(i).click()
}
})
cy.get(".spectrum-Dialog-grid").click('top')
cy.get(".spectrum-Dialog-grid").click("top")
cy.get(".spectrum-ButtonGroup").contains("Create").click()
})
})
@ -219,10 +224,16 @@ Cypress.Commands.add("selectTable", tableName => {
})
Cypress.Commands.add("addCustomSourceOptions", totalOptions => {
cy.get(".spectrum-ActionButton").contains("Define Options").click().then(() => {
cy.get(".spectrum-ActionButton")
.contains("Define Options")
.click()
.then(() => {
for (let i = 0; i < totalOptions; i++) {
// Add radio button options
cy.get(".spectrum-Button").contains("Add Option").click({force: true}).then(() => {
cy.get(".spectrum-Button")
.contains("Add Option")
.click({ force: true })
.then(() => {
cy.wait(500)
cy.get("[placeholder='Label']").eq(i).type(i)
cy.get("[placeholder='Value']").eq(i).type(i)