generated from mmisty/cypress-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[patch] fixed synchronous logs addition plus added tests for assertio…
…ns (#164)
- Loading branch information
Showing
29 changed files
with
1,012 additions
and
70 deletions.
There are no files selected for viewing
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
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
18 changes: 18 additions & 0 deletions
18
tests/test-folder/mocha-events/assertions/assertions.test.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,18 @@ | ||
import { | ||
createResTest2, | ||
generateChecksTests, | ||
selectTestsToRun, | ||
} from '@test-utils'; | ||
import { basename } from 'path'; | ||
|
||
describe(`suite: ${basename(__dirname)}`, () => { | ||
const testsForOneCyRun = selectTestsToRun(__dirname); | ||
|
||
const res = createResTest2( | ||
testsForOneCyRun.map(x => x.spec), | ||
// video false to speedup | ||
{ allureAddVideoOnPass: 'false', video: 'false' /* DEBUG: 'true'*/ }, | ||
); | ||
|
||
generateChecksTests(res, testsForOneCyRun); | ||
}); |
87 changes: 87 additions & 0 deletions
87
tests/test-folder/mocha-events/assertions/data-assertions-one-failed-for-command.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,87 @@ | ||
import { TestData } from '@test-utils'; | ||
import { basename } from 'path'; | ||
import { visitHtmlCode } from './visit-html'; | ||
|
||
const rootSuite = `${basename(__filename)}`; | ||
|
||
const data: TestData = { | ||
name: rootSuite, | ||
rootSuite, | ||
fileName: __filename, | ||
spec: ` | ||
describe('${rootSuite}', { defaultCommandTimeout: 300 },() => { | ||
${visitHtmlCode} | ||
it('test 1', () => { | ||
cy.get('[data-test-id="item"]').should('contain', 'NonExistent'); | ||
}); | ||
}); | ||
`, | ||
|
||
expect: { | ||
testsNames: [`${rootSuite} test 1`], | ||
|
||
testStatuses: [ | ||
{ | ||
testName: 'test 1', | ||
index: 0, | ||
status: 'failed', | ||
statusDetails: { | ||
message: [ | ||
"Timed out retrying after 300ms: expected '[ <div>, 4 more... ]' to contain 'NonExistent'", | ||
], | ||
}, | ||
}, | ||
], | ||
|
||
testAttachments: [ | ||
{ | ||
expectMessage: 'should have no attachments', | ||
testName: 'test 1', | ||
index: 0, | ||
attachments: [ | ||
{ | ||
name: 'data-assertions-one-failed-for-command.ts -- test 1 (failed).png', | ||
source: 'source.png', | ||
type: 'image/png', | ||
}, | ||
], | ||
}, | ||
], | ||
|
||
testSteps: [ | ||
{ | ||
testName: 'test 1', | ||
index: 0, | ||
mapStep: m => ({ | ||
status: m.status, | ||
attachments: m.attachments, | ||
statusDetails: m.statusDetails, | ||
}), | ||
filterStep: m => | ||
['before each', 'after each'].every( | ||
x => m.name && m.name.indexOf(x) === -1, | ||
), | ||
expected: [ | ||
{ | ||
attachments: [], | ||
name: 'get: [data-test-id="item"]', | ||
status: 'failed', | ||
statusDetails: {}, | ||
steps: [ | ||
{ | ||
attachments: [], | ||
name: 'assert: expected **[ <div>, 4 more... ]** to contain **NonExistent**', | ||
status: 'failed', | ||
statusDetails: {}, | ||
steps: [], | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}; | ||
|
||
export default data; |
Oops, something went wrong.