refactor(tender-details): enhance translation page tests and layout
- Updated Cypress tests for the tender translation page to improve visibility checks and streamline assertions. - Refactored test structure to utilize a dedicated function for fetching the visible title heading. - Adjusted test cases to ensure accurate language switching and URL handling for tender details. - Improved layout consistency in the translation page by refining element visibility checks and ensuring proper section rendering.
This commit is contained in:
@@ -45,6 +45,8 @@ export const API_ENDPOINTS = {
|
||||
DETAILS: (id: string) => `tenders/${id}`,
|
||||
AI_TRANSLATE: (id: string) => `tenders/${id}/ai-translate`,
|
||||
AI_SUMMARY: (id: string) => `tenders/${id}/ai-summary`,
|
||||
DOCUMENTS: (id: string) => `tenders/${id}/documents`,
|
||||
DOCUMENTS_DOWNLOAD: (id: string) => `tenders/${id}/documents/download`,
|
||||
},
|
||||
CUSTOMERS: {
|
||||
READ_ALL: "customers",
|
||||
|
||||
@@ -3,6 +3,7 @@ import { API_ENDPOINTS } from "../endpoints";
|
||||
import { ApiResponse } from "../types";
|
||||
import {
|
||||
TTenderDetails,
|
||||
TTenderDocumentsResponse,
|
||||
TTenderResponse,
|
||||
TTenderTranslationResponse,
|
||||
} from "../types/Tenders";
|
||||
@@ -50,4 +51,13 @@ export const tendersService = {
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
|
||||
getDocuments: async (id: string): Promise<ApiResponse<TTenderDocumentsResponse[]>> => {
|
||||
try {
|
||||
return (await api.get(API_ENDPOINTS.TENDERS.DOCUMENTS(id))).data;
|
||||
} catch (error) {
|
||||
console.error("ERROR caught in Tender Service => get documents: ", error);
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@@ -27,6 +27,12 @@ export const TenderSchema = z.object({
|
||||
overall_summary: z.string().optional(),
|
||||
});
|
||||
|
||||
export const TenderDocumentsResponseSchema = z.object({
|
||||
filename: z.string(),
|
||||
size: z.number(),
|
||||
last_modified: z.number(),
|
||||
document_type: z.string(),
|
||||
})
|
||||
export const TenderTranslationResponseSchema = z.object({
|
||||
notice_id: z.string(),
|
||||
language: z.string(),
|
||||
@@ -36,6 +42,8 @@ export const TenderTranslationResponseSchema = z.object({
|
||||
export const TendersResponse = z.object({
|
||||
tenders: z.array(TenderSchema).or(z.null()),
|
||||
});
|
||||
|
||||
export type TTenderDocumentsResponse = z.infer<typeof TenderDocumentsResponseSchema>;
|
||||
export type TTenderResponse = z.infer<typeof TendersResponse>;
|
||||
export type TTenderDetails = z.infer<typeof TenderSchema>;
|
||||
export type TTenderTranslationResponse = z.infer<
|
||||
|
||||
Reference in New Issue
Block a user