Skip to content

Commit

Permalink
[Suggestion] Add colorblind support #5
Browse files Browse the repository at this point in the history
  • Loading branch information
estruyf committed Jul 17, 2024
1 parent ecd0af4 commit 8587600
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
## [0.0.8]

- [#4](https://github.com/playwright-community/playwright-msteams-reporter/issues/4): Added support for flaky tests
- [#5](https://github.com/playwright-community/playwright-msteams-reporter/issues/5): Added the `enableEmoji` setting to show an emoji based on the test status

## [0.0.7]

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ The reporter supports the following configuration options:
| `notifyOnSuccess` | Notify on success | `boolean` | `false` | `true` |
| `mentionOnFailure` | Mention users on failure (comma separated list) | `string` | `false` | `undefined` |
| `mentionOnFailureText` | Text to mention users on failure | `string` | `false` | `{mentions} please validate the test results.` |
| `enableEmoji` | Show an emoji based on the test status | `boolean` | `false` | `false` |
| `quiet` | Do not show any output in the console | `boolean` | `false` | `false` |
| `debug` | Show debug information | `boolean` | `false` | `false` |

Expand Down
1 change: 1 addition & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const config: PlaywrightTestConfig<{}, {}> = {
linkTextOnFailure: "Report an issue",
mentionOnFailure: "[email protected]",
mentionOnFailureText: "",
enableEmoji: false,
debug: true,
},
],
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface MsTeamsReporterOptions {
notifyOnSuccess?: boolean;
mentionOnFailure?: string;
mentionOnFailureText?: string;
enableEmoji?: boolean;
quiet?: boolean;
debug?: boolean;
}
Expand All @@ -37,6 +38,7 @@ export default class MsTeamsReporter implements Reporter {
notifyOnSuccess: true,
mentionOnFailure: undefined,
mentionOnFailureText: "{mentions} please validate the test results.",
enableEmoji: false,
quiet: false,
debug: false,
};
Expand Down
24 changes: 20 additions & 4 deletions src/processResults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,34 @@ export const processResults = async (
table.rows.push(createTableRow("Type", "Total"));

table.rows.push(
createTableRow("Passed", totalStatus.passed, { style: "good" })
createTableRow(
`${options.enableEmoji ? "✅ " : ""}Passed`,
totalStatus.passed,
{ style: "good" }
)
);
if (totalStatus.flaky) {
table.rows.push(
createTableRow("Flaky", totalStatus.flaky, { style: "warning" })
createTableRow(
`${options.enableEmoji ? "⚠️ " : ""}Flaky`,
totalStatus.flaky,
{ style: "warning" }
)
);
}
table.rows.push(
createTableRow("Failed", totalStatus.failed, { style: "attention" })
createTableRow(
`${options.enableEmoji ? "❌ " : ""}Failed`,
totalStatus.failed,
{ style: "attention" }
)
);
table.rows.push(
createTableRow("Skipped", totalStatus.skipped, { style: "accent" })
createTableRow(
`${options.enableEmoji ? "⏭️ " : ""}Skipped`,
totalStatus.skipped,
{ style: "accent" }
)
);
table.rows.push(
createTableRow("Total tests", totalTests, {
Expand Down

0 comments on commit 8587600

Please sign in to comment.