mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix(e2e,landing): robust path escaping (CodeQL) + unique file-tools card
- tests/e2e/helpers.ts: build the sharp script path via JSON.stringify instead of single-quote-only replace (CodeQL js/incomplete-sanitization, high: backslashes were not escaped). Proper fix, no suppression. - landing CategoryCards: rename the file-modality marketing card to "File Tools" (matches the Image/Video/Audio Tools siblings and is unique vs the 23 "Files" tool pills, which broke the e2e locator). Modality label stays "Files" everywhere it is the actual modality.
This commit is contained in:
@@ -51,7 +51,7 @@ const MODALITIES = [
|
||||
{
|
||||
id: "file",
|
||||
section: "files",
|
||||
label: "Files",
|
||||
label: "File Tools",
|
||||
blurb: "Convert and transform",
|
||||
icon: "Database",
|
||||
color: "#5C8642",
|
||||
|
||||
@@ -40,7 +40,7 @@ test.describe("Landing Homepage", () => {
|
||||
});
|
||||
|
||||
test("hero modality cards render", async ({ page }) => {
|
||||
const cards = ["Image Tools", "Video Tools", "Audio Tools", "PDF & Documents", "Files"];
|
||||
const cards = ["Image Tools", "Video Tools", "Audio Tools", "PDF & Documents", "File Tools"];
|
||||
for (const card of cards) {
|
||||
await expect(page.getByText(card, { exact: true }).first()).toBeVisible();
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ export function getTestImagePath(): string {
|
||||
try {
|
||||
const script = [
|
||||
"const sharp = require('sharp');",
|
||||
`sharp({create:{width:100,height:100,channels:4,background:{r:255,g:0,b:0,alpha:1}}}).png().toFile('${_testImagePath.replace(/'/g, "\\'")}')`,
|
||||
`sharp({create:{width:100,height:100,channels:4,background:{r:255,g:0,b:0,alpha:1}}}).png().toFile(${JSON.stringify(_testImagePath)})`,
|
||||
].join(" ");
|
||||
execFileSync("node", ["-e", script], {
|
||||
cwd: process.cwd(),
|
||||
|
||||
Reference in New Issue
Block a user