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

@ -1,41 +1,43 @@
context("Add Multi-Option Datatype", () => { context("Add Multi-Option Datatype", () => {
before(() => { before(() => {
cy.login() cy.login()
cy.createTestApp() cy.createTestApp()
}) })
it("should create a new table, with data", () => { it("should create a new table, with data", () => {
cy.createTable("Multi Data") cy.createTable("Multi Data")
cy.addColumn("Multi Data", "Test Data", "Multi-select", "1\n2\n3\n4\n5") cy.addColumn("Multi Data", "Test Data", "Multi-select", "1\n2\n3\n4\n5")
cy.addRowMultiValue(["1", "2", "3", "4", "5"]) 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.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)
// 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('[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)
// 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)")
}) })
})
}) })