Skip to content

Commit

Permalink
Fix: Changed getting datetime 3 and fixed testomat report condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew718PLTS committed Nov 12, 2024
1 parent 9327160 commit ec525ed
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 19 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/common-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,13 @@ jobs:

- name: Set current datetime
run: |
NOW=$(date +"%Y-%m-%d %H:%M:%S")
echo "$CURRENT_DATETIME=$NOW" >> $env:GITHUB_ENV
- name: Set job author
run: echo "$JOB_AUTHOR=$GITHUB_ACTOR" >> $env:GITHUB_ENV
CURRENT_DATETIME=$(date +"%Y-%m-%d %H:%M:%S")
echo "CURRENT_DATETIME=$CURRENT_DATETIME" >> $GITHUB_ENV
- name: Run Playwright tests
run: xvfb-run npx playwright test
env:
TESTOMATIO_TITLE: "${{ inputs.TESTOMATIO_TITLE }} by ${{ env.JOB_AUTHOR }} at: ${{ env.CURRENT_DATETIME }}"
TESTOMATIO_TITLE: "${{ inputs.TESTOMATIO_TITLE }} by ${{ github.actor }} at: ${{ env.CURRENT_DATETIME }}"

- name: Upload artifacts
uses: actions/upload-artifact@v4
Expand Down
25 changes: 12 additions & 13 deletions src/helpers/config/config.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ConfigHelper {
}

getReportersList(): unknown {
const commonReporters = [
const commonReporters: unknown[] = [
[
"html",
{
Expand All @@ -42,20 +42,19 @@ class ConfigHelper {
],
["list"],
];
if (this.shouldRunTestomatReport() && !envHelper.isCI()) {
if (!envHelper.isCI() && this.shouldRunTestomatReport()) {
processEnv.TESTOMATIO_TITLE = `Local at: ${primitiveHelper.getCurrentDateTime()}`;
}
return envHelper.isCI() || this.shouldRunTestomatReport()
? [
...commonReporters,
[
"@testomatio/reporter/lib/adapter/playwright.js",
{
apiKey: processEnv.TESTOMAT_API_KEY,
},
],
]
: commonReporters;
if (envHelper.isCI() && this.shouldRunTestomatReport()) {
commonReporters.push([
"@testomatio/reporter/lib/adapter/playwright.js",
{
apiKey: processEnv.TESTOMAT_API_KEY,
},
]);
}

return commonReporters;
}

shouldRunTestomatReport(): boolean {
Expand Down

0 comments on commit ec525ed

Please sign in to comment.