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

View file

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