Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
test(SKY-11847): matrix extraction-cache identity tests (80→33, coverage-identical) (#7116)
Suchintaneeec9f38b98d
diff --git a/skyvern-frontend/src/components/ui/css-vars.test.ts b/skyvern-frontend/src/components/ui/css-vars.test.tsindex d5b2e3f2b..f4c689bbd 100644--- a/skyvern-frontend/src/components/ui/css-vars.test.ts+++ b/skyvern-frontend/src/components/ui/css-vars.test.ts@@ -55,89 +55,37 @@ function blockBetween(css: string, openSelector: string): string {return "";}+const REQUIRED_TOKEN_CASES = [+ ["--input", ":root"],+ ["--ring", ":root"],+ ["--input", ".dark"],+ ["--ring", ".dark"],+ ["--success", ":root"],+ ["--success-foreground", ":root"],+ ["--warning", ":root"],+ ["--warning-foreground", ":root"],+ ["--tertiary", ":root"],+ ["--tertiary-foreground", ":root"],+ ["--cta", ":root"],+ ["--cta-hover", ":root"],+ ["--cta-foreground", ":root"],+ ["--success", ".dark"],+ ["--warning", ".dark"],+ ["--tertiary", ".dark"],+ ["--tertiary-foreground", ".dark"],+ ["--cta", ".dark"],+ ["--cta-hover", ".dark"],+ ["--cta-foreground", ".dark"],+] as const;+describe.each(CSS_FILES)("%s defines DS token vars", (file) => {const css = load(file);const root = blockBetween(css, ":root");const dark = blockBetween(css, ".dark");- it("defines --input under :root", () => {- expect(root).toMatch(/--input:\s*[^;]+;/);- });-- it("defines --ring under :root", () => {- expect(root).toMatch(/--ring:\s*[^;]+;/);- });-- it("defines --input under .dark", () => {- expect(dark).toMatch(/--input:\s*[^;]+;/);- });-- it("defines --ring under .dark", () => {- expect(dark).toMatch(/--ring:\s*[^;]+;/);- });-- it("defines --success under :root", () => {- expect(root).toMatch(/--success:\s*[^;]+;/);- });-- it("defines --success-foreground under :root", () => {- expect(root).toMatch(/--success-foreground:\s*[^;]+;/);- });-- it("defines --warning under :root", () => {- expect(root).toMatch(/--warning:\s*[^;]+;/);- });-- it("defines --warning-foreground under :root", () => {- expect(root).toMatch(/--warning-foreground:\s*[^;]+;/);- });-- it("defines --tertiary under :root", () => {- expect(root).toMatch(/--tertiary:\s*[^;]+;/);- });-- it("defines --tertiary-foreground under :root", () => {- expect(root).toMatch(/--tertiary-foreground:\s*[^;]+;/);- });-- it("defines --cta under :root", () => {- expect(root).toMatch(/--cta:\s*[^;]+;/);- });-- it("defines --cta-hover under :root", () => {- expect(root).toMatch(/--cta-hover:\s*[^;]+;/);- });-- it("defines --cta-foreground under :root", () => {- expect(root).toMatch(/--cta-foreground:\s*[^;]+;/);- });-- it("defines --success under .dark", () => {- expect(dark).toMatch(/--success:\s*[^;]+;/);- });-- it("defines --warning under .dark", () => {- expect(dark).toMatch(/--warning:\s*[^;]+;/);- });-- it("defines --tertiary under .dark", () => {- expect(dark).toMatch(/--tertiary:\s*[^;]+;/);- });-- it("defines --tertiary-foreground under .dark", () => {- expect(dark).toMatch(/--tertiary-foreground:\s*[^;]+;/);- });-- it("defines --cta under .dark", () => {- expect(dark).toMatch(/--cta:\s*[^;]+;/);- });-- it("defines --cta-hover under .dark", () => {- expect(dark).toMatch(/--cta-hover:\s*[^;]+;/);- });-- it("defines --cta-foreground under .dark", () => {- expect(dark).toMatch(/--cta-foreground:\s*[^;]+;/);+ it.each(REQUIRED_TOKEN_CASES)("defines %s under %s", (token, selector) => {+ const block = selector === ":root" ? root : dark;+ expect(block).toMatch(new RegExp(`${token}:\\s*[^;]+;`));});});@@ -153,29 +101,19 @@ describe("shared semantic tokens are consistent across cloud/eval/src", () => {expect(new Set(values).size).toBe(1);}- it("light-mode --ring is the same value in all 3 entrypoints", () => {- expectConsistentToken("--ring", ":root");- });-- it("dark-mode --ring is the same value in all 3 entrypoints", () => {- expectConsistentToken("--ring", ".dark");- });-- it("light-mode --cta is the same value in all 3 entrypoints", () => {- expectConsistentToken("--cta", ":root");- });-- it("light-mode --cta-hover is the same value in all 3 entrypoints", () => {- expectConsistentToken("--cta-hover", ":root");- });-- it("dark-mode --cta is the same value in all 3 entrypoints", () => {- expectConsistentToken("--cta", ".dark");- });-- it("dark-mode --cta-hover is the same value in all 3 entrypoints", () => {- expectConsistentToken("--cta-hover", ".dark");- });+ it.each([+ ["light-mode --ring", "--ring", ":root"],+ ["dark-mode --ring", "--ring", ".dark"],+ ["light-mode --cta", "--cta", ":root"],+ ["light-mode --cta-hover", "--cta-hover", ":root"],+ ["dark-mode --cta", "--cta", ".dark"],+ ["dark-mode --cta-hover", "--cta-hover", ".dark"],+ ] as const)(+ "%s is the same value in all 3 entrypoints",+ (_, token, selector) => {+ expectConsistentToken(token, selector);+ },+ );});// The primary CTA must track the DS --primary token, not an independent@@ -191,27 +129,24 @@ describe("--cta tracks the DS --primary (SKY-10608)", () => {describe.each(CSS_FILES)("%s", (file) => {const css = load(file);- it("light-mode --cta equals --primary", () => {- expect(tokenValue(css, ":root", "--cta")).toBe(- tokenValue(css, ":root", "--primary"),- );- });-- it("dark-mode --cta equals --primary", () => {- expect(tokenValue(css, ".dark", "--cta")).toBe(- tokenValue(css, ".dark", "--primary"),- );- });-- it("light-mode --cta-foreground equals --primary-foreground", () => {- expect(tokenValue(css, ":root", "--cta-foreground")).toBe(- tokenValue(css, ":root", "--primary-foreground"),- );- });-- it("dark-mode --cta-foreground equals --primary-foreground", () => {- expect(tokenValue(css, ".dark", "--cta-foreground")).toBe(- tokenValue(css, ".dark", "--primary-foreground"),+ it.each([+ ["light-mode --cta equals --primary", ":root", "--cta", "--primary"],+ ["dark-mode --cta equals --primary", ".dark", "--cta", "--primary"],+ [+ "light-mode --cta-foreground equals --primary-foreground",+ ":root",+ "--cta-foreground",+ "--primary-foreground",+ ],+ [+ "dark-mode --cta-foreground equals --primary-foreground",+ ".dark",+ "--cta-foreground",+ "--primary-foreground",+ ],+ ] as const)("%s", (_, selector, ctaToken, primaryToken) => {+ expect(tokenValue(css, selector, ctaToken)).toBe(+ tokenValue(css, selector, primaryToken),);});});diff --git a/skyvern-frontend/src/routes/workflows/types/tagTypes.test.ts b/skyvern-frontend/src/routes/workflows/types/tagTypes.test.tsindex 70a8b94b9..539fb3520 100644--- a/skyvern-frontend/src/routes/workflows/types/tagTypes.test.ts+++ b/skyvern-frontend/src/routes/workflows/types/tagTypes.test.ts@@ -17,60 +17,62 @@ import {} from "./tagTypes";describe("parseTagInput", () => {- it("parses a bare label as a standalone tag", () => {- expect(parseTagInput("production")).toEqual({- key: null,- value: "production",- });- });-- it("splits group:label on the first colon, keeping later colons in the value", () => {- expect(parseTagInput("env:prod")).toEqual({ key: "env", value: "prod" });- expect(parseTagInput("url:http://x:8000")).toEqual({- key: "url",- value: "http://x:8000",- });- });-- it("trims surrounding whitespace", () => {- expect(parseTagInput(" env : prod ")).toEqual({- key: "env",- value: "prod",- });+ it.each([+ [+ "parses a bare label as a standalone tag",+ [["production", { key: null, value: "production" }]],+ ],+ [+ "splits group:label on the first colon, keeping later colons in the value",+ [+ ["env:prod", { key: "env", value: "prod" }],+ ["url:http://x:8000", { key: "url", value: "http://x:8000" }],+ ],+ ],+ [+ "trims surrounding whitespace",+ [[" env : prod ", { key: "env", value: "prod" }]],+ ],+ ] as const)("%s", (_, cases) => {+ for (const [raw, expected] of cases) {+ expect(parseTagInput(raw)).toEqual(expected);+ }});it("returns null for empty or partial input", () => {- expect(parseTagInput("")).toBeNull();- expect(parseTagInput(" ")).toBeNull();- expect(parseTagInput("env:")).toBeNull();- expect(parseTagInput(":prod")).toBeNull();+ for (const raw of ["", " ", "env:", ":prod"]) {+ expect(parseTagInput(raw)).toBeNull();+ }});});describe("parseTagFilterTerm", () => {it("parses the three term shapes", () => {- expect(parseTagFilterTerm("prod")).toEqual({ key: null, value: "prod" });- expect(parseTagFilterTerm("env:*")).toEqual({ key: "env", value: null });- expect(parseTagFilterTerm("env:prod")).toEqual({- key: "env",- value: "prod",- });+ for (const [raw, expected] of [+ ["prod", { key: null, value: "prod" }],+ ["env:*", { key: "env", value: null }],+ ["env:prod", { key: "env", value: "prod" }],+ ] as const) {+ expect(parseTagFilterTerm(raw)).toEqual(expected);+ }});it("returns null for malformed terms", () => {- expect(parseTagFilterTerm("")).toBeNull();- expect(parseTagFilterTerm(":prod")).toBeNull();- expect(parseTagFilterTerm("env:")).toBeNull();+ for (const raw of ["", ":prod", "env:"]) {+ expect(parseTagFilterTerm(raw)).toBeNull();+ }});});describe("serializeTagFilterTerm", () => {it("serializes each shape", () => {- expect(serializeTagFilterTerm({ key: null, value: "prod" })).toBe("prod");- expect(serializeTagFilterTerm({ key: "env", value: null })).toBe("env:*");- expect(serializeTagFilterTerm({ key: "env", value: "prod" })).toBe(- "env:prod",- );+ for (const [term, expected] of [+ [{ key: null, value: "prod" }, "prod"],+ [{ key: "env", value: null }, "env:*"],+ [{ key: "env", value: "prod" }, "env:prod"],+ ] as const) {+ expect(serializeTagFilterTerm(term)).toBe(expected);+ }});});@@ -122,8 +124,9 @@ describe("parseTagFilter", () => {});it("returns [] for empty input", () => {- expect(parseTagFilter(null)).toEqual([]);- expect(parseTagFilter("")).toEqual([]);+ for (const raw of [null, ""]) {+ expect(parseTagFilter(raw)).toEqual([]);+ }});});@@ -201,32 +204,40 @@ describe("tagElementKey", () => {});describe("parseTypedTagQuery", () => {- it("returns a null key for a bare query", () => {- expect(parseTypedTagQuery("prod")).toEqual({- typedKey: null,- typedValuePartial: "",- });- });-- it("splits group:partial and lowercases the value fragment", () => {- expect(parseTypedTagQuery("env:PR")).toEqual({- typedKey: "env",- typedValuePartial: "pr",- });- });-- it("treats a leading colon as no group", () => {- expect(parseTypedTagQuery(":prod")).toEqual({- typedKey: null,- typedValuePartial: "",- });+ it.each([+ [+ "returns a null key for a bare query",+ "prod",+ { typedKey: null, typedValuePartial: "" },+ ],+ [+ "splits group:partial and lowercases the value fragment",+ "env:PR",+ { typedKey: "env", typedValuePartial: "pr" },+ ],+ [+ "treats a leading colon as no group",+ ":prod",+ { typedKey: null, typedValuePartial: "" },+ ],+ ] as const)("%s", (_, raw, expected) => {+ expect(parseTypedTagQuery(raw)).toEqual(expected);});});describe("tag validation", () => {it("rejects a colon in a standalone label but allows it in a grouped value", () => {- expect(validateTagValue("a:b", { hasKey: false })).not.toBeNull();- expect(validateTagValue("a:b", { hasKey: true })).toBeNull();+ for (const [hasKey, expected] of [+ [false, "invalid"],+ [true, "valid"],+ ] as const) {+ const result = validateTagValue("a:b", { hasKey });+ if (expected === "valid") {+ expect(result).toBeNull();+ } else {+ expect(result).not.toBeNull();+ }+ }});it("rejects a grouped value of exactly the wildcard", () => {@@ -234,8 +245,9 @@ describe("tag validation", () => {});it("rejects an empty key and the reserved prefix", () => {- expect(validateTagKey("")).not.toBeNull();- expect(validateTagKey("skyvern.foo")).not.toBeNull();+ for (const key of ["", "skyvern.foo"]) {+ expect(validateTagKey(key)).not.toBeNull();+ }expect(validateTagKey("env")).toBeNull();});});