Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: badeball/cypress-cucumber-preprocessor
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v20.0.4
Choose a base ref
...
head repository: badeball/cypress-cucumber-preprocessor
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v20.0.5
Choose a head ref
  • 5 commits
  • 3 files changed
  • 1 contributor

Commits on Apr 27, 2024

  1. Add a script for testing actions locally

    Using `act` [1].
    
    However, act uses network mode `host` by default [2]. Multiple Cypress
    instances will check for X and start it, concurrently and not in an
    atomic way, causing issues.
    
    Container options specified in workflows and using --container-options
    *aren't* merged [3].
    
    Furthermore, specifying a network  option that works both on GHA and
    locally appears to be a bit tricky [4].
    
    Thus, using `xvfb-run` to create a shared fb appears to be the easiest
    solution.
    
    However, `act` doesn't support env pass through, so we must parse
    `$DISPLAY` inside the xvfb environment in order to explicitly provide it
    to `act`.
    
    This would have all been unnecessary if `ELECTRON_RUN_AS_NODE` had even
    remotely worked [5].
    
    [1] https://nektosact.com/
    [2] nektos/act#1739
    [3] nektos/act#1696
    [4] nektos/act#1740
    [5] cypress-io/cypress-documentation#5666
    badeball committed Apr 27, 2024
    Copy the full SHA
    a135df3 View commit details

Commits on Apr 28, 2024

  1. Update* all dependencies, including @cucumber/messages

    * Nearly all, except some packages that have migrated to ESM and are
      more diffult to update, in addition to
    
      - eslint, for which typescript-eslint doesn't support yet [1[, and
      - prettier, for which the associated extension remains behind [2]
    
    This fixes #1180 [3].
    
    [1] typescript-eslint/typescript-eslint#8211
    [2] prettier/prettier-vscode#3142
    [3] #1180
    badeball committed Apr 28, 2024
    Copy the full SHA
    531839b View commit details
  2. Use @testing-library/dom to test HTML reports

    Recent changes to `@cucumber/react-components` [1] makes rendering
    async. This is a good opportunity to switch to a library providing query
    polling.
    
    [1] cucumber/react-components#337
    badeball committed Apr 28, 2024
    Copy the full SHA
    f4f161f View commit details
  3. Ensure clean install before publishing

    To avoid accidentally running tests against an invalid tree after EG.
    switching branch.
    badeball committed Apr 28, 2024
    Copy the full SHA
    9759458 View commit details
  4. v20.0.5

    badeball committed Apr 28, 2024
    Copy the full SHA
    0173e4f View commit details
Showing with 75 additions and 78 deletions.
  1. +4 −0 CHANGELOG.md
  2. +28 −38 features/step_definitions/html_steps.ts
  3. +43 −40 package.json
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

## v20.0.5

- Updated all dependencies, fixes [#1180](https://github.com/badeball/cypress-cucumber-preprocessor/issues/1180).

## v20.0.4

- Fix type signature of `defineParameterType` to correctly reflect `transformer` property's optionality, fixes [#1179](https://github.com/badeball/cypress-cucumber-preprocessor/issues/1179).
66 changes: 28 additions & 38 deletions features/step_definitions/html_steps.ts
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import { JSDOM } from "jsdom";
import path from "path";
import { promises as fs } from "fs";
import assert from "assert";
import { assertAndReturn } from "../support/helpers";
import { findByText } from "@testing-library/dom";
import ICustomWorld from "../support/ICustomWorld";

Then("there should be a HTML report", async function (this: ICustomWorld) {
@@ -21,24 +21,19 @@ Then(
{ runScripts: "dangerously" }
);

const dt = assertAndReturn(
Array.from(dom.window.document.querySelectorAll("dt")).find(
(el) => el.textContent === "last run"
),
"Expected to find a 'last run' dt"
const dt = await findByText(
dom.window.document.documentElement,
"last run",
{
selector: "dt",
}
);

const dd = assertAndReturn(
dt.parentElement?.querySelector("dd"),
"Expected to find a 'last run' dt's dd"
);

const lastRunText = assertAndReturn(
dd.textContent,
"Expected to find 'XX seconds ago'"
);
const dd = await findByText(dt.parentElement!, /\d+ seconds? ago/, {
selector: "dd",
});

assert.match(lastRunText, /\d+ seconds? ago/);
assert(dd);
}
);

@@ -50,11 +45,12 @@ Then(
{ runScripts: "dangerously" }
);

const dt = assertAndReturn(
Array.from(dom.window.document.querySelectorAll("dt")).find(
(el) => el.textContent && /\d+ executed/.test(el.textContent)
),
"Expected to find a 'XX executed' dt"
const dt = await findByText(
dom.window.document.documentElement,
/\d+ executed/,
{
selector: "dt",
}
);

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -72,11 +68,12 @@ Then(
{ runScripts: "dangerously" }
);

const dd = assertAndReturn(
Array.from(dom.window.document.querySelectorAll("dd")).find(
(el) => el.textContent && /\d+% passed/.test(el.textContent)
),
"Expected to find a 'XX% passed' dd"
const dd = await findByText(
dom.window.document.documentElement,
/\d+% passed/,
{
selector: "dd",
}
);

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -94,19 +91,12 @@ Then(
{ runScripts: "dangerously" }
);

const AccordionItemPanel = assertAndReturn(
dom.window.document.querySelector(
'[data-accordion-component="AccordionItemPanel"]'
),
"Expected to find an AccordionItemPanel"
const AccordionItemPanel = await findByText(
dom.window.document.documentElement,
(_, element) => element?.textContent?.includes("Attached Image") ?? false,
{ selector: '[data-accordion-component="AccordionItemPanel"]' }
);

assert.match(
assertAndReturn(
AccordionItemPanel.textContent,
"Expected AccordionItemPanel to have textContent"
),
/Attached Image/
);
assert(AccordionItemPanel);
}
);
83 changes: 43 additions & 40 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@badeball/cypress-cucumber-preprocessor",
"version": "20.0.4",
"version": "20.0.5",
"author": "Jonas Amundsen",
"license": "MIT",
"homepage": "https://github.com/badeball/cypress-cucumber-preprocessor",
@@ -41,7 +41,8 @@
"dist/**/*.d.ts"
],
"scripts": {
"clean": "rm -rf dist",
"clear-dist": "rm -rf dist",
"clean-install": "rm -rf node_modules && npm install",
"genversion": "genversion --semi --double --es6 lib/version.ts",
"build": "npm run genversion && tsc",
"watch": "npm run genversion && tsc --watch",
@@ -53,71 +54,73 @@
"test:unit": "mocha",
"test:run-all-specs": "mocha --timeout 0 test/run-all-specs.ts",
"test:integration": "cucumber-js",
"prepublishOnly": "npm run clean && npm run build && npm run test"
"test:actions:examples": "xvfb-run bash -c 'act -W \".github/workflows/examples-branch.yml\" --use-gitignore=false --artifact-server-path=tmp/artifacts --env DISPLAY=$DISPLAY'",
"prepublishOnly": "npm run clean-install && npm run clear-dist && npm run build && npm run test"
},
"dependencies": {
"@badeball/cypress-configuration": "^6.1.0",
"@cucumber/ci-environment": "^10.0.0",
"@cucumber/cucumber": "^10.0.0",
"@cucumber/cucumber-expressions": "^17.0.0",
"@cucumber/gherkin": "^27.0.0",
"@cucumber/html-formatter": "^20.4.0",
"@badeball/cypress-configuration": "^6.1.1",
"@cucumber/ci-environment": "^10.0.1",
"@cucumber/cucumber": "^10.6.0",
"@cucumber/cucumber-expressions": "^17.1.0",
"@cucumber/gherkin": "^28.0.0",
"@cucumber/html-formatter": "^21.3.1",
"@cucumber/message-streams": "^4.0.1",
"@cucumber/messages": "^22.0.0",
"@cucumber/pretty-formatter": "^1.0.0",
"@cucumber/tag-expressions": "^6.0.0",
"@cucumber/messages": "^24.1.0",
"@cucumber/pretty-formatter": "^1.0.1",
"@cucumber/tag-expressions": "^6.1.0",
"base64-js": "^1.5.1",
"chalk": "^4.1.2",
"cli-table": "^0.3.11",
"common-ancestor-path": "^1.0.1",
"cosmiconfig": "^8.3.6",
"cosmiconfig": "^9.0.0",
"debug": "^4.3.4",
"error-stack-parser": "^2.1.4",
"esbuild": "^0.19.4",
"glob": "^10.3.10",
"esbuild": "^0.20.2",
"glob": "^10.3.12",
"is-path-inside": "^3.0.3",
"mocha": "^10.2.0",
"mocha": "^10.4.0",
"seedrandom": "^3.0.5",
"source-map": "^0.7.4",
"split": "^1.0.1",
"uuid": "^9.0.1"
},
"devDependencies": {
"@babel/parser": "^7.23.0",
"@babel/types": "^7.23.0",
"@babel/parser": "^7.24.4",
"@babel/types": "^7.24.0",
"@bahmutov/cypress-esbuild-preprocessor": "^2.2.0",
"@cypress/browserify-preprocessor": "^3.0.2",
"@cypress/webpack-preprocessor": "^6.0.0",
"@types/cli-table": "^0.3.2",
"@types/common-ancestor-path": "^1.0.0",
"@types/debug": "^4.1.9",
"@cypress/webpack-preprocessor": "^6.0.1",
"@testing-library/dom": "^10.0.0",
"@types/cli-table": "^0.3.4",
"@types/common-ancestor-path": "^1.0.2",
"@types/debug": "^4.1.12",
"@types/glob": "^8.1.0",
"@types/jsdom": "^21.1.3",
"@types/mocha": "^10.0.2",
"@types/pngjs": "^6.0.2",
"@types/jsdom": "^21.1.6",
"@types/mocha": "^10.0.6",
"@types/pngjs": "^6.0.4",
"@types/prettier": "^2.7.3",
"@types/seedrandom": "^3.0.6",
"@types/split": "^1.0.3",
"@types/stream-buffers": "^3.0.5",
"@typescript-eslint/eslint-plugin": "^6.7.5",
"@typescript-eslint/parser": "^6.7.5",
"@types/seedrandom": "^3.0.8",
"@types/split": "^1.0.5",
"@types/stream-buffers": "^3.0.7",
"@typescript-eslint/eslint-plugin": "^7.7.1",
"@typescript-eslint/parser": "^7.7.1",
"ast-types": "^0.15.2",
"cypress": "^13.3.1",
"cypress": "^13.8.1",
"eslint": "^8.51.0",
"genversion": "^3.1.1",
"jsdom": "^22.1.0",
"genversion": "^3.2.0",
"jsdom": "^24.0.0",
"pngjs": "^7.0.0",
"prettier": "^2.8.8",
"recast": "^0.23.4",
"rollup": "^4.1.0",
"recast": "^0.23.6",
"rollup": "^4.16.4",
"stream-buffers": "^3.0.2",
"strip-ansi": "^6.0.1",
"strip-indent": "^3.0.0",
"ts-loader": "^9.5.0",
"ts-node": "^10.9.1",
"tsd": "^0.29.0",
"typescript": "^5.2.2",
"webpack": "^5.89.0"
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"tsd": "^0.31.0",
"typescript": "^5.4.5",
"webpack": "^5.91.0"
},
"peerDependencies": {
"@cypress/browserify-preprocessor": "^3.0.1",