Files
pleno-vue/tests/unit/playwright-pr-mapping.spec.js
T

68 lines
3.2 KiB
JavaScript

import { describe, expect, it } from "vitest";
import { fallbackChangePatterns, sourceMappings } from "../../scripts/playwright-pr-mapping.mjs";
const specsFor = (file) =>
sourceMappings
.filter((mapping) => mapping.patterns.some((pattern) => pattern.test(file)))
.flatMap((mapping) => mapping.specs);
describe("Playwright PR mapping", () => {
const triggersFallback = (file) => fallbackChangePatterns.some((pattern) => pattern.test(file));
it("maps user vehicle table changes to the user vehicles E2E coverage", () => {
expect(specsFor("src/components/displays/user/vehicles/vehiclesTable.vue")).toContain(
"tests/e2e/userVehicles.spec.ts"
);
});
it("maps superuser department pricing changes to custom-only pricing coverage", () => {
expect(specsFor("src/views/dashboards/superUserDashboard/department/DepartmentPricing.vue")).toContain(
"tests/e2e/superuser-department-pricing-custom-only.spec.ts"
);
expect(
specsFor("src/views/dashboards/superUserDashboard/department/SuperUserSelectedDepartmentObject.vue")
).toContain("tests/e2e/superuser-department-pricing-custom-only.spec.ts");
expect(specsFor("src/components/session/token/SessionUser/Objects/Departments.vue")).toContain(
"tests/e2e/superuser-department-pricing-custom-only.spec.ts"
);
expect(specsFor("src/components/session/token/SessionUser/Objects/Departments.vue")).not.toContain(
"tests/e2e/userAuth.spec.ts"
);
});
it("maps department notification table changes to the admin notification E2E coverage", () => {
expect(
specsFor("src/components/displays/department/notifications/departmentNotificationsPhoneTable.vue")
).toContain("tests/e2e/admin-department-notifications.spec.ts");
expect(
specsFor("src/components/displays/pagination/models/DepartmentPos/NotificationsPhonePagination.vue")
).toContain("tests/e2e/admin-department-notifications.spec.ts");
});
it("maps superuser role permission page changes to role permissions E2E coverage", () => {
expect(specsFor("src/views/dashboards/superUserDashboard/roles/SuperUserRolesPermissions.vue")).toContain(
"tests/e2e/superuser-roles-permissions.spec.ts"
);
expect(specsFor("src/views/dashboards/superUserDashboard/roles/rolePermissionCatalog.js")).toContain(
"tests/e2e/superuser-roles-permissions.spec.ts"
);
});
it("keeps PR runner and full-slice metadata edits out of broad PR smoke fallback", () => {
expect(triggersFallback("scripts/run-playwright-pr.mjs")).toBe(false);
expect(triggersFallback("scripts/run-playwright-ci-parallel.mjs")).toBe(true);
expect(triggersFallback("scripts/run-playwright-full-slice.mjs")).toBe(false);
});
it("maps customer product rule changes to POS customer rule E2E coverage", () => {
expect(specsFor("src/features/customer/customerProductRules.js")).toContain("tests/e2e/pos-customer-rules.spec.js");
expect(specsFor("src/components/displays/boxes/ProductBox.vue")).toContain("tests/e2e/pos-customer-rules.spec.js");
});
it("maps limited backoffice changes to the limited backoffice E2E coverage", () => {
expect(specsFor("src/views/backoffice/LimitedBackofficeEmployees.vue")).toContain(
"tests/e2e/limited-backoffice.spec.ts"
);
});
});