wip avec résolution de conflits
This commit is contained in:
parent
63b2d2b256
commit
ef19ba2b72
208 changed files with 178625 additions and 192002 deletions
|
|
@ -42,7 +42,7 @@ export const test = base.extend<ProductsFixture>({
|
|||
const hasStock = (product: WCV3Product) => (product.stock_quantity ?? 0) > 0;
|
||||
const hasNoStock = (product: WCV3Product) => pipe(hasStock(product), not);
|
||||
|
||||
const allProducts = await response.json() as WCV3Products;
|
||||
const allProducts = (await response.json()) as WCV3Products;
|
||||
const simpleProducts = allProducts.filter(isSimpleProduct);
|
||||
const simpleProductsWithStock = simpleProducts.filter(hasStock);
|
||||
const simpleProductsWithoutStock = simpleProducts.filter(hasNoStock);
|
||||
|
|
@ -77,9 +77,7 @@ test("can add a Product without variation with stock to the Cart", async ({ prod
|
|||
await expect(addToCartButton, "The add to cart button must be enabled").toBeEnabled();
|
||||
|
||||
// Vérifie qu'au clic sur le bouton, l'ajout au Panier retourne un succès.
|
||||
const addToCartResponse: Promise<Response> = page.waitForResponse(
|
||||
new RegExp(".*/wp-json/wc/store/cart/add-item"),
|
||||
);
|
||||
const addToCartResponse: Promise<Response> = page.waitForResponse(new RegExp(".*/wp-json/wc/store/cart/add-item"));
|
||||
await addToCartButton.click();
|
||||
const addToCartStatus = (await addToCartResponse).ok();
|
||||
expect(addToCartStatus, "The cart addition must succeed").toBeTruthy();
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ const getAllProductsLinks = async (page: Page, request: APIRequestContext): Prom
|
|||
const response = await request.get("/wp-json/wc/v3/products?page=1&per_page=100&status=publish", {
|
||||
headers: { Nonce: backendHeaders.nonce, Authorization: `Basic ${backendHeaders.authString}` },
|
||||
});
|
||||
const json = await response.json() as WCV3Products;
|
||||
const links = json.map(p => p.permalink);
|
||||
const json = (await response.json()) as WCV3Products;
|
||||
const links = json.map((p) => p.permalink);
|
||||
|
||||
return links;
|
||||
};
|
||||
|
|
@ -38,7 +38,7 @@ const scrollToGridsEnd = async (page: Page): Promise<void> => {
|
|||
|
||||
const productsGrid: Locator = page.locator(".grille-produits");
|
||||
await expect(productsGrid, "The Product's grid is visible").toBeVisible();
|
||||
expect(await (productsGrid.getAttribute("data-page")), "The initial page number attribute is correct").toBe(
|
||||
expect(await productsGrid.getAttribute("data-page"), "The initial page number attribute is correct").toBe(
|
||||
currentPageNumber,
|
||||
);
|
||||
|
||||
|
|
@ -46,9 +46,7 @@ const scrollToGridsEnd = async (page: Page): Promise<void> => {
|
|||
await expect(showMoreButton, "The 'Show more' button is visible").toBeVisible();
|
||||
|
||||
while (hasMoreProducts) {
|
||||
const newProductsResponse: Promise<Response> = page.waitForResponse(
|
||||
new RegExp(".*wp-json\/wc\/v3\/products.*"),
|
||||
);
|
||||
const newProductsResponse: Promise<Response> = page.waitForResponse(new RegExp(".*wp-json\/wc\/v3\/products.*"));
|
||||
await showMoreButton.click();
|
||||
await newProductsResponse;
|
||||
|
||||
|
|
@ -58,7 +56,7 @@ const scrollToGridsEnd = async (page: Page): Promise<void> => {
|
|||
await gridWithNewPageNumber.waitFor();
|
||||
|
||||
// Redondance pour expliciter la raison de l'assertion.
|
||||
expect(await (productsGrid.getAttribute("data-page")), "The page number attribute is incremented").toBe(
|
||||
expect(await productsGrid.getAttribute("data-page"), "The page number attribute is incremented").toBe(
|
||||
newPageNumber,
|
||||
);
|
||||
currentPageNumber = newPageNumber;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ export type BackendHeaders = {
|
|||
export const getBackendHeadersFromHtml = async (page: Page): Promise<BackendHeaders> => {
|
||||
const backendHeaders: BackendHeaders | undefined = pipe(
|
||||
Option.fromNullable(await page.locator("#injection-v2").textContent()),
|
||||
Option.andThen(j => JSON.parse(j) as BackendHeaders),
|
||||
Option.andThen((j) => JSON.parse(j) as BackendHeaders),
|
||||
Option.getOrUndefined,
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue