From 20fb39ed483a8fcd088f73f57bb4b9a64307c181 Mon Sep 17 00:00:00 2001 From: maguire-arman Date: Fri, 6 Jun 2025 10:06:36 -0400 Subject: [PATCH] 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. --- playwright-tests/package.json | 1 - playwright-tests/playwright.config.ts | 39 +++++++++++++++++++++------ 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/playwright-tests/package.json b/playwright-tests/package.json index 685f2120d..527ec7058 100644 --- a/playwright-tests/package.json +++ b/playwright-tests/package.json @@ -16,7 +16,6 @@ "install:deps": "playwright install-deps" }, "keywords": [], - "author": "Your Name ", "license": "ISC", "dependencies": { "axios": "^1.9.0", diff --git a/playwright-tests/playwright.config.ts b/playwright-tests/playwright.config.ts index 230ad948d..8e4b1da2a 100644 --- a/playwright-tests/playwright.config.ts +++ b/playwright-tests/playwright.config.ts @@ -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('/')`. */