Skip to content

Commit

Permalink
Add testrail
Browse files Browse the repository at this point in the history
  • Loading branch information
Tung-Huynh-Shopmacher committed Jul 19, 2024
1 parent 3e1a911 commit 664824f
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 6 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,30 @@ jobs:
- name: Run tests
run: npm run test

- name: Python setup
if: always()
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: TestRail CLI upload results
env:
TR_INSTANCE: ${{ secrets.TR_INSTANCE }}
TR_PROJECT_NAME: ${{ secrets.TR_PROJECT_NAME }}
TR_USER_EMAIL: ${{ secrets.TR_USER_EMAIL }}
TR_PASSWORD: ${{ secrets.TR_PASSWORD }}
if: always()
run: |
pip install trcli
trcli -y \
-h "https://$TR_INSTANCE.testrail.io" \
--project "$TR_PROJECT_NAME" \
-u $TR_USER_EMAIL \
-p $TR_PASSWORD \
parse_junit \
--title "Automated Tests - $GITHUB_REF_NAME" \
--run-description ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} \
-f "junit-report.xml"
- name: Run audit
run: npm audit
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ dist
.vscode
.idea
build/
processor/.env
processor/.env
processor/junit-report.xml
3 changes: 2 additions & 1 deletion processor/jest.config.cjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
module.exports = {
displayName: 'Tests Typescript Application - shopmacher-mollie-processor',
displayName: 'Tests Mollie connector - shopmacher-mollie-connector',
moduleDirectories: ['node_modules', 'src'],
testMatch: ['**/tests/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[tj]s?(x)'],
preset: 'ts-jest',
testEnvironment: 'node',
setupFiles: ['<rootDir>/src/jest.setup.ts'],
setupFilesAfterEnv: ['<rootDir>/src/jest.setupAfterEnv.ts'],
modulePathIgnorePatterns: ['<rootDir>/src/jest.setup.ts'],
reporters: ['default', 'jest-junit']
};
5 changes: 5 additions & 0 deletions processor/junitTestCaseProperties.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = (testResult) => {
return {
testrail_case_field: `custom_tags:["1"]`,
};
};
47 changes: 45 additions & 2 deletions processor/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion processor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"lint": "eslint . --ext .ts",
"prettier": "prettier --write '**/*.{js,ts}'",
"prettier:check": "prettier --check '**/*.{js,ts}'",
"test": "jest --detectOpenHandles --clearMocks --colors --config jest.config.cjs",
"test": "jest --detectOpenHandles --clearMocks --colors --config jest.config.cjs --ci --ci --reporters=default --reporters=jest-junit",
"test:watch": "jest --watch --clearMocks --detectOpenHandles --colors --config jest.config.cjs",
"preinstall": "npx npm-force-resolutions",
"connector:post-deploy": "node dist/connector/post-deploy.js",
Expand Down Expand Up @@ -51,6 +51,7 @@
"eslint-plugin-prettier": "5.1.3",
"eslint-plugin-unused-imports": "3.2.0",
"jest": "^29.7.0",
"jest-junit": "^16.0.0",
"ngrok": "^5.0.0-beta.2",
"nodemon": "^3.1.4",
"npm-force-resolutions": "^0.0.10",
Expand All @@ -72,5 +73,15 @@
"proxy-from-env": "^1.1.0",
"uuid": "^10.0.0",
"validator": "^13.12.0"
},
"jest-junit": {
"suiteName": "jest tests",
"outputDirectory": ".",
"outputName": "junit-report.xml",
"uniqueOutputName": "false",
"classNameTemplate": "{classname}",
"titleTemplate": "{classname}-{title}",
"ancestorSeparator": "",
"usePathForSuiteName": "true"
}
}
2 changes: 1 addition & 1 deletion processor/tests/validators/env.validators.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe('Test env.validators.ts', () => {
condition: { min: 1, max: undefined },
},
])(
'should return the correct validation array expected envValidators[%s][%s] contains [%s, %s]',
'should return the correct validation array contains [%s, %s]',
async ({ index1, index2, field1, field2, error, condition }) => {
field1 && expect(envValidators[index1][index2]).toContain(field1);
field2 && expect(envValidators[index1][index2]).toContain(field2);
Expand Down

0 comments on commit 664824f

Please sign in to comment.