Skip to content

Commit

Permalink
Added undo/redo to component rename test in calculator.spec. Also fix…
Browse files Browse the repository at this point in the history
…ed lint error in graph.spec. (#1292)
  • Loading branch information
nstclair-cc authored Jun 3, 2024
1 parent 0f6581f commit fc5012d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
19 changes: 10 additions & 9 deletions v3/cypress/e2e/calculator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,20 @@ context("Calculator", () => {
it("populates default title", () => {
c.getComponentTitle("calculator").should("contain", calculatorName)
})
it("updates calculator title", () => {
it("updates calculator title with undo/redo", () => {
const newCalculatorName = "my calc"
c.getComponentTitle("calculator").should("have.text", calculatorName)
c.changeComponentTitle("calculator", newCalculatorName)
c.getComponentTitle("calculator").should("have.text", newCalculatorName)

// Undo title change
// Note: This title does not update. Instead it goes to "my Cal" when the undo button is pressed
// See PT bug #187033159
// toolbar.getUndoTool().click()
// c.getComponentTitle("calculator").should("have.text", calculatorName)
cy.log("Check update calculator title with undo/redo")
// Undo title change
toolbar.getUndoTool().click()
c.getComponentTitle("calculator").should("have.text", calculatorName)

// Redo title change
// toolbar.getRedoTool().click()
// c.getComponentTitle("calculator").should("have.text", newCalculatorName)
// Redo title change
toolbar.getRedoTool().click()
c.getComponentTitle("calculator").should("have.text", newCalculatorName)
})
it("close calculator from toolshelf with undo/redo", () => {
const newCalculatorName = "my calc"
Expand All @@ -39,6 +38,8 @@ context("Calculator", () => {
c.getIconFromToolshelf("calc").click()
c.checkComponentDoesNotExist("calculator")

cy.log("Check undo/redo of close and open calculator component")

// Undo closing calculator (Reopen)
toolbar.getUndoTool().click()
c.checkComponentExists("calculator")
Expand Down
7 changes: 4 additions & 3 deletions v3/cypress/e2e/graph.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -539,16 +539,17 @@ context("Graph UI", () => {
expect(valueNum).to.be.closeTo(4, 0.1)
})
})
it("shows a bar graph with one categorical attr on primary axis and 'Fuse Dots into Bars' is checked", () => {
it("shows a bar graph for categorical attr on primary axis with 'Fuse Dots into Bars' checked", () => {
cy.dragAttributeToTarget("table", "Habitat", "bottom")
cy.get("[data-testid=bar-cover]").should("not.exist")
graph.getDisplayConfigButton().click()
cy.get("[data-testid=bar-chart-checkbox]").find("input").should("exist").and("have.attr", "type", "checkbox")
.and("not.be.checked")
cy.get("[data-testid=bar-chart-checkbox]").click()
cy.get("[data-testid=bar-chart-checkbox]").find("input").should("be.checked")
// TODO: It would be better to check for the exact number of bars, but the number seems to vary depending
// on whether you're running the test locally or in CI for some mysterious reason.
// TODO: It would be better to check for the exact number of bars,
// but the number seems to vary depending on whether
// you're running the test locally or in CI for some mysterious reason.
// cy.get("[data-testid=bar-cover]").should("exist").and("have.length", 3)
cy.get("[data-testid=bar-cover]").should("exist")
cy.get(".axis-wrapper.left").find("[data-testid=attribute-label]").should("exist").and("have.text", "Count")
Expand Down

0 comments on commit fc5012d

Please sign in to comment.