Skip to content

Commit

Permalink
Fix failing tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
lublagg committed Oct 2, 2024
1 parent 2750d78 commit 7f0931d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions v3/cypress/e2e/case-card.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ context("case card", () => {
table.toggleCaseView()
cy.wait(500)
cy.get('[data-testid="case-card-view"]').should("have.length", 3)
cy.get('[data-testid="case-card-view-next-button"]').eq(0).click()
cy.log("Add new case to 'middle' collection.")
cy.get('[data-testid="case-card-view"]').eq(1).find('[data-testid="case-card-view-index"]')
.eq(0).should("have.text", "4 cases")
Expand All @@ -264,7 +265,7 @@ context("case card", () => {
toolbar.getUndoTool().click()
toolbar.getUndoTool().click()
cy.get('[data-testid="case-card-view"]').eq(1).find('[data-testid="case-card-view-index"]')
.eq(0).should("have.text", "4 cases")
.eq(0).should("have.text", "1 of 4")
toolbar.getRedoTool().click()
toolbar.getRedoTool().click()
cy.get('[data-testid="case-card-view"]').eq(1).find('[data-testid="case-card-view-index"]')
Expand Down Expand Up @@ -328,16 +329,16 @@ context("case card", () => {
cy.wait(500)
cy.get('[data-testid="trash-menu-list"]').should("be.visible")
card.getDeleteSelectedCasesButton().click()
cy.get('[data-testid="case-card-view-index"]').should("have.text", "26 cases")
cy.get('[data-testid="case-card-attr-value"]').first().should("have.text", "26 values")
cy.get('[data-testid="case-card-view-next-button"]').click()
cy.get('[data-testid="case-card-view-index"]').should("have.text", "1 of 26")
cy.get('[data-testid="case-card-attr-value"]').first().should("have.text", "Asian Elephant")
cy.get('[data-testid="case-card-view-next-button"]').click()
cy.get('[data-testid="case-card-view-index"]').should("have.text", "2 of 26")
cy.get('[data-testid="case-card-attr-value"]').first().should("have.text", "Big Brown Bat")
card.getDeleteCasesButton().click()
cy.wait(500)
card.getDeleteUnselectedCasesButton().click()
cy.get('[data-testid="case-card-view-index"]').should("have.text", "1 of 1")
cy.get('[data-testid="case-card-attr-value"]').first().should("have.text", "Big Brown Bat")
cy.get('[data-testid="case-card-attr-value"]').first().should("have.text", "Asian Elephant")
})
it("allows user to set aside and restore cases from inspector panel", () => {
table.toggleCaseView()
Expand All @@ -353,8 +354,8 @@ context("case card", () => {
card.getRestoreSetAsideCasesButton().should("be.disabled").and("have.text", "Restore 0 Set Aside Cases")
// resorting to {force: true} because this is failing in CI, though it passes locally
card.getSetAsideSelectedCasesButton().click({force: true})
cy.get('[data-testid="case-card-view-index"]').should("have.text", "1 of 26")
cy.get('[data-testid="case-card-attr-value"]').first().should("have.text", "Asian Elephant")
cy.get('[data-testid="case-card-view-index"]').should("have.text", "26 cases")
cy.get('[data-testid="case-card-attr-value"]').first().should("have.text", "26 values")
card.getHideShowButton().click()
cy.wait(500)
card.getRestoreSetAsideCasesButton().should("not.be.disabled").and("have.text", "Restore 1 Set Aside Cases")
Expand Down
2 changes: 1 addition & 1 deletion v3/src/components/case-card/case-card-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export const CaseCardModel = TileContentModel
if (selectedCases) {
const caseLineages = Array.from(selectedCases).map(caseId => self.caseLineage(caseId) || [])
const commonCaseIds = findCommonCases(caseLineages)
if (commonCaseIds.length === 0) {
if (commonCaseIds.length > 0) {
const nearestCommonParentCaseId = commonCaseIds[commonCaseIds.length - 1]
const parentAttrs = collection.allParentAttrs
parentAttrs.forEach(attr => {
Expand Down

0 comments on commit 7f0931d

Please sign in to comment.