File tree Expand file tree Collapse file tree 9 files changed +81
-10
lines changed Expand file tree Collapse file tree 9 files changed +81
-10
lines changed Original file line number Diff line number Diff line change 24
24
uses : mikepenz/action-junit-report@v4
25
25
if : always()
26
26
with :
27
- report_paths : ' ./test/results.xml'
27
+ report_paths : ' ./test/report/ results.xml'
28
28
fail_on_failure : true
Original file line number Diff line number Diff line change @@ -2,3 +2,4 @@ node_modules/
2
2
adapter /
3
3
playwright-report /
4
4
test-results /
5
+ test /report /
Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
12
12
13
13
## [ 0.3.0]
14
14
- :rocket : added _ defineCucumber_ util function
15
-
15
+ - :rocket : added logic to process duplicates
16
+
16
17
## [ 0.2.0]
17
18
- :rocket : updated fixture implementation
18
19
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ for (const feature of features) {
31
31
test . beforeEach ( world . init ) ;
32
32
33
33
for ( const testCase of tests ) {
34
- const tag = testCase . tags . map ( tag => tag . name ) ;
34
+ const tag = testCase . tags . map ( ( tag : { name : string } ) => tag . name ) ;
35
35
test ( testCase . name , { tag } , async ( ) => {
36
36
for ( const beforeHook of supportCodeLibrary . beforeTestCaseHookDefinitions ) {
37
37
if ( beforeHook . appliesToTestCase ( testCase ) ) {
Original file line number Diff line number Diff line change @@ -11,14 +11,29 @@ const builder = new AstBuilder(uuidFn)
11
11
const matcher = new GherkinClassicTokenMatcher ( ) ;
12
12
const parser = new Parser ( builder , matcher )
13
13
14
+ function duplicates ( tests : any [ ] ) {
15
+ const counts : Record < string , number > = { } ;
16
+ return tests . map ( item => {
17
+ const name = item . name ;
18
+ if ( ! counts [ name ] ) {
19
+ counts [ name ] = 0 ;
20
+ }
21
+ if ( counts [ name ] ) {
22
+ item . name = `${ item . name } #${ counts [ item . name ] + 1 } ` ;
23
+ }
24
+ counts [ item . name ] ++ ;
25
+ return item ;
26
+ } )
27
+ }
28
+
14
29
export function loadFeatures ( globPattern : string [ ] ) {
15
30
const files = globSync ( globPattern ) ;
16
31
return files . map ( file => {
17
32
const filePath = resolve ( file ) ;
18
33
const gherkinDocument = parser . parse ( readFileSync ( filePath , 'utf-8' ) ) ;
19
34
return {
20
35
feature : gherkinDocument . feature ?. name ,
21
- tests : compile ( gherkinDocument , file , uuidFn )
36
+ tests : duplicates ( compile ( gherkinDocument , file , uuidFn ) as any )
22
37
}
23
38
} ) ;
24
39
}
Original file line number Diff line number Diff line change @@ -31,3 +31,9 @@ Feature: test feature
31
31
32
32
Scenario : attach
33
33
Given attach
34
+
35
+ Scenario : duplicate
36
+ Given log
37
+
38
+ Scenario : duplicate
39
+ Given log
Original file line number Diff line number Diff line change
1
+ Feature : test feature 2
2
+
3
+ Background :
4
+ Given simple step
5
+
6
+ Scenario : simple scenario
7
+ Given open 'https://google.com' url
8
+
9
+ Scenario Outline : simple scenario <example>
10
+ Given open '<example>' url
11
+
12
+ Examples :
13
+ | example |
14
+ | https ://www .wikipedia .org / |
15
+ | https ://www .saucedemo .com / |
16
+
17
+ Scenario : data table
18
+ Given data table step
19
+ | 1 |
20
+ | 2 |
21
+
22
+ Scenario : multiline
23
+ Given multiline step
24
+ """
25
+ first
26
+ second
27
+ """
28
+
29
+ Scenario : log
30
+ Given log
31
+
32
+ Scenario : attach
33
+ Given attach
34
+
35
+ Scenario : duplicate
36
+ Given log
37
+
38
+ Scenario : duplicate
39
+ Given log
Original file line number Diff line number Diff line change 1
- import { defineConfig , devices } from '@playwright/test' ;
2
- import { resolve } from 'node:path' ;
1
+ import { defineConfig , devices } from '@playwright/test' ;
2
+ import { resolve } from 'node:path' ;
3
+ import { defineCucumber } from '../src/defineCucumber' ;
3
4
4
- process . env . CONFIG = 'test/cucumber.ts' ;
5
- process . env . PROFILE = 'default' ;
5
+ defineCucumber ( {
6
+ config : 'test/cucumber.ts' ,
7
+ profile : 'default'
8
+ } ) ;
6
9
7
10
/**
8
11
* Read environment variables from file.
@@ -24,7 +27,10 @@ export default defineConfig({
24
27
/* Opt out of parallel tests on CI. */
25
28
workers : process . env . CI ? 1 : undefined ,
26
29
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
27
- reporter : [ [ 'junit' , { outputFile : 'results.xml' } ] ] ,
30
+ reporter : [
31
+ [ 'html' , { outputFolder : 'report' } ] ,
32
+ [ 'junit' , { outputFile : 'report/report.xml' } ]
33
+ ] ,
28
34
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
29
35
use : {
30
36
/* Base URL to use in actions like `await page.goto('/')`. */
Original file line number Diff line number Diff line change @@ -21,7 +21,10 @@ export default defineConfig({
21
21
/* Opt out of parallel tests on CI. */
22
22
workers : process . env . CI ? 1 : 1 ,
23
23
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
24
- reporter : 'html' ,
24
+ reporter : [
25
+ [ 'html' , { outputFolder : 'report' } ] ,
26
+ [ 'junit' , { outputFile : 'report/report.xml' } ]
27
+ ] ,
25
28
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
26
29
use : {
27
30
/* Base URL to use in actions like `await page.goto('/')`. */
You can’t perform that action at this time.
0 commit comments