chore: update app version and enhance UI components

- Bumped NEXT_PUBLIC_APP_VERSION to 2.0.3 for the latest release.
- Improved Cypress test for customer feedback page to handle delayed route transitions.
- Refactored CompanyDetailsPage to enhance layout and added new components for better structure.
- Updated TenderDetails to conditionally render location and currency information based on validity checks.
- Added data-cy attributes to various form elements and tables for improved testing capabilities.
This commit is contained in:
AmirReza Jamali
2026-05-05 15:20:55 +03:30
parent 4b425d6a46
commit f48cb7e249
16 changed files with 713 additions and 113 deletions
@@ -0,0 +1,45 @@
export type CompanyCategoryRow = {
id: string;
name: string;
description: string;
published: boolean;
created_at: number;
updated_at: number;
published_at: number;
thumbnail: string;
};
export const makeCompanyCategory = (
overrides: Partial<CompanyCategoryRow> = {},
index = 1,
): CompanyCategoryRow => ({
id: `507f1f77bcf86cd7994390${(10 + index).toString().padStart(2, "0")}`,
name: `E2E Category ${index}`,
description: "This is a sufficiently long description for category rows and forms.",
published: false,
created_at: 1_700_000_000 + index,
updated_at: 1_700_000_000 + index,
published_at: 0,
thumbnail: "",
...overrides,
});
export const categoriesListResponse = (categories: CompanyCategoryRow[]) => ({
success: true,
message: "ok",
data: { categories },
});
export const categoryDetailsResponse = (data: {
name: string;
description: string;
thumbnail?: string;
}) => ({
success: true,
message: "ok",
data: {
name: data.name,
description: data.description,
thumbnail: data.thumbnail ?? "",
},
});
@@ -0,0 +1,14 @@
/** Matches `useCreateCompanyCategory` / `useUpdateCompanyCategories` onSuccess (axios `response.data` shape). */
export const categoryMutationSuccessBody = (message: string) => ({
success: true,
data: { message },
});
export const companyCategoriesListUrl = (path = "/company-categories") =>
`${path}?_cy=${Date.now()}`;
export const companyCategoryCreateUrl = () =>
`/company-categories/create?_cy=${Date.now()}`;
export const companyCategoryEditUrl = (id: string) =>
`/company-categories/edit/${id}?_cy=${Date.now()}`;
@@ -0,0 +1,53 @@
import {
categoriesListResponse,
categoryDetailsResponse,
type CompanyCategoryRow,
} from "./company-category-fixtures";
/** Subset of Cypress `cy.intercept` request used by this stub (avoids non-exported / deep Cypress types). */
type InterceptRequest = {
url: string;
reply(staticResponse: { statusCode: number; body: Record<string, unknown> }): void;
continue(): void;
};
const CATEGORY_ID_IN_URL = /\/company-categories\/([a-f0-9]{24})(?:\?|\/|$)/i;
/**
* Stubs GET list and GET single category. Uses `req.url` string matching so all
* request shapes (query strings, rewritten hosts) are handled consistently.
*/
export function stubCompanyCategoriesReads(
getCategories: () => CompanyCategoryRow[],
): void {
const reply = (req: InterceptRequest) => {
const raw = req.url;
const detailMatch = raw.match(CATEGORY_ID_IN_URL);
if (detailMatch) {
const id = detailMatch[1];
const cat = getCategories().find((c) => c.id === id);
req.reply({
statusCode: 200,
body: categoryDetailsResponse({
name: cat?.name ?? "Category",
description: cat?.description ?? "Default description long enough.",
thumbnail: cat?.thumbnail ?? "",
}),
});
return;
}
if (raw.includes("/company-categories")) {
req.reply({
statusCode: 200,
body: categoriesListResponse(getCategories()),
});
return;
}
req.continue();
};
cy.intercept("GET", /\/api\/proxy\/company-categories/, reply);
cy.intercept("GET", /\/admin\/v1\/company-categories/, reply);
}