diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 2d53d29..6a9dd89 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -4,6 +4,10 @@ on: release: types: [published] +permissions: + id-token: write + contents: read + jobs: publish-npm: runs-on: ubuntu-latest @@ -11,10 +15,8 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: 22 + node-version: 24 registry-url: https://registry.npmjs.org/ - run: npm ci - run: npm run build - - run: npm publish --access public - env: - NODE_AUTH_TOKEN: ${{secrets.npm_token}} \ No newline at end of file + - run: npm publish --access public \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 88a5294..fc87a81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,18 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how :microscope: - experimental +## [2.4.0] +- added step to copy response +```Gherkin +When I send 'GET' request to "https://jsonplaceholder.typicode.com/todos/1" and save response as 'response' +And I copy '$response' response as 'copiedResponse' +And I parse '$response' body as json +And I parse '$copiedResponse' body as text +``` + +Breaking Change +- all entries of `Body` replaced with lowercase `body` + ## [2.3.0] - :rocket: added capability to print curl for debugging @@ -28,7 +40,7 @@ where `soap` is function in memory import { XMLParser } from 'fast-xml-parser'; const xml = new XMLParser(); class Data { - soap = async (response) => { + soap = async response => { const text = await response.text(); return xml.parse(text); } @@ -49,54 +61,54 @@ class Data { Breaking change: moved _@qavajs/validation_ to peer dependencies After update please install latest version of @qavajs/validation package -## 0.18.1 +## [0.18.1] - fixed header assign order -## 0.18.0 +## [0.18.0] - added support of GraphQL along with specific steps: - _I create GraphQL request {string}_ - _I add {gqlRequestProperty} to GraphQL {string}:_ -## 0.17.0 +## [0.17.0] - added experimental support of websockets (API may change in future) Breaking Change - migrated to native fetch - dropped support of node16 -## 0.16.0 +## [0.16.0] - removed chai from dependencies - fixed issue with attaching non string responses -## 0.15.0 +## [0.15.0] - added request/response logging - fixed issue with optional contentType and filename in form data step -## 0.0.14 +## [0.0.14] - added undefined payload handler - added _I add form data body_ step - added match schema validation -## 0.0.13 +## [0.0.13] - added construction api steps -## 0.0.12 +## [0.0.12] - added logs to validation steps - removed hook -## 0.0.11 +## [0.0.11] - added step for parsing response body with needed type -## 0.0.10 +## [0.0.10] - removed headers parameter type. Moved logic step signature -## 0.0.9 +## [0.0.9] - removed JSON stringify from body send -## 0.0.7 +## [0.0.7] - fixed step definition for sending requests with requestBody as DOC Cucumber String - added step definition to verify response status message - added e2e test -## 0.0.6 +## [0.0.6] - :beetle: fixed issue with api service import diff --git a/package-lock.json b/package-lock.json index 4c743ae..9c13af9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@qavajs/steps-api", - "version": "2.3.0", + "version": "2.4.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@qavajs/steps-api", - "version": "2.3.0", + "version": "2.4.0", "license": "MIT", "dependencies": { "ws": "^8.18.3" @@ -17,15 +17,15 @@ "@qavajs/core": "^2.10.0", "@qavajs/html-formatter": "^1.0.0", "@qavajs/memory": "^1.10.3", - "@types/express": "^5.0.3", - "@types/node": "^24.8.1", + "@types/express": "^5.0.4", + "@types/node": "^24.9.1", "@types/ws": "^8.18.1", "body-parser": "^2.2.0", "express": "^5.1.0", "prettier": "^3.6.2", "ts-node": "^10.9.2", "typescript": "^5.9.3", - "vitest": "^3.2.4" + "vitest": "^4.0.3" } }, "node_modules/@babel/code-frame": { @@ -1352,6 +1352,13 @@ "win32" ] }, + "node_modules/@standard-schema/spec": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.0.0.tgz", + "integrity": "sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA==", + "dev": true, + "license": "MIT" + }, "node_modules/@swc/core": { "version": "1.13.3", "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.13.3.tgz", @@ -1644,13 +1651,14 @@ } }, "node_modules/@types/chai": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.2.tgz", - "integrity": "sha512-8kB30R7Hwqf40JPiKhVzodJs2Qc1ZJ5zuT3uzw5Hq/dhNCl3G3l83jfpdI1e20BP348+fV7VIL/+FxaXkqBmWg==", + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", + "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", "dev": true, "license": "MIT", "dependencies": { - "@types/deep-eql": "*" + "@types/deep-eql": "*", + "assertion-error": "^2.0.1" } }, "node_modules/@types/connect": { @@ -1678,9 +1686,9 @@ "license": "MIT" }, "node_modules/@types/express": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/@types/express/-/express-5.0.3.tgz", - "integrity": "sha512-wGA0NX93b19/dZC1J18tKWVIYWyyF2ZjT9vin/NRu0qzzvfVzWjs04iq2rQ3H65vCTQYlRqs3YHfY7zjdV+9Kw==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@types/express/-/express-5.0.4.tgz", + "integrity": "sha512-g64dbryHk7loCIrsa0R3shBnEu5p6LPJ09bu9NG58+jz+cRUjFrc3Bz0kNQ7j9bXeCsrRDvNET1G54P/GJkAyA==", "dev": true, "license": "MIT", "dependencies": { @@ -1717,13 +1725,13 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "24.8.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.8.1.tgz", - "integrity": "sha512-alv65KGRadQVfVcG69MuB4IzdYVpRwMG/mq8KWOaoOdyY617P5ivaDiMCGOFDWD2sAn5Q0mR3mRtUOgm99hL9Q==", + "version": "24.9.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.9.1.tgz", + "integrity": "sha512-QoiaXANRkSXK6p0Duvt56W208du4P9Uye9hWLWgGMDTEoKPhuenzNcC4vGUmrNkiOKTlIrBoyNQYNpSwfEZXSg==", "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~7.14.0" + "undici-types": "~7.16.0" } }, "node_modules/@types/normalize-package-data": { @@ -1788,103 +1796,40 @@ } }, "node_modules/@vitest/expect": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-3.2.4.tgz", - "integrity": "sha512-Io0yyORnB6sikFlt8QW5K7slY4OjqNX9jmJQ02QDda8lyM6B5oNgVWoSoKPac8/kgnCUzuHQKrSLtu/uOqqrig==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.0.3.tgz", + "integrity": "sha512-v3eSDx/bF25pzar6aEJrrdTXJduEBU3uSGXHslIdGIpJVP8tQQHV6x1ZfzbFQ/bLIomLSbR/2ZCfnaEGkWkiVQ==", "dev": true, "license": "MIT", "dependencies": { + "@standard-schema/spec": "^1.0.0", "@types/chai": "^5.2.2", - "@vitest/spy": "3.2.4", - "@vitest/utils": "3.2.4", - "chai": "^5.2.0", - "tinyrainbow": "^2.0.0" + "@vitest/spy": "4.0.3", + "@vitest/utils": "4.0.3", + "chai": "^6.0.1", + "tinyrainbow": "^3.0.3" }, "funding": { "url": "https://opencollective.com/vitest" } }, - "node_modules/@vitest/expect/node_modules/assertion-error": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", - "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - } - }, - "node_modules/@vitest/expect/node_modules/chai": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/chai/-/chai-5.3.3.tgz", - "integrity": "sha512-4zNhdJD/iOjSH0A05ea+Ke6MU5mmpQcbQsSOkgdaUMJ9zTlDTD/GYlwohmIE2u0gaxHYiVHEn1Fw9mZ/ktJWgw==", - "dev": true, - "license": "MIT", - "dependencies": { - "assertion-error": "^2.0.1", - "check-error": "^2.1.1", - "deep-eql": "^5.0.1", - "loupe": "^3.1.0", - "pathval": "^2.0.0" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/@vitest/expect/node_modules/check-error": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.1.tgz", - "integrity": "sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 16" - } - }, - "node_modules/@vitest/expect/node_modules/deep-eql": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz", - "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/@vitest/expect/node_modules/loupe": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.2.1.tgz", - "integrity": "sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/@vitest/expect/node_modules/pathval": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.1.tgz", - "integrity": "sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 14.16" - } - }, "node_modules/@vitest/mocker": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-3.2.4.tgz", - "integrity": "sha512-46ryTE9RZO/rfDd7pEqFl7etuyzekzEhUbTW3BvmeO/BcCMEgq59BKhek3dXDWgAj4oMK6OZi+vRr1wPW6qjEQ==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.0.3.tgz", + "integrity": "sha512-evZcRspIPbbiJEe748zI2BRu94ThCBE+RkjCpVF8yoVYuTV7hMe+4wLF/7K86r8GwJHSmAPnPbZhpXWWrg1qbA==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/spy": "3.2.4", + "@vitest/spy": "4.0.3", "estree-walker": "^3.0.3", - "magic-string": "^0.30.17" + "magic-string": "^0.30.19" }, "funding": { "url": "https://opencollective.com/vitest" }, "peerDependencies": { "msw": "^2.4.9", - "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0" + "vite": "^6.0.0 || ^7.0.0-0" }, "peerDependenciesMeta": { "msw": { @@ -1896,42 +1841,41 @@ } }, "node_modules/@vitest/pretty-format": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-3.2.4.tgz", - "integrity": "sha512-IVNZik8IVRJRTr9fxlitMKeJeXFFFN0JaB9PHPGQ8NKQbGpfjlTx9zO4RefN8gp7eqjNy8nyK3NZmBzOPeIxtA==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.0.3.tgz", + "integrity": "sha512-N7gly/DRXzxa9w9sbDXwD9QNFYP2hw90LLLGDobPNwiWgyW95GMxsCt29/COIKKh3P7XJICR38PSDePenMBtsw==", "dev": true, "license": "MIT", "dependencies": { - "tinyrainbow": "^2.0.0" + "tinyrainbow": "^3.0.3" }, "funding": { "url": "https://opencollective.com/vitest" } }, "node_modules/@vitest/runner": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-3.2.4.tgz", - "integrity": "sha512-oukfKT9Mk41LreEW09vt45f8wx7DordoWUZMYdY/cyAk7w5TWkTRCNZYF7sX7n2wB7jyGAl74OxgwhPgKaqDMQ==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.0.3.tgz", + "integrity": "sha512-1/aK6fPM0lYXWyGKwop2Gbvz1plyTps/HDbIIJXYtJtspHjpXIeB3If07eWpVH4HW7Rmd3Rl+IS/+zEAXrRtXA==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/utils": "3.2.4", - "pathe": "^2.0.3", - "strip-literal": "^3.0.0" + "@vitest/utils": "4.0.3", + "pathe": "^2.0.3" }, "funding": { "url": "https://opencollective.com/vitest" } }, "node_modules/@vitest/snapshot": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-3.2.4.tgz", - "integrity": "sha512-dEYtS7qQP2CjU27QBC5oUOxLE/v5eLkGqPE0ZKEIDGMs4vKWe7IjgLOeauHsR0D5YuuycGRO5oSRXnwnmA78fQ==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.0.3.tgz", + "integrity": "sha512-amnYmvZ5MTjNCP1HZmdeczAPLRD6iOm9+2nMRUGxbe/6sQ0Ymur0NnR9LIrWS8JA3wKE71X25D6ya/3LN9YytA==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "3.2.4", - "magic-string": "^0.30.17", + "@vitest/pretty-format": "4.0.3", + "magic-string": "^0.30.19", "pathe": "^2.0.3" }, "funding": { @@ -1939,40 +1883,29 @@ } }, "node_modules/@vitest/spy": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-3.2.4.tgz", - "integrity": "sha512-vAfasCOe6AIK70iP5UD11Ac4siNUNJ9i/9PZ3NKx07sG6sUxeag1LWdNrMWeKKYBLlzuK+Gn65Yd5nyL6ds+nw==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.0.3.tgz", + "integrity": "sha512-82vVL8Cqz7rbXaNUl35V2G7xeNMAjBdNOVaHbrzznT9BmiCiPOzhf0FhU3eP41nP1bLDm/5wWKZqkG4nyU95DQ==", "dev": true, "license": "MIT", - "dependencies": { - "tinyspy": "^4.0.3" - }, "funding": { "url": "https://opencollective.com/vitest" } }, "node_modules/@vitest/utils": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-3.2.4.tgz", - "integrity": "sha512-fB2V0JFrQSMsCo9HiSq3Ezpdv4iYaXRG1Sx8edX3MwxfyNn83mKiGzOcH+Fkxt4MHxr3y42fQi1oeAInqgX2QA==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.0.3.tgz", + "integrity": "sha512-qV6KJkq8W3piW6MDIbGOmn1xhvcW4DuA07alqaQ+vdx7YA49J85pnwnxigZVQFQw3tWnQNRKWwhz5wbP6iv/GQ==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "3.2.4", - "loupe": "^3.1.4", - "tinyrainbow": "^2.0.0" + "@vitest/pretty-format": "4.0.3", + "tinyrainbow": "^3.0.3" }, "funding": { "url": "https://opencollective.com/vitest" } }, - "node_modules/@vitest/utils/node_modules/loupe": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.2.1.tgz", - "integrity": "sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ==", - "dev": true, - "license": "MIT" - }, "node_modules/accepts": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", @@ -2070,6 +2003,16 @@ "dev": true, "license": "MIT" }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, "node_modules/assertion-error-formatter": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/assertion-error-formatter/-/assertion-error-formatter-3.0.0.tgz", @@ -2120,16 +2063,6 @@ "node": ">= 0.8" } }, - "node_modules/cac": { - "version": "6.7.14", - "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", - "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/call-bind-apply-helpers": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", @@ -2173,6 +2106,16 @@ "upper-case-first": "^2.0.2" } }, + "node_modules/chai": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-6.2.0.tgz", + "integrity": "sha512-aUTnJc/JipRzJrNADXVvpVqi6CO0dn3nx4EVPxijri+fj3LUUDyZQOgVeW54Ob3Y1Xh9Iz8f+CgaCl8v0mn9bA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -2591,9 +2534,9 @@ } }, "node_modules/expect-type": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.2.1.tgz", - "integrity": "sha512-/kP8CAwxzLVEeFrMm4kMmy4CCDlpipyA7MYLVrdJIkV0fYF0UaigQHRsxHiuY/GEea+bh4KSv3TIlgr+2UL6bw==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.2.2.tgz", + "integrity": "sha512-JhFGDVJ7tmDJItKhYgJCGLOWjuK9vPxiXoUFLwLDc99NlmklilbiQJwoctZtt13+xMw91MCk/REan6MWHqDjyA==", "dev": true, "license": "Apache-2.0", "engines": { @@ -3191,9 +3134,9 @@ } }, "node_modules/magic-string": { - "version": "0.30.19", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.19.tgz", - "integrity": "sha512-2N21sPY9Ws53PZvsEpVtNuSW+ScYbQdp4b9qUaL+9QkHUrGFKo56Lg9Emg5s9V/qrtNBmiR01sYhUOwu3H+VOw==", + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", "dev": true, "license": "MIT", "dependencies": { @@ -4232,26 +4175,6 @@ "node": ">=8" } }, - "node_modules/strip-literal": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-3.1.0.tgz", - "integrity": "sha512-8r3mkIM/2+PpjHoOtiAW8Rg3jJLHaV7xPwG+YRGrv6FP0wwk/toTpATxWYOW0BKdWwl82VT2tFYi5DlROa0Mxg==", - "dev": true, - "license": "MIT", - "dependencies": { - "js-tokens": "^9.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - } - }, - "node_modules/strip-literal/node_modules/js-tokens": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-9.0.1.tgz", - "integrity": "sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==", - "dev": true, - "license": "MIT" - }, "node_modules/supports-color": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", @@ -4329,30 +4252,10 @@ "url": "https://github.com/sponsors/SuperchupuDev" } }, - "node_modules/tinypool": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-1.1.1.tgz", - "integrity": "sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^18.0.0 || >=20.0.0" - } - }, "node_modules/tinyrainbow": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-2.0.0.tgz", - "integrity": "sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/tinyspy": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-4.0.4.tgz", - "integrity": "sha512-azl+t0z7pw/z958Gy9svOTuzqIk6xq+NSheJzn5MMWtWTFywIacg2wUlzKFGtt3cthx0r2SxMK0yzJOR0IES7Q==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.0.3.tgz", + "integrity": "sha512-PSkbLUoxOFRzJYjjxHJt9xro7D+iilgMX/C9lawzVuYiIdcihh9DXmVibBe8lmcFrRi/VzlPjBxbN7rH24q8/Q==", "dev": true, "license": "MIT", "engines": { @@ -4480,9 +4383,9 @@ } }, "node_modules/undici-types": { - "version": "7.14.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.14.0.tgz", - "integrity": "sha512-QQiYxHuyZ9gQUIrmPo3IA+hUl4KYk8uSA7cHrcKd/l3p1OTpZcM0Tbp9x7FAtXdAYhlasd60ncPpgu6ihG6TOA==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", "dev": true, "license": "MIT" }, @@ -4569,9 +4472,9 @@ } }, "node_modules/vite": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.0.tgz", - "integrity": "sha512-oLnWs9Hak/LOlKjeSpOwD6JMks8BeICEdYMJBf6P4Lac/pO9tKiv/XhXnAM7nNfSkZahjlCZu9sS50zL8fSnsw==", + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.1.tgz", + "integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==", "dev": true, "license": "MIT", "dependencies": { @@ -4643,65 +4546,39 @@ } } }, - "node_modules/vite-node": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-3.2.4.tgz", - "integrity": "sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==", - "dev": true, - "license": "MIT", - "dependencies": { - "cac": "^6.7.14", - "debug": "^4.4.1", - "es-module-lexer": "^1.7.0", - "pathe": "^2.0.3", - "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0" - }, - "bin": { - "vite-node": "vite-node.mjs" - }, - "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, "node_modules/vitest": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-3.2.4.tgz", - "integrity": "sha512-LUCP5ev3GURDysTWiP47wRRUpLKMOfPh+yKTx3kVIEiu5KOMeqzpnYNsKyOoVrULivR8tLcks4+lga33Whn90A==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.0.3.tgz", + "integrity": "sha512-IUSop8jgaT7w0g1yOM/35qVtKjr/8Va4PrjzH1OUb0YH4c3OXB2lCZDkMAB6glA8T5w8S164oJGsbcmAecr4sA==", "dev": true, "license": "MIT", "dependencies": { - "@types/chai": "^5.2.2", - "@vitest/expect": "3.2.4", - "@vitest/mocker": "3.2.4", - "@vitest/pretty-format": "^3.2.4", - "@vitest/runner": "3.2.4", - "@vitest/snapshot": "3.2.4", - "@vitest/spy": "3.2.4", - "@vitest/utils": "3.2.4", - "chai": "^5.2.0", - "debug": "^4.4.1", - "expect-type": "^1.2.1", - "magic-string": "^0.30.17", + "@vitest/expect": "4.0.3", + "@vitest/mocker": "4.0.3", + "@vitest/pretty-format": "4.0.3", + "@vitest/runner": "4.0.3", + "@vitest/snapshot": "4.0.3", + "@vitest/spy": "4.0.3", + "@vitest/utils": "4.0.3", + "debug": "^4.4.3", + "es-module-lexer": "^1.7.0", + "expect-type": "^1.2.2", + "magic-string": "^0.30.19", "pathe": "^2.0.3", - "picomatch": "^4.0.2", + "picomatch": "^4.0.3", "std-env": "^3.9.0", "tinybench": "^2.9.0", "tinyexec": "^0.3.2", - "tinyglobby": "^0.2.14", - "tinypool": "^1.1.1", - "tinyrainbow": "^2.0.0", - "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0", - "vite-node": "3.2.4", + "tinyglobby": "^0.2.15", + "tinyrainbow": "^3.0.3", + "vite": "^6.0.0 || ^7.0.0", "why-is-node-running": "^2.3.0" }, "bin": { "vitest": "vitest.mjs" }, "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + "node": "^20.0.0 || ^22.0.0 || >=24.0.0" }, "funding": { "url": "https://opencollective.com/vitest" @@ -4709,9 +4586,11 @@ "peerDependencies": { "@edge-runtime/vm": "*", "@types/debug": "^4.1.12", - "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", - "@vitest/browser": "3.2.4", - "@vitest/ui": "3.2.4", + "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0", + "@vitest/browser-playwright": "4.0.3", + "@vitest/browser-preview": "4.0.3", + "@vitest/browser-webdriverio": "4.0.3", + "@vitest/ui": "4.0.3", "happy-dom": "*", "jsdom": "*" }, @@ -4725,7 +4604,13 @@ "@types/node": { "optional": true }, - "@vitest/browser": { + "@vitest/browser-playwright": { + "optional": true + }, + "@vitest/browser-preview": { + "optional": true + }, + "@vitest/browser-webdriverio": { "optional": true }, "@vitest/ui": { @@ -4739,70 +4624,6 @@ } } }, - "node_modules/vitest/node_modules/assertion-error": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", - "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - } - }, - "node_modules/vitest/node_modules/chai": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/chai/-/chai-5.2.0.tgz", - "integrity": "sha512-mCuXncKXk5iCLhfhwTc0izo0gtEmpz5CtG2y8GiOINBlMVS6v8TMRc5TaLWKS6692m9+dVVfzgeVxR5UxWHTYw==", - "dev": true, - "license": "MIT", - "dependencies": { - "assertion-error": "^2.0.1", - "check-error": "^2.1.1", - "deep-eql": "^5.0.1", - "loupe": "^3.1.0", - "pathval": "^2.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/vitest/node_modules/check-error": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.1.tgz", - "integrity": "sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 16" - } - }, - "node_modules/vitest/node_modules/deep-eql": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz", - "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/vitest/node_modules/loupe": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.1.3.tgz", - "integrity": "sha512-kkIp7XSkP78ZxJEsSxW3712C6teJVoeHHwgo9zJ380de7IYyJ2ISlxojcH2pC5OFLewESmnRi/+XCDIEEVyoug==", - "dev": true, - "license": "MIT" - }, - "node_modules/vitest/node_modules/pathval": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.0.tgz", - "integrity": "sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 14.16" - } - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index b7df33b..da1dd2c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@qavajs/steps-api", - "version": "2.3.0", + "version": "2.4.0", "description": "api steps for @qavajs project", "main": "./index.js", "scripts": { @@ -16,8 +16,29 @@ "url": "git+https://github.com/qavajs/steps-api.git" }, "keywords": [ - "QA", - "Test Automation" + "test", + "automation", + "testing", + "qa", + "quality-assurance", + "test-framework", + "test-runner", + "test-automation", + "e2e", + "end-to-end", + "ui-testing", + "api-testing", + "integration-testing", + "acceptance-testing", + "functional-testing", + "browser-testing", + "mobile-testing", + "cross-browser", + "bdd", + "gherkin", + "assertions", + "continuous-delivery", + "automation-framework" ], "authors": [ "Alexandr Galichenko", @@ -36,15 +57,15 @@ "@qavajs/memory": "^1.10.3", "@qavajs/console-formatter": "^1.1.1", "@qavajs/html-formatter": "^1.0.0", - "@types/express": "^5.0.3", - "@types/node": "^24.8.1", + "@types/express": "^5.0.4", + "@types/node": "^24.9.1", "@types/ws": "^8.18.1", "body-parser": "^2.2.0", "express": "^5.1.0", "prettier": "^3.6.2", "ts-node": "^10.9.2", "typescript": "^5.9.3", - "vitest": "^3.2.4" + "vitest": "^4.0.3" }, "dependencies": { "ws": "^8.18.3" diff --git a/src/apiActionSteps.ts b/src/apiActionSteps.ts index 87839ca..dac9d9f 100644 --- a/src/apiActionSteps.ts +++ b/src/apiActionSteps.ts @@ -1,6 +1,5 @@ -import { When } from '@cucumber/cucumber'; import { logPayload, sendHttpRequest } from './utils'; -import { MemoryValue } from '@qavajs/core'; +import { type MemoryValue, When } from '@qavajs/core'; /** * Send request to the API @@ -88,10 +87,10 @@ When( ); /** - * Send request to the API with Body + * Send request to the API with body * * @example - * I send "POST" request to "$BASE_API_URL" with Body "$textFile('test_data_file.json')" and save response as "response" + * I send "POST" request to "$BASE_API_URL" with body "$textFile('test_data_file.json')" and save response as "response" * * @param method should be named as one of the http methods (e.g. GET, POST, PUT, DELETE, etc.) * @param url should be API endpoint @@ -100,7 +99,7 @@ When( * @param key key of the remembered value */ When( - 'I send {string} request to {value} with Body {value} and save response as {value}', + 'I send {string} request to {value} with body {value} and save response as {value}', async function (method: string, url: MemoryValue, body: MemoryValue, key: MemoryValue) { const conf: RequestInit = { method, @@ -112,10 +111,10 @@ When( ); /** - * Send request to the API with Body + * Send request to the API with body * * @example - * I send "POST" request to "$BASE_API_URL" with headers "$json('headers.json')" with Body "$textFile('test_data_file.json')" and save response as "response" + * I send "POST" request to "$BASE_API_URL" with headers "$json('headers.json')" with body "$textFile('test_data_file.json')" and save response as "response" * * @param method should be named as one of the http methods (e.g. GET, POST, PUT, DELETE, etc.) * @param url should be API endpoint @@ -124,7 +123,7 @@ When( * @param key key of the remembered value */ When( - 'I send {string} request to {value} with headers {value} with Body {value} and save response as {value}', + 'I send {string} request to {value} with headers {value} with body {value} and save response as {value}', async function (method: string, url: MemoryValue, headers: MemoryValue, body: MemoryValue, key: MemoryValue) { const conf: RequestInit = { method, @@ -137,10 +136,10 @@ When( ); /** - * Send request to the API with Body and additional param in the request URI + * Send request to the API with body and additional param in the request URI * * @example - * I send "PUT" request to "https://www.some_service.com/some_endpoint/" with qs "?category=HR&name=test" and Body "test_data_file.json" and save response as "response" + * I send "PUT" request to "https://www.some_service.com/some_endpoint/" with qs "?category=HR&name=test" and body "test_data_file.json" and save response as "response" * * @param method should be named as one of the http methods (e.g. POST, PUT, PATCH, etc.) * @param url should be API endpoint @@ -150,7 +149,7 @@ When( * @param key key of the remembered value */ When( - 'I send {string} request to {string} with qs {string} and Body {string} and save response as {string}', + 'I send {string} request to {string} with qs {string} and body {string} and save response as {string}', async function (method: string, url: MemoryValue, params: MemoryValue, body: MemoryValue, key: MemoryValue) { const requestUrl = (await url.value()) + (await params.value()); const conf: RequestInit = { @@ -163,10 +162,10 @@ When( ); /** - * Send request to the API with Body and additional param in the request URI + * Send request to the API with body and additional param in the request URI * * @example - * I send "PUT" request to "https://www.some_service.com/some_endpoint/" with qs "?category=HR&name=test" and Body "test_data_file.json" and save response as "response" + * I send "PUT" request to "https://www.some_service.com/some_endpoint/" with qs "?category=HR&name=test" and body "test_data_file.json" and save response as "response" * * @param method should be named as one of the http methods (e.g. POST, PUT, PATCH, etc.) * @param url should be API endpoint @@ -176,7 +175,7 @@ When( * @param key key of the remembered value */ When( - 'I send {string} request to {string} with headers {string} with qs {string} and Body {string} and save response as {string}', + 'I send {string} request to {string} with headers {string} with qs {string} and body {string} and save response as {string}', async function (method: string, url: MemoryValue, headers: MemoryValue, params: MemoryValue, body: MemoryValue, key: MemoryValue) { const requestUrl = (await url.value()) + (await params.value()); const conf: RequestInit = { @@ -190,13 +189,13 @@ When( ); /** - * Send request to the API with Body passed as Cucumber Doc String + * Send request to the API with body passed as Cucumber Doc String * * @example - * I send "POST" request and save response as "response" to "$BASE_API_URL" with Body: + * I send "POST" request and save response as "response" to "$BASE_API_URL" with body: * """ * { - * "title": "Test Post Request with Body passed as string" + * "title": "Test Post Request with body passed as string" * } * """ * @@ -207,7 +206,7 @@ When( * @param key key of the remembered value */ When( - 'I send {string} request and save response as {value} to {value} with Body:', + 'I send {string} request and save response as {value} to {value} with body:', async function (method: string, key: MemoryValue, url: MemoryValue, body: string) { const conf: RequestInit = { method, @@ -219,13 +218,13 @@ When( ); /** - * Send request to the API with Body passed as Cucumber Doc String + * Send request to the API with body passed as Cucumber Doc String * * @example - * I send "POST" request and save response as "response" to "$BASE_API_URL" with Body: + * I send "POST" request and save response as "response" to "$BASE_API_URL" with body: * """ * { - * "title": "Test Post Request with Body passed as string" + * "title": "Test Post Request with body passed as string" * } * """ * @@ -236,7 +235,7 @@ When( * @param key key of the remembered value */ When( - 'I send {string} request and save response as {value} to {value} with headers {value} with Body:', + 'I send {string} request and save response as {value} to {value} with headers {value} with body:', async function (method: string, key: MemoryValue, url: MemoryValue, headers: MemoryValue, body: string) { const conf: RequestInit = { method, @@ -294,3 +293,18 @@ When('I parse {value} body as {value}', async function (response: MemoryValue, p responseFromMemory.payload = await parserFn(responseFromMemory, this.log.bind(this)); }); +/** + * Clone response + * + * @example + * I clone '$response' response as 'copiedResponse' + * I copy '$response' response as 'copiedResponse' + * + * @param response memory key of original response + * @param copiedResponse memory key of copied response + */ +When('I clone/copy {value} response as {value}', async function (response: MemoryValue, copiedResponse: MemoryValue) { + const originalResponse: Response = await response.value(); + copiedResponse.set(originalResponse.clone()); +}); + diff --git a/src/apiConstructionSteps.ts b/src/apiConstructionSteps.ts index 095c736..9545f02 100644 --- a/src/apiConstructionSteps.ts +++ b/src/apiConstructionSteps.ts @@ -1,11 +1,10 @@ -import { DataTable, When } from '@cucumber/cucumber'; import { dataTable2Object, sendHttpRequest } from './utils'; import GraphQl from './GraphQl'; -import { MemoryValue } from '@qavajs/core'; +import { type MemoryValue, DataTable, When } from '@qavajs/core'; /** * Create request template and save it to memory - * @param {string} method - should be named as one of the http methods (e.g. GET, POST, PUT, DELETE and etc.) + * @param {string} method - should be named as one of the http methods (e.g. GET, POST, PUT, DELETE etc.) * * @example * When I create 'GET' request 'request' diff --git a/src/apiVerificationSteps.ts b/src/apiVerificationSteps.ts index 0f34a98..849de81 100644 --- a/src/apiVerificationSteps.ts +++ b/src/apiVerificationSteps.ts @@ -1,6 +1,5 @@ -import { DataTable, Then } from '@cucumber/cucumber'; import { getValidation } from '@qavajs/validation'; -import { MemoryValue, Validation } from '@qavajs/core'; +import { type MemoryValue, type Validation, DataTable, Then } from '@qavajs/core'; /** * Verifying that response contains all models diff --git a/src/parameterTypes.ts b/src/parameterTypes.ts index 405a0b4..484b6cb 100644 --- a/src/parameterTypes.ts +++ b/src/parameterTypes.ts @@ -1,4 +1,4 @@ -import { defineParameterType } from '@cucumber/cucumber'; +import { defineParameterType } from '@qavajs/core'; /** * Used for parsing responses body diff --git a/src/utils.ts b/src/utils.ts index d572b18..8b3bdd7 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,4 +1,4 @@ -import { DataTable, IWorld } from '@cucumber/cucumber'; +import { DataTable, IWorld } from '@qavajs/core'; import WebSocket from 'ws'; type RequestConfig = { diff --git a/src/websocket.ts b/src/websocket.ts index fc5dcb1..f827794 100644 --- a/src/websocket.ts +++ b/src/websocket.ts @@ -1,8 +1,6 @@ -import { When } from '@cucumber/cucumber'; import WebSocket from 'ws'; -import { MemoryValue } from '@qavajs/core'; +import { type MemoryValue, When } from '@qavajs/core'; import { sendMessage } from './utils'; -import memory from "@qavajs/memory"; When('I connect to {value} ws endpoint {value}', async function (uriKey: MemoryValue, wsKey: MemoryValue) { const uri = await uriKey.value(); @@ -43,7 +41,7 @@ When('I send {value} message to {value} ws endpoint', async function (messageKey }); When('I send message to {value} ws endpoint:', async function (wsKey: MemoryValue, messageKey: string) { - const message = await memory.getValue(messageKey); + const message = await this.getValue(messageKey); const ws = await wsKey.value(); sendMessage(message, ws); }); diff --git a/test-e2e/features/api.feature b/test-e2e/features/api.feature index 063c270..362dfd6 100644 --- a/test-e2e/features/api.feature +++ b/test-e2e/features/api.feature @@ -49,7 +49,7 @@ Feature: API And Response "$response.statusText" to equal 'Not Found' Scenario: Verify POST with valid request body as Cucumber Doc String - When I send "POST" request and save response as "response" to "https://jsonplaceholder.typicode.com/posts" with Body: + When I send "POST" request and save response as "response" to "https://jsonplaceholder.typicode.com/posts" with body: """ { "userId": 1, @@ -63,7 +63,7 @@ Feature: API And Response "$response.statusText" to equal 'Created' Scenario: Verify POST with valid request body as Cucumber Doc String and headers as file - When I send "POST" request and save response as "response" to "https://jsonplaceholder.typicode.com/posts" with headers "$json('testData/headers.json')" with Body: + When I send "POST" request and save response as "response" to "https://jsonplaceholder.typicode.com/posts" with headers "$json('testData/headers.json')" with body: """ { "userId": 1, @@ -77,7 +77,7 @@ Feature: API And Response "$response.statusText" to equal 'Created' Scenario: Verify POST with valid request body as file and headers as file - When I send "POST" request to "https://jsonplaceholder.typicode.com/posts" with headers "$json('testData/headers.json')" with Body "$textFile('testData/test_data_file.json')" and save response as "response" + When I send "POST" request to "https://jsonplaceholder.typicode.com/posts" with headers "$json('testData/headers.json')" with body "$textFile('testData/test_data_file.json')" and save response as "response" And I parse "$response" body as json Then Response "$response.status" to equal '201' And Response "$response.statusText" to equal 'Created' @@ -91,3 +91,9 @@ Feature: API When I send 'GET' request to "https://jsonplaceholder.typicode.com/todos/1" and save response as 'response' And I parse "$response" body as '$js(response => response.json().then(obj => obj.userId))' Then I expect "$response.payload" memory value to be equal '$js(1)' + + Scenario: Verify copy response + When I send 'GET' request to "https://jsonplaceholder.typicode.com/todos/1" and save response as 'response' + And I copy '$response' response as 'copiedResponse' + And I parse '$response' body as json + And I parse '$copiedResponse' body as text \ No newline at end of file diff --git a/test-e2e/features/apiMock.feature b/test-e2e/features/apiMock.feature index 7f50062..2b5e001 100644 --- a/test-e2e/features/apiMock.feature +++ b/test-e2e/features/apiMock.feature @@ -22,7 +22,7 @@ Feature: API Then I expect '$response.payload.requestHeaders.customheader' memory value to be equal '42' Scenario: Verify POST with valid request body as Cucumber Doc String and headers as file - When I send 'POST' request to 'https://jsonplaceholder.typicode.com/posts' with headers '$contentType("application/x-www-form-urlencoded; charset=UTF-8")' with Body 'qwerty' and save response as 'response' + When I send 'POST' request to 'https://jsonplaceholder.typicode.com/posts' with headers '$contentType("application/x-www-form-urlencoded; charset=UTF-8")' with body 'qwerty' and save response as 'response' And I parse "$response" body as json Then Response "$response.status" to equal '201' And Response "$response.statusText" to equal 'Created' diff --git a/test-e2e/step-definitions/index.ts b/test-e2e/step-definitions/index.ts index 3fb2617..f93765e 100644 --- a/test-e2e/step-definitions/index.ts +++ b/test-e2e/step-definitions/index.ts @@ -1,6 +1,5 @@ -import { Then } from '@cucumber/cucumber'; import { expect } from '@qavajs/validation'; -import { MemoryValue } from '@qavajs/core'; +import { type MemoryValue, Then } from '@qavajs/core'; Then('I expect {value} memory value to be equal {value}', async function (actual: MemoryValue, expected: MemoryValue) { const actualValue = await actual.value();