@@ -38681,15 +38681,18 @@ class ReportProcessor {
3868138681 const { summary } = core;
3868238682 await summary.addHeading('BrowserStack Test Report');
3868338683
38684- if (this.reportData?.report?.basicHtml) {
38685- await summary.addRaw(`<html>${this.reportData.report.basicHtml}</html>`);
38684+ const addToSummaryReport = this.reportData?.report?.basicHtml;
38685+ if (addToSummaryReport) {
38686+ await summary.addRaw(`<html>${addToSummaryReport}</html>`);
3868638687 } else {
3868738688 await summary.addRaw('⚠️ No report content available');
3868838689 }
3868938690 summary.write();
38690- if (this.reportData?.report?.richHtml) {
38691- const report = `<!DOCTYPE html> <html><head><style>${this.reportData?.report?.richCss}</style></head> ${this.reportData?.report?.richHtml}</html>`;
38692- const artifactObj = new UploadFileForArtifact(report);
38691+ const addToArtifactReport = this.reportData?.report?.richHtml;
38692+ const addToArtifactReportCss = this.reportData?.report?.richCss;
38693+ if (addToArtifactReport) {
38694+ const report = `<!DOCTYPE html> <html><head><style>${addToArtifactReportCss}</style></head> ${addToArtifactReport}}</html>`;
38695+ const artifactObj = new UploadFileForArtifact(report, 'browserstack-artifacts', 'browserstack-report.html', 'BrowserStack Test Report');
3869338696 await artifactObj.saveReportInFile();
3869438697 }
3869538698 } catch (error) {
@@ -38844,8 +38847,11 @@ const path = __nccwpck_require__(6928);
3884438847const core = __nccwpck_require__(7484);
3884538848
3884638849class UploadFileForArtifact {
38847- constructor(report) {
38850+ constructor(report, pathName, fileName, artifactName ) {
3884838851 this.report = report;
38852+ this.pathName = pathName;
38853+ this.fileName = fileName;
38854+ this.artifactName = artifactName;
3884938855 }
3885038856
3885138857 async saveReportInFile() {
@@ -38855,17 +38861,14 @@ class UploadFileForArtifact {
3885538861 }
3885638862
3885738863 try {
38858- const pathName = "browserstack-reports-artifact";
38859- const fileName = `bstack-report.html`;
38860- const artifactName = "browserstack-report";
3886138864 // Create artifacts directory
38862- fs.mkdirSync(pathName, { recursive: true });
38865+ fs.mkdirSync(this. pathName, { recursive: true });
3886338866 // save path in a env variable
38864- core.exportVariable('BROWSERSTACK_REPORT_PATH', pathName);
38865- core.exportVariable("BROWSERSTACK_REPORT_NAME", artifactName);
38867+ core.exportVariable('BROWSERSTACK_REPORT_PATH', this. pathName);
38868+ core.exportVariable("BROWSERSTACK_REPORT_NAME", this. artifactName);
3886638869
3886738870 // Write content
38868- fs.writeFileSync(path.join(pathName, fileName), this.report);
38871+ fs.writeFileSync(path.join(this. pathName, this. fileName), this.report);
3886938872 } catch (error) {
3887038873 core.warning(`Failed to save file: ${error.message}`);
3887138874 return '';
0 commit comments