From 2d226557a8d9a9e701973bd55ab864077dbbdea4 Mon Sep 17 00:00:00 2001 From: Zachary Tucker Date: Wed, 17 May 2023 14:07:11 -0400 Subject: [PATCH 1/6] fix: Tests failed to open Catalog list --- end-to-end-tests/cypress/support/commands.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/end-to-end-tests/cypress/support/commands.js b/end-to-end-tests/cypress/support/commands.js index ac62a373..190746be 100644 --- a/end-to-end-tests/cypress/support/commands.js +++ b/end-to-end-tests/cypress/support/commands.js @@ -44,10 +44,13 @@ Cypress.Commands.add("navToEditorByDrawer", (oscalType, pageTitle) => { cy.wait(requestsMade, { timeout: 60000 }); } - cy.get('ul[aria-label="file system navigator"] li', { timeout: 30000 }) - .should("have.attr", "aria-expanded", "false") - .contains(oscalType) - .click(); + cy.get('ul[aria-label="file system navigator"] li', { timeout: 30000 }).should( + "have.attr", + "aria-expanded", + "false" + ); + + cy.contains(oscalType).trigger("mouseover").trigger("click", { force: true }); cy.contains(pageTitle).click(); }); From 57f8f20c23b78b461551e512fd7307cdcb99758e Mon Sep 17 00:00:00 2001 From: Zachary Tucker Date: Fri, 19 May 2023 10:02:18 -0400 Subject: [PATCH 2/6] Test: revert to before react 18 --- .github/workflows/test-container-pr.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-container-pr.yml b/.github/workflows/test-container-pr.yml index f85843de..e6f6a13a 100644 --- a/.github/workflows/test-container-pr.yml +++ b/.github/workflows/test-container-pr.yml @@ -68,6 +68,8 @@ jobs: load: true provenance: false tags: ${{ env.IMAGE_NAME }} + build-args: | + "OSCAL_REACT_GIT_BRANCH=tuckerzp/test-before-react-18" # Run container in the background, exposing the port that # Cypress uses to run the tests. From dd1aaca01bd08cfd7257533224624afa51f3454d Mon Sep 17 00:00:00 2001 From: Zachary Tucker Date: Fri, 19 May 2023 13:46:26 -0400 Subject: [PATCH 3/6] revert test --- .github/workflows/test-container-pr.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test-container-pr.yml b/.github/workflows/test-container-pr.yml index e6f6a13a..f85843de 100644 --- a/.github/workflows/test-container-pr.yml +++ b/.github/workflows/test-container-pr.yml @@ -68,8 +68,6 @@ jobs: load: true provenance: false tags: ${{ env.IMAGE_NAME }} - build-args: | - "OSCAL_REACT_GIT_BRANCH=tuckerzp/test-before-react-18" # Run container in the background, exposing the port that # Cypress uses to run the tests. From 99d817c350cd01e7aa3c92083fb80254ab301c5a Mon Sep 17 00:00:00 2001 From: Zachary Tucker Date: Thu, 25 May 2023 14:28:20 -0400 Subject: [PATCH 4/6] fix: clicking twice causes test failure For some reason the first click when selecting catalogs in the drawer selector fails. This leads to A LOT of tests failing as we use this function in pretty much all our tests. This temporary fix will let us test other functionality rather than just always failing. We really should completely rework how we naviagte to each document type in the future as this code is extemely fragile. --- end-to-end-tests/cypress/support/commands.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/end-to-end-tests/cypress/support/commands.js b/end-to-end-tests/cypress/support/commands.js index 190746be..f70e0667 100644 --- a/end-to-end-tests/cypress/support/commands.js +++ b/end-to-end-tests/cypress/support/commands.js @@ -50,7 +50,17 @@ Cypress.Commands.add("navToEditorByDrawer", (oscalType, pageTitle) => { "false" ); - cy.contains(oscalType).trigger("mouseover").trigger("click", { force: true }); + cy.contains(oscalType).trigger("click"); + + // TODO: For some reason the first click when selecting catalogs in the + // drawer selector fails. This leads to A LOT of tests failing as we use + // this function in pretty much all our tests. + // This temporary fix will let us test other functionality rather than just + // always failing. We really should completely rework how we naviagte to each + // document type in the future as this code is extemely fragile. + if (oscalType === oscalObjectTypes[3].oscalType) { + cy.contains(oscalType).trigger("click"); + } cy.contains(pageTitle).click(); }); From 70042c2556e7b1dc5a6027581d8c2bfda498db3e Mon Sep 17 00:00:00 2001 From: Zachary Tucker Date: Thu, 25 May 2023 14:30:54 -0400 Subject: [PATCH 5/6] spelling --- end-to-end-tests/cypress/support/commands.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/end-to-end-tests/cypress/support/commands.js b/end-to-end-tests/cypress/support/commands.js index f70e0667..96281cb2 100644 --- a/end-to-end-tests/cypress/support/commands.js +++ b/end-to-end-tests/cypress/support/commands.js @@ -56,8 +56,8 @@ Cypress.Commands.add("navToEditorByDrawer", (oscalType, pageTitle) => { // drawer selector fails. This leads to A LOT of tests failing as we use // this function in pretty much all our tests. // This temporary fix will let us test other functionality rather than just - // always failing. We really should completely rework how we naviagte to each - // document type in the future as this code is extemely fragile. + // always failing. We really should completely rework how we navigate to each + // document type in the future as this code is extremely fragile. if (oscalType === oscalObjectTypes[3].oscalType) { cy.contains(oscalType).trigger("click"); } From 650ede6873a9232806f340475d902e9021c20696 Mon Sep 17 00:00:00 2001 From: Zachary Tucker Date: Fri, 26 May 2023 12:17:44 -0400 Subject: [PATCH 6/6] Ignore TypeError when we intentionally throw it --- end-to-end-tests/cypress/e2e/OSCAL/OSCAL_Load_Tests.cy.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/end-to-end-tests/cypress/e2e/OSCAL/OSCAL_Load_Tests.cy.js b/end-to-end-tests/cypress/e2e/OSCAL/OSCAL_Load_Tests.cy.js index a045d3f7..e740ad96 100644 --- a/end-to-end-tests/cypress/e2e/OSCAL/OSCAL_Load_Tests.cy.js +++ b/end-to-end-tests/cypress/e2e/OSCAL/OSCAL_Load_Tests.cy.js @@ -238,6 +238,12 @@ describe("Errors caused by loading a bad component definition", () => { }); it("do not persist after loading a valid component in Viewer", () => { + // Ignore TypeErrors for this test + cy.on( + "uncaught:exception", + (err) => !err.message.includes("Cannot read properties of undefined") + ); + const sspExampleUrl = "https://raw.githubusercontent.com/usnistgov/oscal-content/main/examples/ssp/json/ssp-example.json"; cy.navToCdefEditor(COMP_DEF_TITLE_ORIG);