Skip to content

Commit 53ec505

Browse files
authored
fix problem with trees caching (via #202)
1 parent 14c0bed commit 53ec505

32 files changed

Lines changed: 143 additions & 38 deletions

File tree

.pnp.cjs

Lines changed: 38 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.

packages/e2e/test/allure-awesome/test/tree.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ test.describe("commons", () => {
7979
});
8080
});
8181

82-
test("all types of tests are displayed", async () => {
82+
test("all types of tests are displayed", async ({ page }) => {
8383
await expect(treePage.leafLocator).toHaveCount(5);
8484

8585
await expect(treePage.getNthLeafTitleLocator(0)).toHaveText("0 sample passed test");

packages/e2e/test/utils/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { AllureReport, FileSystemReportFiles, type FullConfig } from "@allurerep
22
import { md5 } from "@allurereport/plugin-api";
33
import AwesomePlugin from "@allurereport/plugin-awesome";
44
import { serve } from "@allurereport/static-server";
5-
import type { Attachment, TestResult } from "allure-js-commons";
5+
import type { TestResult } from "allure-js-commons";
66
import { FileSystemWriter, ReporterRuntime } from "allure-js-commons/sdk/reporter";
77
import { mkdtemp, rm, writeFile } from "node:fs/promises";
88
import { tmpdir } from "node:os";

packages/plugin-awesome/src/generators.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,14 +363,16 @@ export const generateStaticFiles = async (
363363
bodyTags.push(createScriptTag(`data:text/javascript;base64,${mainJsContentBuffer.toString("base64")}`));
364364
}
365365

366+
const now = Date.now();
366367
const reportOptions: AwesomeReportOptions = {
367368
reportName,
368369
logo,
369370
theme,
370371
reportLanguage,
371-
createdAt: Date.now(),
372+
createdAt: now,
372373
reportUuid,
373374
groupBy: groupBy?.length ? groupBy : ["parentSuite", "suite", "subSuite"],
375+
cacheKey: now.toString(),
374376
layout,
375377
allureVersion,
376378
sections,

packages/plugin-classic/src/generators.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,15 +313,17 @@ export const generateStaticFiles = async (
313313
bodyTags.push(createScriptTag(`data:text/javascript;base64,${mainJsContentBuffer.toString("base64")}`));
314314
}
315315

316+
const now = Date.now();
316317
const reportOptions: AwesomeReportOptions = {
317318
reportName,
318319
logo,
319320
theme,
320321
reportLanguage,
321-
createdAt: Date.now(),
322+
createdAt: now,
322323
reportUuid,
323324
groupBy: groupBy?.length ? groupBy : ["parentSuite", "suite", "subSuite"],
324325
allureVersion,
326+
cacheKey: now.toString(),
325327
};
326328
const html = compile({
327329
headTags: headTags.join("\n"),

packages/static-server/test/unit/static.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,13 @@ it("serves .bin files", async () => {
3737
expect(res.headers["content-type"]).toBe("application/octet-stream");
3838
expect(res.data).not.toBeUndefined();
3939
});
40+
41+
it("serves files with query parameters", async () => {
42+
server = await serve({ port, servePath });
43+
const res = await axios.get(`http://localhost:${port}/sample?attachment`, {
44+
timeout: 100,
45+
});
46+
47+
expect(res.headers["content-type"]).toBe("application/octet-stream");
48+
expect(res.data).not.toBeUndefined();
49+
});

packages/web-awesome/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
"split.js": "^1.6.5",
9797
"style-loader": "^4.0.0",
9898
"svg-sprite-loader": "^6.0.11",
99+
"terser-webpack-plugin": "^5.3.14",
99100
"typescript": "^5.6.3",
100101
"typescript-eslint": "^8.6.0",
101102
"vitest": "^2.1.8",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { AttachmentTestStepResult } from "@allurereport/core-api";
22
import { attachmentType } from "@allurereport/web-commons";
33
import { ArrowButton, Attachment, Code, SvgIcon, Text, allureIcons } from "@allurereport/web-components";
4-
import type { FunctionComponent } from "preact";
54
import cx from "clsx";
5+
import type { FunctionComponent } from "preact";
66
import { useState } from "preact/hooks";
77
import { TrAttachmentInfo } from "@/components/TestResult/TrSteps/TrAttachmentInfo";
88
import * as styles from "@/components/TestResult/TrSteps/styles.scss";

packages/web-awesome/src/locales/de.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,5 +155,4 @@
155155
"title": "Testerfolgsrate"
156156
}
157157
}
158-
159158
}

0 commit comments

Comments
 (0)