Skip to content

Commit f0e131f

Browse files
authored
[patch] fixes of custom commands (#75)
1 parent b50239a commit f0e131f

File tree

5 files changed

+55
-8
lines changed

5 files changed

+55
-8
lines changed

CHANGELOG.md

+18
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
11
## Change Log
2+
### 0.15.0
3+
- [minor] Add historyId to interface in #74
4+
5+
### 0.14.3
6+
- [patch] small defect fixes in #73
7+
8+
### 0.14.2
9+
- [patch] fix tags showing in #70
10+
11+
### 0.14.1
12+
- [patch] Fix before after for gherkin in #67
13+
14+
### 0.14.0
15+
- [minor] Gherkin support in #49
16+
17+
### 0.13.0
18+
- [patch] fix tags integration in #63
19+
220
### 0.12.5
321
- special tags integration - can use `@issue("ABC-123")`(and other meta tags like parentSuite, suite etc)
422
in title or in configuration object like

integration/e2e/commands/do-sync-command.cy.ts

+12
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,17 @@ describe('suite', () => {
6969
.eq(1)
7070
.should('have.text', 'My link 3');
7171
});
72+
73+
it('file exists true', () => {
74+
cy.fileExists(Cypress.spec.absolute).then(exists => {
75+
expect(exists).eq(true);
76+
});
77+
});
78+
79+
it('file exists false', () => {
80+
cy.fileExists(`${Cypress.spec.absolute}/123`).then(exists => {
81+
expect(exists).eq(false);
82+
});
83+
});
7284
});
7385
});

integration/e2e/interface.test.ts

+10
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,14 @@ describe('interface', () => {
4242
cy.allure().issue('PROJ-02', 'Description of issue');
4343
cy.allure().issue('PROJ-04');
4444
});
45+
46+
it('test with param', () => {
47+
cy.allure().parameter('A', 'valueA');
48+
cy.allure().historyId('valueA');
49+
});
50+
51+
it('test with param', () => {
52+
cy.allure().parameter('A', 'valueB');
53+
cy.allure().historyId('valueB');
54+
});
4555
});

src/commands/index.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,7 @@ export const registerCommands = () => {
9393
// const queue = () => (cy as any).queue.queueables;
9494
// const commandsCount = queue().length;
9595
// eslint-disable-next-line @typescript-eslint/no-explicit-any
96-
const subj = getLastSubject((cy as any).state('current'));
97-
let prevSubj = undefined;
98-
99-
if (subj) {
100-
prevSubj = subj;
101-
}
96+
const prevSubj = getLastSubject((cy as any).state('current'));
10297

10398
syncFn(prevSubj);
10499

tests/test-folder/mocha-events/commands/do-sync-command.test.ts

+14-2
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,18 @@ describe('do sync command', () => {
7878
}).eq(1).should('have.text', 'My link 3');
7979
});
8080
81+
it('file exists true', () => {
82+
cy.fileExists(Cypress.spec.absolute).then(exists => {
83+
expect(exists).eq(true);
84+
});
85+
});
86+
87+
it('file exists false', () => {
88+
cy.fileExists(Cypress.spec.absolute +'/123').then(exists => {
89+
expect(exists).eq(false);
90+
});
91+
});
92+
8193
8294
});
8395
`,
@@ -91,12 +103,12 @@ describe('do sync command', () => {
91103
it('should have results', () => {
92104
// should not fail run
93105
checkCyResults(res?.result?.res, {
94-
totalPassed: 6,
106+
totalPassed: 8,
95107
totalFailed: 0,
96108
totalPending: 0,
97109
totalSkipped: 0,
98110
totalSuites: 1,
99-
totalTests: 6,
111+
totalTests: 8,
100112
});
101113
});
102114
beforeAll(() => {

0 commit comments

Comments
 (0)