File tree 7 files changed +141
-15
lines changed
tests/test-folder/mocha-events
7 files changed +141
-15
lines changed Original file line number Diff line number Diff line change 1
1
## Change Log
2
+ ### 0.16.1
3
+ - [ patch] fixes for isse #88 - fixed describe.only and describe.skip
4
+
2
5
### 0.16.0
3
6
- [ minor] setting to attach screenshots to a steps by options to cy.screeshot command
7
+
4
8
### 0.15.3
5
9
- [ patch] fix moving test attachments during execution for test
10
+
6
11
### 0.15.2
7
12
- [ patch] minor packages updates
13
+
8
14
### 0.15.1
9
15
- [ patch] fix of corner case with custom commands in #75
10
16
Original file line number Diff line number Diff line change
1
+ describe . skip ( 'skipped' , ( ) => {
2
+ beforeEach ( ( ) => {
3
+ cy . log ( 'before each for skipped' ) ;
4
+ } ) ;
5
+
6
+ it ( 'test' , function ( ) {
7
+ cy . log ( 'skipped' ) ;
8
+ } ) ;
9
+
10
+ afterEach ( ( ) => {
11
+ cy . log ( 'after each for skipped' ) ;
12
+ } ) ;
13
+ } ) ;
Original file line number Diff line number Diff line change 118
118
"webpack" : " ^5.89.0"
119
119
},
120
120
"dependencies" : {
121
- "@mmisty/cypress-tags" : " ^1.0.14 " ,
121
+ "@mmisty/cypress-tags" : " ^1.0.15 " ,
122
122
"allure-js-commons" : " ^2.9.2" ,
123
123
"allure-js-parser" : " ^0.0.7" ,
124
124
"debug" : " ^4.3.4" ,
Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ import { parseInlineTags } from '@mmisty/cypress-tags/utils/tags';
3
3
4
4
export const addGherkin = ( ) => {
5
5
const originalDesc = describe ;
6
+ const originalDescSkip = describe . skip ;
7
+ const originalDescOnly = describe . only ;
6
8
7
9
const getTags = ( test : any ) : { tag : string ; info : string } [ ] => {
8
10
// this is tags support for @badeball /cypress-cucumber-preprocessor
@@ -18,15 +20,22 @@ export const addGherkin = () => {
18
20
19
21
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
20
22
// @ts -ignore
21
- ( global as any ) . describe = function ( ... args ) {
23
+ const parseTags = original =>
22
24
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
23
25
// @ts -ignore
24
- const suite : Suite = originalDesc ( ...args ) ;
26
+ function ( ...args ) {
27
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
28
+ // @ts -ignore
29
+ const suite : Suite = original ( ...args ) ;
25
30
26
- suite . eachTest ( ( test : any ) => {
27
- test . tags = getTags ( test ) ;
28
- } ) ;
31
+ suite . eachTest ( ( test : any ) => {
32
+ test . tags = getTags ( test ) ;
33
+ } ) ;
29
34
30
- return suite ;
31
- } ;
35
+ return suite ;
36
+ } ;
37
+
38
+ ( global as any ) . describe = parseTags ( originalDesc ) ;
39
+ ( global as any ) . describe . skip = parseTags ( originalDescSkip ) ;
40
+ ( global as any ) . describe . only = parseTags ( originalDescOnly ) ;
32
41
} ;
Original file line number Diff line number Diff line change
1
+ import { createResTest2 , fixResult } from '../../../cy-helper/utils' ;
2
+ import { parseAllure } from 'allure-js-parser' ;
3
+
4
+ describe ( 'several tests run by describe.only' , ( ) => {
5
+ const res = createResTest2 (
6
+ [
7
+ `
8
+ describe.only('hello suite', () => {
9
+ it('hello test 1', () => {
10
+ cy.log('message');
11
+ });
12
+
13
+ it('hello test 2', () => {
14
+ cy.log('message');
15
+ });
16
+
17
+ it('hello test 3', () => {
18
+ cy.log('message');
19
+ });
20
+
21
+ it('hello test 4', () => {
22
+ cy.log('message');
23
+ });
24
+ });
25
+ ` ,
26
+ ] ,
27
+ { allureAddVideoOnPass : 'true' } ,
28
+ ) ;
29
+
30
+ describe ( 'check results' , ( ) => {
31
+ let resFixed ;
32
+
33
+ beforeAll ( ( ) => {
34
+ const results = parseAllure ( res . watch ) ;
35
+ resFixed = fixResult ( results ) ;
36
+ } ) ;
37
+
38
+ it ( 'check tests count' , async ( ) => {
39
+ expect ( resFixed . length ) . toEqual ( 4 ) ;
40
+ } ) ;
41
+
42
+ it ( 'check results' , async ( ) => {
43
+ expect ( ( res . result . res as any ) ?. totalSkipped ) . toEqual ( 0 ) ;
44
+ expect ( ( res . result . res as any ) ?. totalPending ) . toEqual ( 0 ) ;
45
+ expect ( ( res . result . res as any ) ?. totalPassed ) . toEqual ( 4 ) ;
46
+ expect ( ( res . result . res as any ) ?. totalFailed ) . toEqual ( 0 ) ;
47
+ } ) ;
48
+ } ) ;
49
+ } ) ;
Original file line number Diff line number Diff line change
1
+ import { createResTest2 , fixResult } from '../../../cy-helper/utils' ;
2
+ import { parseAllure } from 'allure-js-parser' ;
3
+
4
+ describe ( 'several tests skipped by describe.skip' , ( ) => {
5
+ const res = createResTest2 (
6
+ [
7
+ `
8
+ describe.skip('hello suite', () => {
9
+ it('hello test 1', () => {
10
+ cy.log('message');
11
+ });
12
+
13
+ it('hello test 2', () => {
14
+ cy.log('message');
15
+ });
16
+
17
+ it('hello test 3', () => {
18
+ cy.log('message');
19
+ });
20
+
21
+ it('hello test 4', () => {
22
+ cy.log('message');
23
+ });
24
+ });
25
+ ` ,
26
+ ] ,
27
+ { allureAddVideoOnPass : 'true' } ,
28
+ ) ;
29
+
30
+ describe ( 'check results' , ( ) => {
31
+ let resFixed ;
32
+
33
+ beforeAll ( ( ) => {
34
+ const results = parseAllure ( res . watch ) ;
35
+ resFixed = fixResult ( results ) ;
36
+ } ) ;
37
+
38
+ it ( 'check tests count' , async ( ) => {
39
+ expect ( resFixed . length ) . toEqual ( 4 ) ;
40
+ } ) ;
41
+
42
+ it ( 'check results' , async ( ) => {
43
+ expect ( ( res . result . res as any ) ?. totalFailed ) . toEqual ( 0 ) ;
44
+ expect ( ( res . result . res as any ) ?. totalPassed ) . toEqual ( 0 ) ;
45
+ expect ( ( res . result . res as any ) ?. totalSkipped ) . toEqual ( 0 ) ;
46
+ expect ( ( res . result . res as any ) ?. totalPending ) . toEqual ( 4 ) ;
47
+ } ) ;
48
+ } ) ;
49
+ } ) ;
You can’t perform that action at this time.
0 commit comments