2022-01-21 13:43:27 +01:00
|
|
|
import filterTests from "../support/filterTests"
|
2022-05-18 15:29:22 +02:00
|
|
|
const interact = require('../support/interact')
|
2021-09-27 19:19:25 +02:00
|
|
|
|
2022-01-21 13:43:27 +01:00
|
|
|
filterTests(['all'], () => {
|
2022-02-17 15:06:17 +01:00
|
|
|
context("Add Radio Buttons", () => {
|
2022-01-21 13:43:27 +01:00
|
|
|
before(() => {
|
|
|
|
cy.login()
|
|
|
|
cy.createTestApp()
|
2021-09-27 19:19:25 +02:00
|
|
|
})
|
2022-01-21 13:43:27 +01:00
|
|
|
|
|
|
|
it("should add Radio Buttons options picker on form, add data, and confirm", () => {
|
|
|
|
cy.navigateToFrontend()
|
|
|
|
cy.addComponent("Form", "Form")
|
|
|
|
cy.addComponent("Form", "Options Picker").then((componentId) => {
|
|
|
|
// Provide field setting
|
2022-05-18 15:29:22 +02:00
|
|
|
cy.get(interact.DATASOURCE_FIELD_CONTROL).type("1")
|
2022-01-21 13:43:27 +01:00
|
|
|
// Open dropdown and select Radio buttons
|
2022-05-18 15:29:22 +02:00
|
|
|
cy.get(interact.OPTION_TYPE_PROP_CONTROL).click().then(() => {
|
|
|
|
cy.get(interact.SPECTRUM_POPOVER).contains('Radio buttons')
|
2021-09-27 19:19:25 +02:00
|
|
|
.wait(500)
|
|
|
|
.click()
|
2022-01-21 13:43:27 +01:00
|
|
|
})
|
|
|
|
const radioButtonsTotal = 3
|
|
|
|
// Add values and confirm total
|
|
|
|
addRadioButtonData(radioButtonsTotal)
|
|
|
|
cy.getComponent(componentId).find('[type="radio"]')
|
|
|
|
.should('have.length', radioButtonsTotal)
|
|
|
|
})
|
2021-09-27 19:19:25 +02:00
|
|
|
})
|
2022-01-21 13:43:27 +01:00
|
|
|
|
|
|
|
const addRadioButtonData = (totalRadioButtons) => {
|
2022-05-18 15:29:22 +02:00
|
|
|
cy.get(interact.OPTION_SOURCE_PROP_CONROL).click().then(() => {
|
|
|
|
cy.get(interact.SPECTRUM_POPOVER).contains('Custom')
|
2022-01-21 13:43:27 +01:00
|
|
|
.wait(500)
|
|
|
|
.click()
|
|
|
|
})
|
|
|
|
cy.addCustomSourceOptions(totalRadioButtons)
|
|
|
|
}
|
|
|
|
})
|
2021-09-27 19:19:25 +02:00
|
|
|
})
|