Skip to content

Commit

Permalink
fix: flaky tool shelf cypress test (#1404)
Browse files Browse the repository at this point in the history
  • Loading branch information
kswenson authored Aug 15, 2024
1 parent 7619fd8 commit 30bc16d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,31 @@ context("codap toolbar", () => {
cy.log('Setup complete')
})
it("will open a new table", () => {
c.getIconFromToolShelf("table").click()
c.clickIconFromToolShelf("table")
toolbar.getNewCaseTable().click()
table.getCollection().should("be.visible")
c.getComponentTitle("table").should("have.text", "New Dataset")
c.getIconFromToolShelf("table").click()
toolbar.getDatasetListedInToolShelf("New Dataset").should("be.visible")
})
it("will open a graph", () => {
c.getIconFromToolShelf("graph").click()
c.clickIconFromToolShelf("graph")
graph.getGraphTile().should("be.visible")
// graphs with no associated data set should not have a title
c.getComponentTitle("graph").should("have.text", "")
})
it("will open a map", () => {
c.getIconFromToolShelf("map").click()
c.clickIconFromToolShelf("map")
map.getMapTile().should("be.visible")
c.getComponentTitle("map").should("have.text", "Map")
})
it("will open a slider", () => {
c.getIconFromToolShelf("slider").click()
c.clickIconFromToolShelf("slider")
slider.getSliderTile().should("be.visible")
c.getComponentTitle("slider").should("have.text", "v1")
})
it("will open a calculator", () => {
c.getIconFromToolShelf("calc").click()
c.clickIconFromToolShelf("calc")
calculator.getCalculatorTile().should("be.visible")
c.getComponentTitle("calculator").should("have.text", "Calculator")
})
Expand Down
6 changes: 6 additions & 0 deletions v3/cypress/support/elements/component-elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ export const ComponentElements = {
getIconFromToolShelf(component: string) {
return toolbar.getToolShelfIcon(component)
},
clickIconFromToolShelf(component: string) {
this.getIconFromToolShelf(component).click()
// Without this wait(), visibility tests intermittently fail because the tile
// has zero width and/or height initially before animating to its final size.
cy.wait(100)
},
selectTile(component: string, index = 0) {
cy.get(".codap-container").click("bottom")
this.getComponentTile(component, index).click()
Expand Down

0 comments on commit 30bc16d

Please sign in to comment.