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

@ -14,7 +14,7 @@ context("Add Multi-Option Datatype", () => {
cy.navigateToFrontend() cy.navigateToFrontend()
cy.wait(500) cy.wait(500)
// Add data provider // 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('[data-cy="dataSource-prop-control"]').click()
cy.get(".dropdown").contains("Multi Data").click() cy.get(".dropdown").contains("Multi Data").click()
cy.wait(500) cy.wait(500)
@ -24,18 +24,20 @@ context("Add Multi-Option Datatype", () => {
cy.get(".dropdown").contains("Multi Data").click() cy.get(".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('[data-cy="field-prop-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
cy.getComponent(componentId).find('li').should('have.length', 5) cy.getComponent(componentId).find("li").should("have.length", 5)
// Select all items // Select all items
for (let i = 1; i < 6; i++) { 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 // Check items have been selected
cy.getComponent(componentId).find('.spectrum-Picker-label').contains("(5)") cy.getComponent(componentId)
.find(".spectrum-Picker-label")
.contains("(5)")
}) })
}) })
}) })