-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cypress test plan support (via #1037)
- Loading branch information
Showing
6 changed files
with
149 additions
and
19 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
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,83 @@ | ||
import { join } from "node:path"; | ||
import { expect, it } from "vitest"; | ||
import type { TestPlanV1 } from "allure-js-commons/sdk"; | ||
import { runCypressInlineTest } from "../utils.js"; | ||
|
||
it("respects testplan", async () => { | ||
const exampleTestPlan: TestPlanV1 = { | ||
version: "1.0", | ||
tests: [ | ||
{ | ||
id: 1, | ||
selector: "cypress/e2e/nested/super strange nested/super strange name.cy.js#also nested should execute", | ||
}, | ||
{ | ||
id: 2, | ||
selector: "cypress/e2e/b.cy.js#should execute", | ||
}, | ||
{ | ||
id: 3, | ||
selector: "cypress/e2e/.+.cy.js#+.", | ||
}, | ||
{ | ||
id: 4, | ||
selector: "cypress/e2e/notaga.cy.js#a", | ||
}, | ||
], | ||
}; | ||
const testPlanFilename = "example-testplan.json"; | ||
const { tests } = await runCypressInlineTest( | ||
{ | ||
[testPlanFilename]: () => JSON.stringify(exampleTestPlan), | ||
"cypress/e2e/a.test.js": () => ` | ||
it('should not execute', () => { | ||
cy.wrap(1).should("eq", 1); | ||
}); | ||
`, | ||
"cypress/e2e/b.cy.js": () => ` | ||
it('should execute', () => { | ||
cy.wrap(1).should("eq", 1); | ||
}); | ||
`, | ||
"cypress/e2e/nested/super strange nested/super strange name.cy.js": () => ` | ||
describe('also nested', () => { | ||
it('should execute', () => { | ||
cy.wrap(1).should("eq", 1); | ||
}); | ||
}); | ||
`, | ||
"cypress/e2e/.+.cy.js": () => ` | ||
it('+.', () => { | ||
cy.wrap(1).should("eq", 1); | ||
}); | ||
`, | ||
"cypress/e2e/aga.cy.js": () => ` | ||
it('a', () => { | ||
cy.wrap(1).should("eq", 1); | ||
}); | ||
it('aa', () => { | ||
cy.wrap(1).should("eq", 1); | ||
}); | ||
it('selected name @allure.id=5', () => { | ||
cy.wrap(1).should("eq", 1); | ||
}); | ||
`, | ||
"cypress/e2e/notaga.cy.js": () => ` | ||
it('a', () => { | ||
cy.wrap(1).should("eq", 1); | ||
}); | ||
`, | ||
}, | ||
(testDir) => ({ | ||
ALLURE_TESTPLAN_PATH: join(testDir, testPlanFilename), | ||
}), | ||
); | ||
|
||
expect(tests.map(({ fullName }) => fullName)).toEqual( | ||
expect.arrayContaining([ | ||
"cypress/e2e/b.cy.js#should execute", | ||
"cypress/e2e/notaga.cy.js#a", | ||
"cypress/e2e/nested/super strange nested/super strange name.cy.js#also nested should execute", | ||
]), | ||
); | ||
}); |
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