Update cypress tests to account for component restructuring

This commit is contained in:
Andrew Kingston 2021-11-22 15:26:41 +00:00
parent ae19581288
commit 5cf682e1f0
1 changed files with 38 additions and 36 deletions

View File

@ -10,11 +10,11 @@ context("Add Multi-Option Datatype", () => {
cy.addRowMultiValue(["1", "2", "3", "4", "5"])
})
it ("should add form with multi select picker, containing 5 options", () => {
it("should add form with multi select picker, containing 5 options", () => {
cy.navigateToFrontend()
cy.wait(500)
// Add data provider
cy.get(`[data-cy="category-Data Provider"]`).click()
cy.get(`[data-cy="component-Data Provider"]`).click()
cy.get('[data-cy="dataSource-prop-control"]').click()
cy.get(".dropdown").contains("Multi Data").click()
cy.wait(500)
@ -24,18 +24,20 @@ context("Add Multi-Option Datatype", () => {
cy.get(".dropdown").contains("Multi Data").click()
cy.wait(500)
// Add multi-select picker to form
cy.addComponent("Form", "Multi-select Picker").then((componentId) => {
cy.get('[data-cy="field-prop-control"]').type("Test Data").type('{enter}')
cy.addComponent("Form", "Multi-select Picker").then(componentId => {
cy.get('[data-cy="field-prop-control"]').type("Test Data").type("{enter}")
cy.wait(1000)
cy.getComponent(componentId).contains("Choose some options").click()
// Check picker has 5 items
cy.getComponent(componentId).find('li').should('have.length', 5)
cy.getComponent(componentId).find("li").should("have.length", 5)
// Select all items
for (let i = 1; i < 6; i++) {
cy.getComponent(componentId).find('li').contains(i).click()
cy.getComponent(componentId).find("li").contains(i).click()
}
// Check items have been selected
cy.getComponent(componentId).find('.spectrum-Picker-label').contains("(5)")
cy.getComponent(componentId)
.find(".spectrum-Picker-label")
.contains("(5)")
})
})
})