-
Notifications
You must be signed in to change notification settings - Fork 127
Expand file tree
/
Copy pathtestplan.test.ts
More file actions
66 lines (63 loc) · 1.97 KB
/
testplan.test.ts
File metadata and controls
66 lines (63 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import { expect, it } from "vitest";
import { Stage, Status } from "allure-js-commons";
import type { TestPlanV1 } from "allure-js-commons/sdk";
import { runCodeceptJsInlineTest } from "../utils.js";
it("should support test plan", async () => {
const exampleTestPlan: TestPlanV1 = {
version: "1.0",
tests: [
{
id: 321,
selector: "invalid",
},
{
selector: "dummy:nested/login.test.js: login-feature > login-scenario1",
},
{
selector: "dummy:logout.test.js: logout-feature > logout-scenario1",
},
],
};
const testPlanFilename = "example-testplan.json";
const { tests } = await runCodeceptJsInlineTest(
{
"nested/login.test.js": `
Feature("login-feature");
Scenario("login-scenario1", async () => {});
Scenario("login-scenario2", async () => {});
Scenario("login-scenario3", async () => {}).tag("@allure.id:321");
`,
"logout.test.js": `
Feature("logout-feature");
Scenario("logout-scenario1", async () => {});
Scenario("logout-scenario2", async () => {});
`,
[testPlanFilename]: `${JSON.stringify(exampleTestPlan)}`,
},
{
env: { ALLURE_TESTPLAN_PATH: `./${testPlanFilename}` },
},
);
expect(tests).toHaveLength(3);
expect(tests).toEqual(
expect.arrayContaining([
expect.objectContaining({
status: Status.PASSED,
name: "logout-scenario1",
fullName: "dummy:logout.test.js: logout-feature > logout-scenario1",
}),
expect.objectContaining({
status: Status.PASSED,
stage: Stage.FINISHED,
name: "login-scenario1",
fullName: "dummy:nested/login.test.js: login-feature > login-scenario1",
}),
expect.objectContaining({
status: Status.PASSED,
stage: Stage.FINISHED,
name: "login-scenario3",
fullName: "dummy:nested/login.test.js: login-feature > login-scenario3 @allure.id:321",
}),
]),
);
});