From 68a6502e3dc810fa602b9430b2fa4d493b82472c Mon Sep 17 00:00:00 2001 From: Howard Askew <19271569+howaskew@users.noreply.github.com> Date: Thu, 7 Nov 2024 10:47:47 +0000 Subject: [PATCH 1/2] fix: "Show All Errors" button in results summary.html #683 --- .../report-templates/summary.md.handlebars | 112 +++++++++--------- 1 file changed, 58 insertions(+), 54 deletions(-) diff --git a/packages/openactive-integration-tests/test/report-templates/summary.md.handlebars b/packages/openactive-integration-tests/test/report-templates/summary.md.handlebars index 0dd2931b41..bc21dca735 100644 --- a/packages/openactive-integration-tests/test/report-templates/summary.md.handlebars +++ b/packages/openactive-integration-tests/test/report-templates/summary.md.handlebars @@ -1,20 +1,20 @@ - - + + @@ -70,22 +70,27 @@ were found, that also includes a list of which tests failed as a result: {{#eachSorted opportunityTypeGroups }} -### {{{ opportunityTypeName }}} +

{{{ opportunityTypeName }}}

+ {{/eachSorted}} --- From 476b2ff06c21e2c4978cc8319aa1f71e89a8c99a Mon Sep 17 00:00:00 2001 From: Nick Evans <2616208+nickevansuk@users.noreply.github.com> Date: Thu, 30 Jan 2025 23:13:21 +0000 Subject: [PATCH 2/2] Rewrite to fix various bugs --- .github/workflows/README.md | 6 +- .../report-templates/summary.md.handlebars | 210 ++++++++++-------- 2 files changed, 120 insertions(+), 96 deletions(-) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index ca3e8674bc..8f09162a78 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -39,7 +39,7 @@ This job runs Test Suite tests on this branch against Reference Implementation ( - **Checkout OpenActive.Server.NET**: This step checks out the Reference Implementation in OpenActive.Server.NET and places it in a directory named "server". -- **Setup .NET Core SDK and Node.js**: These steps set up the required versions of .NET Core SDK (3.1.419) and Node.js (14.x). +- **Setup .NET Core SDK and Node.js**: These steps set up the required versions of .NET Core SDK (3.1.419) and Node.js (18.17.1). - **Install OpenActive.Server.NET dependencies**: This step installs the dependencies of the "OpenActive.Server.NET" project. @@ -98,7 +98,7 @@ This workflow defines one job: **build**. #### Steps - **Checkout OpenActive Test Suite**: This step checks out the OpenActive Test Suite code repository. -- **Setup Node.js 14.x**: This step sets up Node.js version 14.x in the job's environment. +- **Setup Node.js 18.17.1**: This step sets up Node.js version 18.17.1 in the job's environment. - **Install OpenActive Test Suite**: This step runs `npm install` to install the dependencies of the OpenActive Test Suite. @@ -127,7 +127,7 @@ This workflow defines one job: **generate**. #### Steps - **Checkout**: This step uses the actions/checkout action to clone the repository. It checks out the master branch and places the repository in a directory named "openactive-test-suite." -- **Setup Node.js 14.x**: This step uses the actions/setup-node action to set up Node.js version 14.x in the job's environment. This is necessary because Node.js is required for managing JavaScript dependencies. +- **Setup Node.js 18.17.1**: This step uses the actions/setup-node action to set up Node.js version 18.17.1 in the job's environment. This is necessary because Node.js is required for managing JavaScript dependencies. - **Update openactive-integration-tests with latest data-models and validators**: This step runs npm install to update the openactive-data-models and data-model-validator dependencies to their latest versions. It targets the openactive-integration-tests package within the repository. diff --git a/packages/openactive-integration-tests/test/report-templates/summary.md.handlebars b/packages/openactive-integration-tests/test/report-templates/summary.md.handlebars index bc21dca735..b151f7204d 100644 --- a/packages/openactive-integration-tests/test/report-templates/summary.md.handlebars +++ b/packages/openactive-integration-tests/test/report-templates/summary.md.handlebars @@ -1,21 +1,28 @@ - + # Summary of Test Suite Results for '{{ bookingServiceName }}' @@ -70,105 +77,122 @@ were found, that also includes a list of which tests failed as a result: {{#eachSorted opportunityTypeGroups }} -

{{{ opportunityTypeName }}}

- - + + {{/eachSorted}} ---- + + + + // Show or hide "✅ All tests passing" if no feature groups are visible + document.querySelectorAll("section").forEach(function(sec) { + const featureGroups = Array.from(sec.querySelectorAll(".feature-group")); + const message = sec.querySelector(".all-tests-passing"); + if (message) { + // If any feature group is visible, hide the message + const anyVisible = featureGroups.some(fg => fg.style.display !== "none"); + message.style.display = anyVisible ? "none" : ""; + } + }); + }; + hideSuccessToggle.addEventListener("change", updateVisibility); + + // Initialize visibility on page load + updateVisibility(); + + // Collapse passing sections if there is at least one failing test + const collapsePassingSectionsIfAnyFailing = function() { + // Check if there's any failing test in the entire document + const anyFailing = document.querySelector(".feature-group[data-status='failed'], .logger[data-status='failed']"); + + // If there's a failing test, collapse any section that does NOT contain a failing feature-group/logger + if (anyFailing) { + document.querySelectorAll("section").forEach(function(section) { + const hasFailingChild = section.querySelector(".feature-group[data-status='failed'], .logger[data-status='failed']"); + if (!hasFailingChild && !section.classList.contains("collapsed")) { + section.classList.add("collapsed"); + const heading = section.querySelector("h3"); + if (heading && heading.textContent.startsWith("▼ ")) { + heading.textContent = "► " + heading.textContent.slice(2); + } + } + }); + } + }; - - - + // Apply the collapse logic right after the first visibility update + collapsePassingSectionsIfAnyFailing(); +}); +