Update commands.js
This commit is contained in:
parent
a590cb836f
commit
417826ffed
|
@ -101,29 +101,32 @@ Cypress.Commands.add("createTable", tableName => {
|
|||
cy.contains(tableName).should("be.visible")
|
||||
})
|
||||
|
||||
Cypress.Commands.add("addColumn", (tableName, columnName, type, multiOptions = null) => {
|
||||
// Select Table
|
||||
cy.selectTable(tableName)
|
||||
cy.contains(".nav-item", tableName).click()
|
||||
cy.contains("Create column").click()
|
||||
Cypress.Commands.add(
|
||||
"addColumn",
|
||||
(tableName, columnName, type, multiOptions = null) => {
|
||||
// Select Table
|
||||
cy.selectTable(tableName)
|
||||
cy.contains(".nav-item", tableName).click()
|
||||
cy.contains("Create column").click()
|
||||
|
||||
// Configure column
|
||||
cy.get(".spectrum-Modal").within(() => {
|
||||
cy.get("input").first().type(columnName).blur()
|
||||
// Configure column
|
||||
cy.get(".spectrum-Modal").within(() => {
|
||||
cy.get("input").first().type(columnName).blur()
|
||||
|
||||
// Unset table display column
|
||||
cy.contains("display column").click({ force: true })
|
||||
cy.get(".spectrum-Picker-label").click()
|
||||
cy.contains(type).click()
|
||||
// Unset table display column
|
||||
cy.contains("display column").click({ force: true })
|
||||
cy.get(".spectrum-Picker-label").click()
|
||||
cy.contains(type).click()
|
||||
|
||||
// Add options for Multi-select Type
|
||||
if(multiOptions !== null){
|
||||
cy.get(".spectrum-Textfield-input").eq(1).type(multiOptions)
|
||||
}
|
||||
// Add options for Multi-select Type
|
||||
if (multiOptions !== null) {
|
||||
cy.get(".spectrum-Textfield-input").eq(1).type(multiOptions)
|
||||
}
|
||||
|
||||
cy.contains("Save Column").click()
|
||||
})
|
||||
})
|
||||
cy.contains("Save Column").click()
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
Cypress.Commands.add("addRow", values => {
|
||||
cy.contains("Create row").click()
|
||||
|
@ -137,15 +140,17 @@ 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-Popover").within(() => {
|
||||
for (let i = 0; i < values.length; i++) {
|
||||
cy.get(".spectrum-Menu-item").eq(i).click()
|
||||
}
|
||||
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-ButtonGroup").contains("Create").click()
|
||||
})
|
||||
cy.get(".spectrum-Dialog-grid").click('top')
|
||||
cy.get(".spectrum-ButtonGroup").contains("Create").click()
|
||||
})
|
||||
})
|
||||
|
||||
Cypress.Commands.add("createUser", email => {
|
||||
|
@ -166,7 +171,7 @@ Cypress.Commands.add("addComponent", (category, component) => {
|
|||
if (category) {
|
||||
cy.get(`[data-cy="category-${category}"]`).click()
|
||||
}
|
||||
if (component){
|
||||
if (component) {
|
||||
cy.get(`[data-cy="component-${component}"]`).click()
|
||||
}
|
||||
cy.wait(1000)
|
||||
|
@ -219,16 +224,22 @@ Cypress.Commands.add("selectTable", tableName => {
|
|||
})
|
||||
|
||||
Cypress.Commands.add("addCustomSourceOptions", totalOptions => {
|
||||
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.wait(500)
|
||||
cy.get("[placeholder='Label']").eq(i).type(i)
|
||||
cy.get("[placeholder='Value']").eq(i).type(i)
|
||||
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.wait(500)
|
||||
cy.get("[placeholder='Label']").eq(i).type(i)
|
||||
cy.get("[placeholder='Value']").eq(i).type(i)
|
||||
})
|
||||
}
|
||||
// Save options
|
||||
cy.get(".spectrum-Button").contains("Save").click({ force: true })
|
||||
})
|
||||
}
|
||||
// Save options
|
||||
cy.get(".spectrum-Button").contains("Save").click({force: true})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue