-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert session details property to a stringified value
- Loading branch information
Showing
13 changed files
with
186 additions
and
120 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './auto-api/index.ts'; | ||
export * from './public-api/index.ts'; | ||
export * from './config/config.ts'; | ||
export * from './shared/index.ts'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './test-case.ts'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
export const TEST_RAIL_CASE_ID_PREFIX: string = 'TestRail-'; | ||
export const APPLAUSE_CASE_ID_PREFIX: string = 'Applause-'; | ||
|
||
export function parseTestCaseName(testCaseName: string): ParsedTestCaseName { | ||
const matches = testCaseName.match(/(TestRail-\d+|Applause-\d+)/g); | ||
const testRailCaseIds = | ||
matches | ||
?.filter(match => match.startsWith(TEST_RAIL_CASE_ID_PREFIX)) | ||
.map(match => match.substring(TEST_RAIL_CASE_ID_PREFIX.length)) || []; | ||
const applauseCaseIds = | ||
matches | ||
?.filter(match => match.startsWith(APPLAUSE_CASE_ID_PREFIX)) | ||
.map(match => match.substring(APPLAUSE_CASE_ID_PREFIX.length)) || []; | ||
|
||
if (testRailCaseIds.length > 1) { | ||
console.warn('Multiple TestRail case ids detected in testCase name'); | ||
} | ||
if (applauseCaseIds.length > 1) { | ||
console.warn('Multiple Applause case ids detected in testCase name'); | ||
} | ||
return { | ||
applauseTestCaseId: applauseCaseIds[0], | ||
testRailTestCaseId: testRailCaseIds[0], | ||
testCaseName: testCaseName | ||
.replace(/(TestRail-\d+|Applause-\d+)/g, '') | ||
.replace(/\s+/g, ' ') | ||
.trim(), | ||
}; | ||
} | ||
|
||
export interface ParsedTestCaseName { | ||
testCaseName: string; | ||
testRailTestCaseId?: string; | ||
applauseTestCaseId?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { parseTestCaseName, ParsedTestCaseName } from '../src/shared/test-case.ts'; | ||
|
||
describe('parseTestCaseName', () => { | ||
it('should parse a test case name without any prefixes', () => { | ||
const testCaseName = 'My Test Case'; | ||
const parsedTestCaseName: ParsedTestCaseName = parseTestCaseName(testCaseName); | ||
expect(parsedTestCaseName.testCaseName).toEqual(testCaseName); | ||
expect(parsedTestCaseName.testRailTestCaseId).toBeUndefined(); | ||
expect(parsedTestCaseName.applauseTestCaseId).toBeUndefined(); | ||
}); | ||
|
||
it('should parse a test case name with TestRail prefix', () => { | ||
const testCaseName = 'TestRail-123 My Test Case'; | ||
const parsedTestCaseName: ParsedTestCaseName = parseTestCaseName(testCaseName); | ||
expect(parsedTestCaseName.testCaseName).toEqual('My Test Case'); | ||
expect(parsedTestCaseName.testRailTestCaseId).toEqual('123'); | ||
expect(parsedTestCaseName.applauseTestCaseId).toBeUndefined(); | ||
}); | ||
|
||
it('should parse a test case name with Applause prefix', () => { | ||
const testCaseName = 'Applause-456 My Test Case'; | ||
const parsedTestCaseName: ParsedTestCaseName = parseTestCaseName(testCaseName); | ||
expect(parsedTestCaseName.testCaseName).toEqual('My Test Case'); | ||
expect(parsedTestCaseName.testRailTestCaseId).toBeUndefined(); | ||
expect(parsedTestCaseName.applauseTestCaseId).toEqual('456'); | ||
}); | ||
|
||
it('should parse a test case name with both TestRail and Applause prefixes', () => { | ||
const testCaseName = 'TestRail-123 Applause-456 My Test Case'; | ||
const parsedTestCaseName: ParsedTestCaseName = parseTestCaseName(testCaseName); | ||
expect(parsedTestCaseName.testCaseName).toEqual('My Test Case'); | ||
expect(parsedTestCaseName.testRailTestCaseId).toEqual('123'); | ||
expect(parsedTestCaseName.applauseTestCaseId).toEqual('456'); | ||
}); | ||
|
||
it('should parse a test case name with both TestRail and Applause prefixes, with no spaces between', () => { | ||
const testCaseName = 'TestRail-123Applause-456 My Test Case'; | ||
const parsedTestCaseName: ParsedTestCaseName = parseTestCaseName(testCaseName); | ||
expect(parsedTestCaseName.testCaseName).toEqual('My Test Case'); | ||
expect(parsedTestCaseName.testRailTestCaseId).toEqual('123'); | ||
expect(parsedTestCaseName.applauseTestCaseId).toEqual('456'); | ||
}); | ||
|
||
it('should parse a test case name with test case ids at the end of the test case name', () => { | ||
const testCaseName = 'My Test Case TestRail-123'; | ||
const parsedTestCaseName: ParsedTestCaseName = parseTestCaseName(testCaseName); | ||
expect(parsedTestCaseName.testCaseName).toEqual('My Test Case'); | ||
expect(parsedTestCaseName.testRailTestCaseId).toEqual('123'); | ||
expect(parsedTestCaseName.applauseTestCaseId).toBeUndefined(); | ||
}); | ||
|
||
it('should parse a test case name with test case ids in the middle of the test case name', () => { | ||
const testCaseName = 'My Test Case TestRail-123 Another Test Case'; | ||
const parsedTestCaseName: ParsedTestCaseName = parseTestCaseName(testCaseName); | ||
expect(parsedTestCaseName.testCaseName).toEqual('My Test Case Another Test Case'); | ||
expect(parsedTestCaseName.testRailTestCaseId).toEqual('123'); | ||
expect(parsedTestCaseName.applauseTestCaseId).toBeUndefined(); | ||
}); | ||
}); |