Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions src/api/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface CreateResultsRequestItem {
tcaseId: string
status: ResultStatus
comment?: string
timeTaken: number | null // In milliseconds
}

export interface CreateResultsRequest {
Expand Down
12 changes: 12 additions & 0 deletions src/tests/fixtures/playwright-json/comprehensive-test.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"stdout": [],
"stderr": [],
"retry": 0,
"duration": 1000,
"attachments": []
}
],
Expand All @@ -48,6 +49,7 @@
"stdout": [],
"stderr": [],
"retry": 0,
"duration": 6200,
"attachments": []
}
],
Expand All @@ -74,6 +76,7 @@
"stdout": [],
"stderr": [],
"retry": 0,
"duration": 2000,
"attachments": []
}
],
Expand Down Expand Up @@ -106,6 +109,7 @@
"stdout": [],
"stderr": [],
"retry": 0,
"duration": 1400,
"attachments": []
}
],
Expand All @@ -132,6 +136,7 @@
"stdout": [],
"stderr": [],
"retry": 0,
"duration": 500,
"attachments": []
}
],
Expand All @@ -158,6 +163,7 @@
"stdout": [],
"stderr": [],
"retry": 0,
"duration": 5050,
"attachments": []
}
],
Expand Down Expand Up @@ -186,6 +192,7 @@
"stdout": [],
"stderr": [],
"retry": 0,
"duration": 0,
"attachments": []
}
],
Expand Down Expand Up @@ -213,6 +220,7 @@
"stdout": [],
"stderr": [],
"retry": 0,
"duration": 0,
"attachments": []
}
],
Expand All @@ -239,6 +247,7 @@
],
"stderr": [],
"retry": 0,
"duration": 0,
"attachments": []
}
],
Expand Down Expand Up @@ -270,6 +279,7 @@
],
"stderr": [],
"retry": 0,
"duration": 0,
"attachments": []
}
],
Expand All @@ -296,6 +306,7 @@
],
"stderr": [],
"retry": 0,
"duration": 10000,
"attachments": []
}
],
Expand All @@ -318,6 +329,7 @@
"stdout": [],
"stderr": [],
"retry": 0,
"duration": 1000,
"attachments": [
{
"name": "screenshot",
Expand Down
1 change: 1 addition & 0 deletions src/tests/fixtures/playwright-json/empty-tsuite.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"stdout": [],
"stderr": [],
"retry": 0,
"duration": 0,
"attachments": []
}
],
Expand Down
5 changes: 5 additions & 0 deletions src/tests/fixtures/playwright-json/matching-tcases.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"stdout": [],
"stderr": [],
"retry": 0,
"duration": 1000,
"attachments": [
{
"name": "attachment",
Expand Down Expand Up @@ -46,6 +47,7 @@
"stdout": [],
"stderr": [],
"retry": 0,
"duration": 1000,
"attachments": [
{
"name": "attachment",
Expand Down Expand Up @@ -80,6 +82,7 @@
"stdout": [],
"stderr": [],
"retry": 0,
"duration": 1000,
"attachments": [
{
"name": "attachment",
Expand Down Expand Up @@ -112,6 +115,7 @@
"stdout": [],
"stderr": [],
"retry": 0,
"duration": 1000,
"attachments": [
{
"name": "attachment",
Expand Down Expand Up @@ -140,6 +144,7 @@
"stdout": [],
"stderr": [],
"retry": 0,
"duration": 1000,
"attachments": [
{
"name": "attachment",
Expand Down
5 changes: 5 additions & 0 deletions src/tests/fixtures/playwright-json/missing-attachments.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"stdout": [],
"stderr": [],
"retry": 0,
"duration": 1000,
"attachments": [
{
"name": "attachment",
Expand Down Expand Up @@ -46,6 +47,7 @@
"stdout": [],
"stderr": [],
"retry": 0,
"duration": 1000,
"attachments": [
{
"name": "attachment",
Expand Down Expand Up @@ -80,6 +82,7 @@
"stdout": [],
"stderr": [],
"retry": 0,
"duration": 1000,
"attachments": [
{
"name": "attachment",
Expand Down Expand Up @@ -112,6 +115,7 @@
"stdout": [],
"stderr": [],
"retry": 0,
"duration": 1000,
"attachments": [
{
"name": "attachment",
Expand Down Expand Up @@ -140,6 +144,7 @@
"stdout": [],
"stderr": [],
"retry": 0,
"duration": 1000,
"attachments": [
{
"name": "attachment",
Expand Down
6 changes: 6 additions & 0 deletions src/tests/fixtures/playwright-json/missing-tcases.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"stdout": [],
"stderr": [],
"retry": 0,
"duration": 1000,
"attachments": [
{
"name": "attachment",
Expand Down Expand Up @@ -46,6 +47,7 @@
"stdout": [],
"stderr": [],
"retry": 0,
"duration": 1000,
"attachments": [
{
"name": "attachment",
Expand Down Expand Up @@ -80,6 +82,7 @@
"stdout": [],
"stderr": [],
"retry": 0,
"duration": 1000,
"attachments": [
{
"name": "attachment",
Expand Down Expand Up @@ -108,6 +111,7 @@
"stdout": [],
"stderr": [],
"retry": 0,
"duration": 1000,
"attachments": [
{
"name": "attachment",
Expand Down Expand Up @@ -140,6 +144,7 @@
"stdout": [],
"stderr": [],
"retry": 0,
"duration": 1000,
"attachments": [
{
"name": "attachment",
Expand Down Expand Up @@ -168,6 +173,7 @@
"stdout": [],
"stderr": [],
"retry": 0,
"duration": 1000,
"attachments": [
{
"name": "attachment",
Expand Down
12 changes: 8 additions & 4 deletions src/tests/junit-xml-parsing.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect, test, describe } from 'vitest'
import { readFile } from 'node:fs/promises'
import { parseJUnitXml } from '../utils/result-upload/junitXmlParser'
import { readFile } from 'fs/promises'

const xmlBasePath = './src/tests/fixtures/junit-xml'

Expand Down Expand Up @@ -46,6 +46,7 @@ describe('Junit XML parsing', () => {
expect(tc).toHaveProperty('status')
expect(tc).toHaveProperty('message')
expect(tc).toHaveProperty('attachments')
expect(tc).toHaveProperty('timeTaken')
expect(Array.isArray(tc.attachments)).toBe(true)
})
})
Expand Down Expand Up @@ -184,7 +185,7 @@ describe('Junit XML parsing', () => {
const xml = `<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Test Suite">
<testsuite name="Sample Suite">
<testcase name="Test with stderr">
<testcase name="Test with stderr" time="10.5">
<system-out>stdout content</system-out>
<system-err>stderr content</system-err>
</testcase>
Expand All @@ -198,6 +199,7 @@ describe('Junit XML parsing', () => {

expect(testcases).toHaveLength(1)
expect(testcases[0].status).toBe('passed')
expect(testcases[0].timeTaken).toBe(10500)
// Should include stdout but not stderr for passed tests
expect(testcases[0].message).toContain('stdout content')
expect(testcases[0].message).not.toContain('stderr content')
Expand All @@ -207,7 +209,7 @@ describe('Junit XML parsing', () => {
const xml = `<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Test Suite">
<testsuite name="Sample Suite">
<testcase name="Failed test with output">
<testcase name="Failed test with output" time="0">
<failure message="Test failed">Failure details</failure>
<system-out>stdout from failed test</system-out>
<system-err>stderr from failed test</system-err>
Expand All @@ -222,6 +224,7 @@ describe('Junit XML parsing', () => {

expect(testcases).toHaveLength(1)
expect(testcases[0].status).toBe('failed')
expect(testcases[0].timeTaken).toBe(0)
// Should include both stdout and stderr for failed tests
expect(testcases[0].message).toContain('Failure details')
expect(testcases[0].message).toContain('stdout from failed test')
Expand All @@ -232,7 +235,7 @@ describe('Junit XML parsing', () => {
const xml = `<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Test Suite">
<testsuite name="Sample Suite">
<testcase name="Passed test with output">
<testcase name="Passed test with output" time="">
<system-out>stdout content</system-out>
<system-err>stderr content</system-err>
</testcase>
Expand All @@ -246,6 +249,7 @@ describe('Junit XML parsing', () => {

expect(testcases).toHaveLength(1)
expect(testcases[0].status).toBe('passed')
expect(testcases[0].timeTaken).toBe(null)
// Should not include stdout or stderr for passed tests
expect(testcases[0].message).toBe('')
})
Expand Down
Loading