Merge pull request #5954 from Budibase/cypressTests

adding interact locators for AddMultiOptionDataType test
This commit is contained in:
Mihail Hadzhiev 2022-05-18 15:10:18 +03:00 committed by GitHub
commit bda47204ce
2 changed files with 18 additions and 9 deletions

View File

@ -1,4 +1,5 @@
import filterTests from "../support/filterTests" import filterTests from "../support/filterTests"
const interact = require('../support/interact')
filterTests(['all'], () => { filterTests(['all'], () => {
context("Add Multi-Option Datatype", () => { context("Add Multi-Option Datatype", () => {
@ -17,19 +18,19 @@ filterTests(['all'], () => {
cy.navigateToFrontend() cy.navigateToFrontend()
cy.wait(500) cy.wait(500)
// Add data provider // Add data provider
cy.get(`[data-cy="category-Data"]`).click() cy.get(interact.CATEGORY_DATA).click()
cy.get(`[data-cy="component-Data Provider"]`).click() cy.get(interact.COMPONENT_DATA_PROVIDER).click()
cy.get('[data-cy="dataSource-prop-control"]').click() cy.get(interact.DATASOURCE_PROP_CONTROL).click()
cy.get(".dropdown").contains("Multi Data").click() cy.get(interact.DROPDOWN).contains("Multi Data").click()
cy.wait(500) cy.wait(500)
// Add Form with schema to match table // Add Form with schema to match table
cy.addComponent("Form", "Form") cy.addComponent("Form", "Form")
cy.get('[data-cy="dataSource-prop-control"').click() cy.get(interact.DATASOURCE_PROP_CONTROL).click()
cy.get(".dropdown").contains("Multi Data").click() cy.get(interact.DROPDOWN).contains("Multi Data").click()
cy.wait(500) cy.wait(500)
// Add multi-select picker to form // Add multi-select picker to form
cy.addComponent("Form", "Multi-select Picker").then(componentId => { cy.addComponent("Form", "Multi-select Picker").then(componentId => {
cy.get('[data-cy="field-prop-control"]').type("Test Data").type("{enter}") cy.get(interact.DATASOURCE_FIELD_CONTROL).type("Test Data").type("{enter}")
cy.wait(1000) cy.wait(1000)
cy.getComponent(componentId).contains("Choose some options").click() cy.getComponent(componentId).contains("Choose some options").click()
// Check picker has 5 items // Check picker has 5 items
@ -40,7 +41,7 @@ filterTests(['all'], () => {
} }
// Check items have been selected // Check items have been selected
cy.getComponent(componentId) cy.getComponent(componentId)
.find(".spectrum-Picker-label") .find(interact.SPECTRUM_Picker_LABEL)
.contains("(5)") .contains("(5)")
}) })
}) })

View File

@ -8,6 +8,14 @@ export const TEMPLATE_CATEGORY_ACTIONGROUP = ".template-category"
export const TEMPLATE_CATEGORY_FILTER_ACTIONBUTTON = export const TEMPLATE_CATEGORY_FILTER_ACTIONBUTTON =
".template-category-filters .spectrum-ActionButton" ".template-category-filters .spectrum-ActionButton"
export const SPECTRUM_MODAL = ".spectrum-Modal" export const SPECTRUM_MODAL = ".spectrum-Modal"
export const APP_NAME_INPUT = "input" // we need to update this with atribute cy-data export const APP_NAME_INPUT = "input" // we need to update this with atribute cy-data;
export const SPECTRUM_BUTTON_GROUP = ".spectrum-ButtonGroup" export const SPECTRUM_BUTTON_GROUP = ".spectrum-ButtonGroup"
export const SPECTRUM_MODAL_INPUT = ".spectrum-Modal input" export const SPECTRUM_MODAL_INPUT = ".spectrum-Modal input"
//AddMultiOptionDatatype test
export const CATEGORY_DATA = '[data-cy="category-Data"]'
export const COMPONENT_DATA_PROVIDER = '[data-cy="component-Data Provider"]'
export const DATASOURCE_PROP_CONTROL = '[data-cy="dataSource-prop-control"]'
export const DROPDOWN = ".dropdown"
export const SPECTRUM_Picker_LABEL = ".spectrum-Picker-label"
export const DATASOURCE_FIELD_CONTROL = '[data-cy="field-prop-control"]'