Skip to content

Commit 7ca113d

Browse files
committed
add tests for missing attachments
1 parent dc4955a commit 7ca113d

2 files changed

Lines changed: 58 additions & 1 deletion

File tree

packages/e2e/test/allure-awesome/features/attachments.test.ts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,63 @@ test.describe("attachments", () => {
2424
await bootstrap?.shutdown?.();
2525
});
2626

27+
test.describe("commons", () => {
28+
test.beforeEach(async ({ page }) => {
29+
bootstrap = await bootstrapReport({
30+
reportConfig: {
31+
name: "Allure report with attachments",
32+
appendHistory: true,
33+
history: [],
34+
historyPath: "history.jsonl",
35+
knownIssuesPath: undefined,
36+
},
37+
testResults: [
38+
{
39+
name: "foo",
40+
fullName: "sample.test.js#test with image attachment",
41+
historyId: "",
42+
status: Status.PASSED,
43+
stage: Stage.FINISHED,
44+
start: Date.now(),
45+
stop: Date.now() + 1000,
46+
steps: [
47+
{
48+
name: "bar",
49+
status: Status.PASSED,
50+
stage: Stage.FINISHED,
51+
parameters: [],
52+
steps: [],
53+
statusDetails: {},
54+
attachments: [
55+
{
56+
source: "attachment.txt",
57+
type: "text/plain",
58+
name: "attachment",
59+
},
60+
],
61+
},
62+
],
63+
},
64+
],
65+
attachments: [],
66+
});
67+
68+
await page.goto(bootstrap.url);
69+
});
70+
71+
test('should render "missed" label for attachments which don\'t exist', async ({ page }) => {
72+
await treePage.clickNthLeaf(0);
73+
await testResultPage.toggleStepByTitle("bar");
74+
75+
await expect(testResultPage.testResultAttachmentLocator).toHaveCount(1);
76+
await expect(
77+
testResultPage.testResultAttachmentLocator.nth(0).getByTestId("test-result-attachment-missed"),
78+
).toBeVisible();
79+
80+
await testResultPage.screenshot();
81+
});
82+
});
83+
2784
test.describe("text attachment", () => {
2885
test.beforeEach(async ({ page }) => {
2986
bootstrap = await bootstrapReport({

packages/web-awesome/src/components/TestResult/TrSteps/TrAttachment.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export const TrAttachment: FunctionComponent<{
6060
</Code>
6161
<Text className={styles["test-result-attachment-text"]}>{link.name || link.originalFileName}</Text>
6262
{missed && (
63-
<Text size={"s"} className={styles["test-result-attachment-missed"]}>
63+
<Text size={"s"} className={styles["test-result-attachment-missed"]} data-testid={"test-result-attachment-missed"}>
6464
missed
6565
</Text>
6666
)}

0 commit comments

Comments
 (0)