diff --git a/.github/workflows/build-electron-app.yml b/.github/workflows/build-electron-app.yml index 1fc31426..8f0efea7 100644 --- a/.github/workflows/build-electron-app.yml +++ b/.github/workflows/build-electron-app.yml @@ -37,7 +37,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6.0.2 with: submodules: recursive - if: github.event.inputs.version != '' @@ -63,7 +63,7 @@ jobs: fi - name: Cache Electron binaries id: electron-cache - uses: actions/cache@v4 + uses: actions/cache@v5.0.4 env: cache-name: electron-cache-v1 with: @@ -75,7 +75,7 @@ jobs: ${{ runner.os }}-build-${{ env.cache-name }}- - name: Build release id: release-builder - uses: nick-fields/retry@v3 + uses: nick-fields/retry@v4.0.0 continue-on-error: false env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -93,20 +93,20 @@ jobs: - name: Zip Linux Unpacked build run: zip -r dist/linux-unpacked.zip dist/linux-unpacked - name: Upload Linux Unpacked build - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7.0.0 with: name: linux-unpacked path: dist/linux-unpacked.zip - name: Zip Win Unpacked build run: zip -r dist/win-unpacked.zip dist/win-unpacked - name: Upload Win Unpacked build - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7.0.0 with: name: win-unpacked path: dist/win-unpacked.zip - if: env.REPO_OWNER != github.repository_owner name: Upload Linux Dist Release - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7.0.0 with: name: linux-dist-release path: | @@ -115,7 +115,7 @@ jobs: dist/latest-linux.yml - if: env.REPO_OWNER != github.repository_owner name: Upload Win Dist Release - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7.0.0 with: name: win-dist-release path: | @@ -132,7 +132,7 @@ jobs: runs-on: macos-15-intel steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6.0.2 with: submodules: recursive - if: github.event.inputs.version != '' @@ -160,12 +160,12 @@ jobs: else echo "REPO_OWNER=${{ github.repository_owner }}" >> $GITHUB_ENV fi - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v6.3.0 with: node-version: 24.14.0 - name: Cache Electron binaries id: electron-cache - uses: actions/cache@v4 + uses: actions/cache@v5.0.4 env: cache-name: electron-cache-v1 with: @@ -176,7 +176,7 @@ jobs: ${{ runner.os }}-build-${{ env.cache-name }}- - name: Build release id: release-builder - uses: nick-fields/retry@v3 + uses: nick-fields/retry@v4.0.0 continue-on-error: false env: APPLE_TEAM_ID: ${{ secrets.BFX_APPLE_TEAM_ID }} @@ -208,13 +208,13 @@ jobs: - name: Zip Mac Unpacked build run: zip -r dist/mac.zip dist/mac - name: Upload Mac Unpacked build - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7.0.0 with: name: mac-unpacked path: dist/mac.zip - if: env.REPO_OWNER != github.repository_owner name: Upload Mac Dist Release - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7.0.0 with: name: mac-dist-release path: | @@ -231,7 +231,7 @@ jobs: needs: [linux-win-docker-builder, mac-builder] steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6.0.2 - name: Get release version id: version run: | @@ -251,7 +251,7 @@ jobs: echo "$CONTENT" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - name: Update matching draft release - uses: actions/github-script@v8 + uses: actions/github-script@v9.0.0 env: VERSION: ${{ steps.version.outputs.version }} CONTENT: ${{ steps.changelog.outputs.content }} @@ -285,6 +285,7 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, release_id: draft.id, + tag_name: draft.tag_name || `v${version}`, body: content, }) linux-e2e-test-runner: @@ -294,27 +295,25 @@ jobs: needs: [linux-win-docker-builder] steps: - name: Checkout - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + uses: actions/checkout@v6.0.2 + - uses: actions/setup-node@v6.3.0 with: node-version: 24.14.0 - name: Install main dev deps - run: npm i --development --no-audit --progress=false --force + run: npm ci --no-audit --force - name: Download Linux Unpacked build - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.0 with: name: linux-unpacked path: dist - name: Unzip Linux Unpacked build run: unzip dist/linux-unpacked.zip - name: Run tests - uses: coactions/setup-xvfb@6b00cf1889f4e1d5a48635647013c0508128ee1a - with: - run: npm run e2e + run: npm run e2e - name: Normalize E2E test report run: node ./scripts/node/normalize-e2e-test-report e2e-test-report.xml - name: Upload Linux E2E test results - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7.0.0 with: name: linux-e2e-test-results path: e2e-test-report.xml @@ -326,27 +325,25 @@ jobs: needs: [linux-win-docker-builder] steps: - name: Checkout - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + uses: actions/checkout@v6.0.2 + - uses: actions/setup-node@v6.3.0 with: node-version: 24.14.0 - name: Install main dev deps - run: npm i --development --no-audit --progress=false --force + run: npm ci --no-audit --force - name: Download Linux Unpacked build - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.0 with: name: win-unpacked path: dist - name: Unzip Win Unpacked build run: 7z -y x dist/win-unpacked.zip - name: Run tests - uses: coactions/setup-xvfb@6b00cf1889f4e1d5a48635647013c0508128ee1a - with: - run: npm run e2e + run: npm run e2e - name: Normalize E2E test report run: node ./scripts/node/normalize-e2e-test-report e2e-test-report.xml - name: Upload Win E2E test results - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7.0.0 with: name: win-e2e-test-results path: e2e-test-report.xml @@ -358,29 +355,37 @@ jobs: needs: [mac-builder] steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6.0.2 - name: Prepare Mac runner uses: ./.github/actions/prepare-mac-runner - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v6.3.0 with: node-version: 24.14.0 - name: Install main dev deps - run: npm i --development --no-audit --progress=false --force + run: npm ci --no-audit --force - name: Download Mac Unpacked build - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.0 with: name: mac-unpacked path: dist - name: Unzip Mac Unpacked build run: unzip dist/mac.zip - name: Run tests - uses: coactions/setup-xvfb@6b00cf1889f4e1d5a48635647013c0508128ee1a - with: - run: npm run e2e + run: npm run e2e - name: Normalize E2E test report run: node ./scripts/node/normalize-e2e-test-report e2e-test-report.xml - name: Upload Mac E2E test results - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7.0.0 with: name: mac-e2e-test-results path: e2e-test-report.xml + web-page-report: + needs: + - linux-e2e-test-runner + - win-e2e-test-runner + - mac-e2e-test-runner + permissions: + contents: read + actions: read + checks: write + uses: ./.github/workflows/e2e-test-report.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d0cb0d2..d2ad7351 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,25 +15,25 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6.0.2 with: submodules: recursive - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v6.3.0 with: node-version: 24.14.0 - name: Setup configs and install deps run: ./scripts/setup.sh -u - name: Run tests - uses: nick-fields/retry@v3 - continue-on-error: false - with: - timeout_minutes: 20 - retry_wait_seconds: 10 - max_attempts: 3 - retry_on: any - command: npm test -- -- --reporter=json --reporter-option output=test-report.json - - uses: actions/upload-artifact@v4 + run: npm test -- -- --reporter=json --reporter-option output=test-report.json + - uses: actions/upload-artifact@v7.0.0 if: success() || failure() with: name: test-results path: test-report.json + web-page-report: + needs: linux-test-runner + permissions: + contents: read + actions: read + checks: write + uses: ./.github/workflows/test-report.yml diff --git a/.github/workflows/e2e-test-report.yml b/.github/workflows/e2e-test-report.yml index 7ce5edd3..ed3692f4 100644 --- a/.github/workflows/e2e-test-report.yml +++ b/.github/workflows/e2e-test-report.yml @@ -2,10 +2,7 @@ name: 'E2E Test Report' run-name: 'E2E Test Report: Commit ${{ github.sha }}' on: - workflow_run: - workflows: ['Build release'] - types: - - completed + workflow_call permissions: contents: read @@ -16,56 +13,51 @@ jobs: e2e-web-page-report: name: E2E Web Page Report runs-on: ubuntu-22.04 - if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - name: Download Linux E2E test results - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.0 with: - run-id: ${{ github.event.workflow_run.id }} github-token: ${{ secrets.GITHUB_TOKEN }} name: linux-e2e-test-results path: linux-e2e-test-results - - uses: dorny/test-reporter@v1.8.0 + - uses: dorny/test-reporter@v3.0.0 id: linux-e2e-test-results with: name: Linux E2E Tests + report-title: Linux E2E Tests path: linux-e2e-test-results/e2e-test-report.xml reporter: jest-junit + collapsed: never # Workaround for error 'fatal: not a git repository' caused by a call to 'git ls-files' # See: https://github.com/dorny/test-reporter/issues/169#issuecomment-1583560458 max-annotations: 0 - name: Download Win E2E test results - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.0 with: - run-id: ${{ github.event.workflow_run.id }} github-token: ${{ secrets.GITHUB_TOKEN }} name: win-e2e-test-results path: win-e2e-test-results - - uses: dorny/test-reporter@v1.8.0 + - uses: dorny/test-reporter@v3.0.0 id: win-e2e-test-results with: name: Win E2E Tests + report-title: Win E2E Tests path: win-e2e-test-results/e2e-test-report.xml reporter: jest-junit + collapsed: never max-annotations: 0 - name: Download Mac E2E test results - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.0 with: - run-id: ${{ github.event.workflow_run.id }} github-token: ${{ secrets.GITHUB_TOKEN }} name: mac-e2e-test-results path: mac-e2e-test-results - - uses: dorny/test-reporter@v1.8.0 + - uses: dorny/test-reporter@v3.0.0 id: mac-e2e-test-results with: name: Mac E2E Tests + report-title: Mac E2E Tests path: mac-e2e-test-results/e2e-test-report.xml reporter: jest-junit + collapsed: never max-annotations: 0 - - name: E2E Test Report Summary - run: | - echo "### E2E Test Report page is ready! :rocket:" >> $GITHUB_STEP_SUMMARY - echo "And available at the following links for applicable OSs:" >> $GITHUB_STEP_SUMMARY - echo "- [Linux](${{ steps.linux-e2e-test-results.outputs.url_html }})" >> $GITHUB_STEP_SUMMARY - echo "- [Win](${{ steps.win-e2e-test-results.outputs.url_html }})" >> $GITHUB_STEP_SUMMARY - echo "- [Mac](${{ steps.mac-e2e-test-results.outputs.url_html }})" >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/test-report.yml b/.github/workflows/test-report.yml index bf11d9d5..43753b0a 100644 --- a/.github/workflows/test-report.yml +++ b/.github/workflows/test-report.yml @@ -2,10 +2,7 @@ name: 'Test Report' run-name: 'Test Report: Commit ${{ github.sha }}' on: - workflow_run: - workflows: ['CI'] - types: - - completed + workflow_call permissions: contents: read @@ -16,25 +13,20 @@ jobs: web-page-report: name: Web Page Report runs-on: ubuntu-22.04 - if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - name: Download test results - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.0 with: - run-id: ${{ github.event.workflow_run.id }} github-token: ${{ secrets.GITHUB_TOKEN }} name: test-results path: test-results - - uses: dorny/test-reporter@v1.8.0 + - uses: dorny/test-reporter@v3.0.0 id: test-results with: name: Mocha Tests path: test-results/test-report.json reporter: mocha-json + collapsed: never # Workaround for error 'fatal: not a git repository' caused by a call to 'git ls-files' # See: https://github.com/dorny/test-reporter/issues/169#issuecomment-1583560458 max-annotations: 0 - - name: Test Report Summary - run: | - echo "### Test Report page is ready! :rocket:" >> $GITHUB_STEP_SUMMARY - echo "And available at the following [Link](${{ steps.test-results.outputs.url_html }})" >> $GITHUB_STEP_SUMMARY diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b680e9b..47bc027b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [4.44.0] - 2026-04-29 + +### Added + +- Implemented the possibility to download the `DEB` app releases instead of `AppImage` for better UX. PR: [bfx-report-ui#1062](https://github.com/bitfinexcom/bfx-report-ui/pull/1062) +- Added independent integration tests with GH Actions to ensure changes to the express layer will work with the `bfx-report` worker. PR: [bfx-report-express#60](https://github.com/bitfinexcom/bfx-report-express/pull/60) + +### Changed + +- Refactored the `Average Win/Loss` report as a functional and implemented a unified `useFetchLifecycle` hook that will replace legacy (tightly coupled to class components) helpers and will be widely reused in further step-by-step reports refactoring. PR: [bfx-report-ui#1067](https://github.com/bitfinexcom/bfx-report-ui/pull/1067) +- Removed unused report PGP signature since the ability to create a signature for reports was implemented 7 years ago and has still not been merged into the repository [bfx-ext-gpg-js#1](https://github.com/bitfinexcom/bfx-ext-gpg-js/pull/1). PRs: [bfx-report#472](https://github.com/bitfinexcom/bfx-report/pull/472), [bfx-reports-framework#507](https://github.com/bitfinexcom/bfx-reports-framework/pull/507) +- Updated GH Actions to resolve: `nodejs v20 actions are deprecated`. PRs: [bfx-report#470](https://github.com/bitfinexcom/bfx-report/pull/470), [bfx-reports-framework#505](https://github.com/bitfinexcom/bfx-reports-framework/pull/505), [bfx-report-electron#618](https://github.com/bitfinexcom/bfx-report-electron/pull/618), [bfx-facs-db-better-sqlite#16](https://github.com/bitfinexcom/bfx-facs-db-better-sqlite/pull/16) +- Reworked error logging exceptions to simplify support and bring clarity of understanding. PR: [bfx-report-electron#619](https://github.com/bitfinexcom/bfx-report-electron/pull/619) + +### Fixed + +- Fixed GH Actions workflow permissions. The workflow is requesting 'actions: read, checks: write', but is only allowed 'actions: none, checks: none'. PRs: [bfx-report#473](https://github.com/bitfinexcom/bfx-report/pull/473), [bfx-reports-framework#509](https://github.com/bitfinexcom/bfx-reports-framework/pull/509), [bfx-report-express#63](https://github.com/bitfinexcom/bfx-report-express/pull/63), [bfx-report-electron#620](https://github.com/bitfinexcom/bfx-report-electron/pull/620), [bfx-facs-db-better-sqlite#17](https://github.com/bitfinexcom/bfx-facs-db-better-sqlite/pull/17) +- Bumped `redux-saga` from `0.16.2` to `1.4.2`, actualized effects/utils usage and fixed a couple of legacy bugs. PR: [bfx-report-ui#1066](https://github.com/bitfinexcom/bfx-report-ui/pull/1066) +- Fixed selected type representation in the `Average Win/Loss` report. PR: [bfx-report-ui#1064](https://github.com/bitfinexcom/bfx-report-ui/pull/1064) +- Fixed `node-fetch` timeout handling. PR: [bfx-report#471](https://github.com/bitfinexcom/bfx-report/pull/471) +- Fixed the issue with pushing untagged drafts of the electron app release, passes the tag explicitly so that it is not replaced with a hash. PR: [bfx-report-electron#617](https://github.com/bitfinexcom/bfx-report-electron/pull/617) + +### Security + +- Updated UI dependencies to fix high vulnerabilities. PR: [bfx-report-ui#1068](https://github.com/bitfinexcom/bfx-report-ui/pull/1068) + ## [4.43.1] - 2026-04-09 ### Fixed diff --git a/bfx-report-ui b/bfx-report-ui index ac767ddc..a68255e3 160000 --- a/bfx-report-ui +++ b/bfx-report-ui @@ -1 +1 @@ -Subproject commit ac767ddc1c7326306bd60b73ac4a5cafaea4b8bd +Subproject commit a68255e3243738fedde64de5a75a00557639d8c1 diff --git a/bfx-reports-framework b/bfx-reports-framework index d7d4b7f3..63060fc3 160000 --- a/bfx-reports-framework +++ b/bfx-reports-framework @@ -1 +1 @@ -Subproject commit d7d4b7f3a25090ba69180cd0a974407815084412 +Subproject commit 63060fc36f8eb726eb66859e5a4bb85a54c4d3b0 diff --git a/package-lock.json b/package-lock.json index f358f787..7d6e76f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "bfx-report-electron", - "version": "4.43.1", + "version": "4.44.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "bfx-report-electron", - "version": "4.43.1", + "version": "4.44.0", "license": "Apache-2.0", "dependencies": { "@bitfinex/bfx-svc-test-helper": "git+https://github.com/bitfinexcom/bfx-svc-test-helper.git", @@ -49,6 +49,7 @@ "electron-chromedriver": "40.8.2", "eslint": "8.57.0", "eslint-config-standard": "17.1.0", + "fast-xml-parser": "5.5.12", "mocha": "11.1.0", "standard": "17.1.2" }, @@ -7789,9 +7790,9 @@ } }, "node_modules/fast-xml-parser": { - "version": "5.5.9", - "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.5.9.tgz", - "integrity": "sha512-jldvxr1MC6rtiZKgrFnDSvT8xuH+eJqxqOBThUVjYrxssYTo1avZLGql5l0a0BAERR01CadYzZ83kVEkbyDg+g==", + "version": "5.5.12", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.5.12.tgz", + "integrity": "sha512-nUR0q8PPfoA/svPM43Gup7vLOZWppaNrYgGmrVqrAVJa7cOH4hMG6FX9M4mQ8dZA1/ObGZHzES7Ed88hxEBSJg==", "dev": true, "funding": [ { @@ -7802,8 +7803,8 @@ "license": "MIT", "dependencies": { "fast-xml-builder": "^1.1.4", - "path-expression-matcher": "^1.2.0", - "strnum": "^2.2.2" + "path-expression-matcher": "^1.5.0", + "strnum": "^2.2.3" }, "bin": { "fxparser": "src/cli/cli.js" @@ -12332,9 +12333,9 @@ } }, "node_modules/path-expression-matcher": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/path-expression-matcher/-/path-expression-matcher-1.2.0.tgz", - "integrity": "sha512-DwmPWeFn+tq7TiyJ2CxezCAirXjFxvaiD03npak3cRjlP9+OjTmSy1EpIrEbh+l6JgUundniloMLDQ/6VTdhLQ==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/path-expression-matcher/-/path-expression-matcher-1.5.0.tgz", + "integrity": "sha512-cbrerZV+6rvdQrrD+iGMcZFEiiSrbv9Tfdkvnusy6y0x0GKBXREFg/Y65GhIfm0tnLntThhzCnfKwp1WRjeCyQ==", "dev": true, "funding": [ { @@ -15087,9 +15088,9 @@ } }, "node_modules/strnum": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/strnum/-/strnum-2.2.2.tgz", - "integrity": "sha512-DnR90I+jtXNSTXWdwrEy9FakW7UX+qUZg28gj5fk2vxxl7uS/3bpI4fjFYVmdK9etptYBPNkpahuQnEwhwECqA==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/strnum/-/strnum-2.2.3.tgz", + "integrity": "sha512-oKx6RUCuHfT3oyVjtnrmn19H1SiCqgJSg+54XqURKp5aCMbrXrhLjRN9TjuwMjiYstZ0MzDrHqkGZ5dFTKd+zg==", "dev": true, "funding": [ { diff --git a/package.json b/package.json index e7d70ea7..0b31079b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bfx-report-electron", - "version": "4.43.1", + "version": "4.44.0", "repository": "https://github.com/bitfinexcom/bfx-report-electron", "description": "Reporting tool", "author": "bitfinex.com", @@ -50,6 +50,7 @@ "electron-chromedriver": "40.8.2", "eslint": "8.57.0", "eslint-config-standard": "17.1.0", + "fast-xml-parser": "5.5.12", "mocha": "11.1.0", "standard": "17.1.2" }, diff --git a/scripts/node/normalize-e2e-test-report.js b/scripts/node/normalize-e2e-test-report.js index 4de742b1..ae69945d 100644 --- a/scripts/node/normalize-e2e-test-report.js +++ b/scripts/node/normalize-e2e-test-report.js @@ -1,20 +1,54 @@ 'use strict' -const path = require('path') +const path = require('node:path') const { readFileSync, writeFileSync -} = require('fs') +} = require('node:fs') +const { + XMLParser, + XMLBuilder +} = require('fast-xml-parser') const cwd = process.cwd() const fileName = process.argv[2] const filePath = path.join(cwd, fileName) -const content = readFileSync(filePath, { encoding: 'utf8' }) +const reportXML = readFileSync(filePath, { encoding: 'utf8' }) + +const opts = { + ignoreAttributes: false, + allowBooleanAttributes: true, + attributeNamePrefix: 'attr_', + cdataPropName: '__cdata', + format: true, + unpairedTags: 'property', + suppressUnpairedNode: false +} +const parser = new XMLParser(opts) +const reportObj = parser.parse(reportXML) + /* * For compatibility with the dorny/test-reporter, * there needs to be 'time' attribute to '' tag */ -const normalizedContent = content - .replace(//gi, '') -writeFileSync(filePath, normalizedContent) +const testsuites = Array.isArray(reportObj.testsuites.testsuite) + ? reportObj.testsuites.testsuite + : [reportObj.testsuites.testsuite] +const totalTime = testsuites.reduce((accum, curr) => { + if (!curr?.attr_time) { + return accum + } + + const time = Number.parseFloat(curr.attr_time) + + return Number.isFinite(time) + ? accum + time + : accum +}, 0) +reportObj.testsuites.attr_time = totalTime + +const builder = new XMLBuilder(opts) +const outputXML = builder.build(reportObj) + +writeFileSync(filePath, outputXML) diff --git a/src/error-manager/index.js b/src/error-manager/index.js index 0aac7588..d11090db 100644 --- a/src/error-manager/index.js +++ b/src/error-manager/index.js @@ -4,10 +4,11 @@ const { app } = require('electron') const os = require('os') const i18next = require('i18next') -const { isENetError } = require( - '../../bfx-reports-framework/workers/loc.api/helpers/api-errors-testers' -) - +const { + errorTesters: { isDocumentsPathGettingError }, + shouldLogBeSkipped, + shouldErrorModalWinBeSuppressed +} = require('./log-exclusions') const cleanStack = require('./clean-stack') const log = require('./log') const getErrorDescription = require('./get-error-description') @@ -69,36 +70,6 @@ const _manageErrorLogLevel = async (error) => { } } -const _getErrorStr = (val) => { - if (!(val instanceof Error)) { - return val - } - - const str = typeof val.stack === 'string' - ? val.stack - : val.toString() - - return str -} - -const _isLogSkipped = (log) => { - const str = _getErrorStr(log) - - return ( - str && - typeof str === 'string' && - ( - str.includes('contextIsolation is deprecated') || - str.includes('ERR_INTERNET_DISCONNECTED') || - // Skip error when can't get code signature on mac - str.includes('Could not get code signature') || - str.includes('ERR_BFX_API_SERVER_IS_NOT_AVAILABLE') || - str.includes('database is locked') || - str.includes('network timeout') - ) - ) -} - const _lockIssueManager = () => { _isLocked = true @@ -193,7 +164,7 @@ const initLogger = () => { ) { return message } - if (message.data.some((val) => _isLogSkipped(val))) { + if (message.data.some((val) => shouldLogBeSkipped(val))) { return false } @@ -215,7 +186,7 @@ const initLogger = () => { if (message.level === 'error') { const error = message.data.join(os.EOL) - if (/Failed to get 'documents' path/gi.test(error)) { + if (isDocumentsPathGettingError(error)) { const title = i18next.t('errorManager.failedToGetDocsPath.title') const msg = i18next.t('errorManager.failedToGetDocsPath.message') @@ -235,22 +206,7 @@ const initLogger = () => { return } - - /* - * Don't open a new issue when: - * - It can't download differentially it would fallback to full download - * - GitHub server can't respond to the auto-update requests - */ - if ( - isENetError(error) || - /Cannot download differentially/gi.test(error) || - /objects\.githubusercontent\.com/gi.test(error) || - /Error: ERR_FAILED \(-2\) loading 'file:.*\.html'/gi.test(error) || - /Failed to generate PDF/gi.test(error) || - // https://github.com/electron/electron/issues/47390 - /DeprecationWarning: fs\.Stats/gi.test(error) || - /DeprecationWarning: `url\.parse\(\)`/gi.test(error) - ) { + if (shouldErrorModalWinBeSuppressed(error)) { return message } diff --git a/src/error-manager/log-exclusions/error-testers.js b/src/error-manager/log-exclusions/error-testers.js new file mode 100644 index 00000000..4646c835 --- /dev/null +++ b/src/error-manager/log-exclusions/error-testers.js @@ -0,0 +1,86 @@ +'use strict' + +const _getErrorString = (err) => { + if (typeof err === 'string') { + return err + } + if (err instanceof Error) { + return err.stack ?? err.toString() + } + + return '' +} + +const _testRegExp = (err, regExp) => ( + regExp.test(_getErrorString(err)) +) + +const isDocumentsPathGettingError = (err) => ( + _testRegExp(err, /Failed to get 'documents' path/i) +) + +const isContextIsolationError = (err) => ( + _testRegExp(err, /contextIsolation is deprecated/i) +) + +const isInetDisconnectionError = (err) => ( + _testRegExp(err, /ERR_INTERNET_DISCONNECTED/i) +) + +const isCodeSignatureError = (err) => ( + _testRegExp(err, /Could not get code signature/i) +) + +const isBfxApiServerAvailabilityError = (err) => ( + _testRegExp(err, /ERR_BFX_API_SERVER_IS_NOT_AVAILABLE/i) +) + +const isDatabaseLockError = (err) => ( + _testRegExp(err, /database is locked/i) +) + +const isNetworkTimeoutError = (err) => ( + _testRegExp(err, /network timeout/i) +) + +const isDiffUpdateDownloadError = (err) => ( + _testRegExp(err, /Cannot download differentially/i) +) + +const isGHUpdateDownloadError = (err) => ( + _testRegExp(err, /objects\.githubusercontent\.com/i) +) + +const isHtmlLoadingForPdfError = (err) => ( + _testRegExp(err, /Error: ERR_FAILED \(-2\) loading 'file:.*\.html'/i) +) + +const isPdfGenerationError = (err) => ( + _testRegExp(err, /Failed to generate PDF/i) +) + +// https://github.com/electron/electron/issues/47390 +const isDeprecationWarningFsStatsError = (err) => ( + _testRegExp(err, /DeprecationWarning: fs\.Stats/i) +) + +// https://github.com/electron/electron/issues/47390 +const isDeprecationWarningUrlParseError = (err) => ( + _testRegExp(err, /DeprecationWarning: `url\.parse\(\)`/i) +) + +module.exports = { + isDocumentsPathGettingError, + isContextIsolationError, + isInetDisconnectionError, + isCodeSignatureError, + isBfxApiServerAvailabilityError, + isDatabaseLockError, + isNetworkTimeoutError, + isDiffUpdateDownloadError, + isGHUpdateDownloadError, + isHtmlLoadingForPdfError, + isPdfGenerationError, + isDeprecationWarningFsStatsError, + isDeprecationWarningUrlParseError +} diff --git a/src/error-manager/log-exclusions/index.js b/src/error-manager/log-exclusions/index.js new file mode 100644 index 00000000..8bf88f8e --- /dev/null +++ b/src/error-manager/log-exclusions/index.js @@ -0,0 +1,48 @@ +'use strict' + +const errorTesters = require('./error-testers') +const { + isContextIsolationError, + isInetDisconnectionError, + isCodeSignatureError, + isBfxApiServerAvailabilityError, + isDatabaseLockError, + isNetworkTimeoutError, + isDiffUpdateDownloadError, + isGHUpdateDownloadError, + isHtmlLoadingForPdfError, + isPdfGenerationError, + isDeprecationWarningFsStatsError, + isDeprecationWarningUrlParseError +} = errorTesters + +const { isENetError } = require( + '../../../bfx-reports-framework/workers/loc.api/helpers/api-errors-testers' +) + +// If log is skipped, a new GH issue will be suppressed +const shouldLogBeSkipped = (err) => ( + isContextIsolationError(err) || + isInetDisconnectionError(err) || + isCodeSignatureError(err) || + isBfxApiServerAvailabilityError(err) || + isDatabaseLockError(err) || + isNetworkTimeoutError(err) +) + +// Don't open a new GH issue, but log anyway +const shouldErrorModalWinBeSuppressed = (err) => ( + isENetError(err) || + isDiffUpdateDownloadError(err) || + isGHUpdateDownloadError(err) || + isHtmlLoadingForPdfError(err) || + isPdfGenerationError(err) || + isDeprecationWarningFsStatsError(err) || + isDeprecationWarningUrlParseError(err) +) + +module.exports = { + errorTesters, + shouldLogBeSkipped, + shouldErrorModalWinBeSuppressed +} diff --git a/wdio.conf.js b/wdio.conf.js index f2a70bd1..1a2e53e8 100644 --- a/wdio.conf.js +++ b/wdio.conf.js @@ -19,6 +19,11 @@ const getAppBinaryPath = () => { } exports.config = { + // Use Xvfb when needed + // https://webdriver.io/docs/headless-and-xvfb/ + autoXvfb: true, + // Auto-install Xvfb packages + xvfbAutoInstall: true, // // ==================== // Runner Configuration @@ -127,7 +132,7 @@ exports.config = { baseUrl: '', // // Default timeout for all waitFor* commands. - waitforTimeout: 20_000, + waitforTimeout: 60_000, // // Default timeout in milliseconds for request // if browser driver or grid doesn't send response @@ -177,7 +182,7 @@ exports.config = { // See the full list at http://mochajs.org/ mochaOpts: { ui: 'bdd', - timeout: 60000 + timeout: 3 * 60_000 } //