Adds Jira reporter and configures reports

Adds the playwright-jira-reporter to the project.

Configures both ortoni and jira reporters, including setting up
Jira API authentication and project keys.

The ortoni report filename is now dynamically generated with a date
stamp to prevent overwriting.

Updates the reporter configuration to conditionally include Jira reporter
when running in CI.
This commit is contained in:
maguire-arman 2025-06-06 10:06:36 -04:00
parent f30049315c
commit 20fb39ed48
2 changed files with 31 additions and 9 deletions

View file

@ -16,7 +16,6 @@
"install:deps": "playwright install-deps"
},
"keywords": [],
"author": "Your Name <your.email@example.com>",
"license": "ISC",
"dependencies": {
"axios": "^1.9.0",

View file

@ -1,4 +1,6 @@
import { formatDateForFilename } from '@impl/utils/DateUtils';
import { defineConfig, devices } from '@playwright/test';
import { JiraReporterConfig } from 'playwright-jira-reporter'
import dotenv from 'dotenv-safe';
import { OrtoniReportConfig } from "ortoni-report";
import path from 'path';
@ -33,20 +35,39 @@ if (!process.env.CI) {
* See https://playwright.dev/docs/test-configuration.
*/
// Ortoni config
const reportConfig: OrtoniReportConfig = {
port: 1994,
const ortoniReportConfig: OrtoniReportConfig = {
open: "never",
folderPath: "test-results",
filename: "index.html",
folderPath: 'playwright-tests/test-results',
logo: "../business-logic/data/logo.png",
title: "Test Report",
filename: `ortoni_report_${formatDateForFilename(new Date())}.html`,
showProject: false,
projectName: "FMG-Nextgen-Playwright-Report",
testType: `E2E- Environment: ${process.env.NODE_ENV} `,
preferredTheme: "light",
base64Image: true,
};
}
// Jira Report config
const jiraReportConfig: JiraReporterConfig = {
// Jira Reporter Config
isRegressionRun: process.env.IS_REGRESSION === 'true',
jiraProjectKey: process.env.JIRA_PROJECT_KEY || '',
jiraEpicKey: process.env.JIRA_EPIC_KEY || '',
jiraCardNumber: process.env.JIRA_CARD_NUMBER || '',
jiraApiUtilConfig: {
jiraUrl: process.env.JIRA_SERVER || '',
jiraUsername: process.env.JIRA_USERNAME || '',
jiraApiKey: process.env.JIRA_API_KEY || '',
jiraBoardId: process.env.JIRA_BOARD_ID || ''
},
jiraCreationPermissions: {
isCreateTestSubtasks: false,
isCreateBugs: false
},
// Wrapped ortoni config
...ortoniReportConfig
};
export default defineConfig({
testDir: './tests',
@ -59,12 +80,14 @@ export default defineConfig({
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 4 : 5,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [
['ortoni-report', reportConfig],
reporter: process.env.CI? [
['junit'],
['playwright-jira-reporter', jiraReportConfig]
]: [
['ortoni-report', ortoniReportConfig],
['list']
],
timeout: 300_000,
timeout: 240_000,
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */