From c995b5002244bc2ec929b88cbed898184bf51c65 Mon Sep 17 00:00:00 2001 From: Sergey Skaridov Date: Tue, 7 Mar 2023 16:25:03 +0300 Subject: [PATCH] add an example for integration with Qase --- .github/workflows/npm.yml | 5 +- .../.github/workflows/github-actions-test.yml | 46 ++++ examples/github-qase-integration/.gitignore | 1 + .../github-qase-integration/package-lock.json | 236 ++++++++++++++++++ examples/github-qase-integration/package.json | 18 ++ .../playwright.config.js | 16 ++ .../tests/playwright/test.spec.js | 18 ++ 7 files changed, 339 insertions(+), 1 deletion(-) create mode 100644 examples/github-qase-integration/.github/workflows/github-actions-test.yml create mode 100644 examples/github-qase-integration/.gitignore create mode 100644 examples/github-qase-integration/package-lock.json create mode 100644 examples/github-qase-integration/package.json create mode 100644 examples/github-qase-integration/playwright.config.js create mode 100644 examples/github-qase-integration/tests/playwright/test.spec.js diff --git a/.github/workflows/npm.yml b/.github/workflows/npm.yml index 5f01c0d2..dae54457 100644 --- a/.github/workflows/npm.yml +++ b/.github/workflows/npm.yml @@ -1,6 +1,9 @@ name: Node package -on: [push] +on: + push: + paths-ignore: + - 'examples/**' jobs: test: diff --git a/examples/github-qase-integration/.github/workflows/github-actions-test.yml b/examples/github-qase-integration/.github/workflows/github-actions-test.yml new file mode 100644 index 00000000..1ccbbbcb --- /dev/null +++ b/examples/github-qase-integration/.github/workflows/github-actions-test.yml @@ -0,0 +1,46 @@ +name: Run tests + +on: + workflow_dispatch: + inputs: + qase_api_base_url: + description: 'Qase API URL' + required: true + qase_report: + description: 'Enabled/disabled reporting to Qase' + required: true + qase_project_code: + description: 'Qase project code' + required: true + qase_run_id: + description: 'Qase Run ID' + required: true + qase_run_complete: + description: 'Complete Qase Run' + required: true + +env: + QASE_API_BASE_URL: ${{ inputs.qase_api_base_url }} + QASE_REPORT: ${{ inputs.qase_report }} + QASE_PROJECT_CODE: ${{ inputs.qase_project_code }} + QASE_RUN_ID: ${{ inputs.qase_run_id }} + QASE_RUN_COMPLETE: ${{ inputs.qase_run_complete }} + QASE_API_TOKEN: ${{ secrets.QASE_API_TOKEN }} + +jobs: + build-js: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [16.x] + steps: + - uses: qase-tms/qase-link-run@main + env: + QASE_API_TOKEN: ${{ env.QASE_API_TOKEN }} + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - run: npm ci + - run: npm test diff --git a/examples/github-qase-integration/.gitignore b/examples/github-qase-integration/.gitignore new file mode 100644 index 00000000..c2658d7d --- /dev/null +++ b/examples/github-qase-integration/.gitignore @@ -0,0 +1 @@ +node_modules/ diff --git a/examples/github-qase-integration/package-lock.json b/examples/github-qase-integration/package-lock.json new file mode 100644 index 00000000..694c73e2 --- /dev/null +++ b/examples/github-qase-integration/package-lock.json @@ -0,0 +1,236 @@ +{ + "name": "test-qase-gh-action", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "test-qase-gh-action", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "@playwright/test": "^1.31.1", + "playwright-qase-reporter": "^1.2.0-alpha.5" + } + }, + "node_modules/@playwright/test": { + "version": "1.31.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.31.1.tgz", + "integrity": "sha512-IsytVZ+0QLDh1Hj83XatGp/GsI1CDJWbyDaBGbainsh0p2zC7F4toUocqowmjS6sQff2NGT3D9WbDj/3K2CJiA==", + "dependencies": { + "@types/node": "*", + "playwright-core": "1.31.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=14" + }, + "optionalDependencies": { + "fsevents": "2.3.2" + } + }, + "node_modules/@types/node": { + "version": "18.14.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.14.2.tgz", + "integrity": "sha512-1uEQxww3DaghA0RxqHx0O0ppVlo43pJhepY51OxuQIKHpjbnYLA7vcdwioNPzIqmC2u3I/dmylcqjlh0e7AyUA==" + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/axios": { + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.25.0.tgz", + "integrity": "sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==", + "dependencies": { + "follow-redirects": "^1.14.7" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", + "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/playwright-core": { + "version": "1.31.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.31.1.tgz", + "integrity": "sha512-JTyX4kV3/LXsvpHkLzL2I36aCdml4zeE35x+G5aPc4bkLsiRiQshU5lWeVpHFAuC8xAcbI6FDcw/8z3q2xtJSQ==", + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/playwright-qase-reporter": { + "version": "1.2.0-alpha.5", + "resolved": "https://registry.npmjs.org/playwright-qase-reporter/-/playwright-qase-reporter-1.2.0-alpha.5.tgz", + "integrity": "sha512-XRDp6mmM18YBdd71OtPFRqDmBq8EA/gl6wcICxyWMQIYM9+itRBOY3FQyoyIWqLOJUXtPY9LS1D7XILSswBoxg==", + "dependencies": { + "chalk": "^4.1.0", + "form-data": "^3.0.0", + "qaseio": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/qaseio": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/qaseio/-/qaseio-2.0.1.tgz", + "integrity": "sha512-T3QfTlFpWHMtC/fTQZ/pZ5X1Xqt9Qz4kFX37NsgedPGYfJDEMgNdny3neeoqEk3Y+QaeFbEYxQP8ewPc6Jc95w==", + "dependencies": { + "axios": "^0.25.0", + "form-data": "^3.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + } + } +} diff --git a/examples/github-qase-integration/package.json b/examples/github-qase-integration/package.json new file mode 100644 index 00000000..7f74a190 --- /dev/null +++ b/examples/github-qase-integration/package.json @@ -0,0 +1,18 @@ +{ + "name": "test-qase-gh-action", + "version": "1.0.0", + "description": "", + "main": "index.js", + "directories": { + "test": "tests" + }, + "scripts": { + "test": "npx playwright test" + }, + "author": "", + "license": "Apache License 2.0", + "dependencies": { + "@playwright/test": "^1.31.1", + "playwright-qase-reporter": "^1.2.0-alpha.5" + } +} diff --git a/examples/github-qase-integration/playwright.config.js b/examples/github-qase-integration/playwright.config.js new file mode 100644 index 00000000..e13cb87f --- /dev/null +++ b/examples/github-qase-integration/playwright.config.js @@ -0,0 +1,16 @@ +const config = { + use: { + screenshot: 'only-on-failure', + video: 'retain-on-failure', + }, + reporter: [ + ['list'], + [ + 'playwright-qase-reporter', + { + logging: true, + }, + ], + ], +}; +module.exports = config; diff --git a/examples/github-qase-integration/tests/playwright/test.spec.js b/examples/github-qase-integration/tests/playwright/test.spec.js new file mode 100644 index 00000000..d04ad205 --- /dev/null +++ b/examples/github-qase-integration/tests/playwright/test.spec.js @@ -0,0 +1,18 @@ +import {test, expect} from '@playwright/test' +import {qase} from 'playwright-qase-reporter/dist/playwright' + +test(qase(1, 'Several ids'), () => { + expect(true).toBe(true); +}) + +test(qase(2, 'Correct test'), () => { + expect(true).toBe(true); +}) + +test.skip(qase(3, 'Skipped test'), () => { + expect(true).toBe(true); +}) + +test(qase(4, 'Failed test'), () => { + expect(true).toBe(false); +})