Skip to content
This repository has been archived by the owner on May 24, 2023. It is now read-only.

fix: scrape junit report #54

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion pkg/runner/cypress.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,17 @@ func (r *CypressRunner) Run(execution testkube.Execution) (result testkube.Execu
for _, value := range execution.Variables {
envVars = append(envVars, fmt.Sprintf("%s=%s", value.Name, value.Value))
}

// set up reports directory
reportsPath := filepath.Join(path, "reports")
if _, err := os.Stat(reportsPath); os.IsNotExist(err) {
mkdirErr := os.Mkdir(reportsPath, os.ModePerm)
if mkdirErr != nil {
return result, mkdirErr
}
}

junitReportPath := filepath.Join(path, "results/junit.xml")
junitReportPath := filepath.Join(path, "reports/report.xml")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why file name changed ?

args := []string{"run", "--reporter", "junit", "--reporter-options", fmt.Sprintf("mochaFile=%s,toConsole=false", junitReportPath),
"--env", strings.Join(envVars, ",")}

Expand All @@ -136,6 +145,7 @@ func (r *CypressRunner) Run(execution testkube.Execution) (result testkube.Execu
directories := []string{
filepath.Join(path, "cypress/videos"),
filepath.Join(path, "cypress/screenshots"),
junitReportPath,
}
err := r.Scraper.Scrape(execution.Id, directories)
if err != nil {
Expand Down