Store selected picture candidates in scrape DB
This commit is contained in:
@@ -138,6 +138,89 @@ test("main workspace keeps a bottom horizontal scrollbar for wide data", async (
|
||||
expect(scrollState.scrollWidth).toBeGreaterThan(scrollState.clientWidth);
|
||||
});
|
||||
|
||||
test("picture candidates show source, dimensions, target assignment and save action", async ({ page }) => {
|
||||
await page.route("**/api/manufacturers", async (route) => {
|
||||
await route.fulfill({
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({ items: [{ id: 13, name: "La Sportiva" }] }),
|
||||
});
|
||||
});
|
||||
await page.route("**/api/languages", async (route) => {
|
||||
await route.fulfill({ contentType: "application/json", body: JSON.stringify({ items: [] }) });
|
||||
});
|
||||
await page.route("**/api/catalog-maker/mapping-sources**", async (route) => {
|
||||
await route.fulfill({
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({
|
||||
mapped: true,
|
||||
items: [{ key: "hudy", name: "Hudy", enabled: true, health: "ok" }],
|
||||
}),
|
||||
});
|
||||
});
|
||||
await page.route("**/api/catalog-maker/product**", async (route) => {
|
||||
await route.fulfill({
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({
|
||||
product: {
|
||||
idProductCatalog: 135520,
|
||||
idProduct: 110927,
|
||||
idManufacturer: 13,
|
||||
codeManufacture: "LAS",
|
||||
supplierReference: "ZFHS099",
|
||||
name: "Aequilibrium Trek Woman GTX",
|
||||
position: 1,
|
||||
total: 380,
|
||||
},
|
||||
combinations: [
|
||||
{
|
||||
idProductCatalog: 110923,
|
||||
status: "SS25/Boty",
|
||||
color: "Carbon/Malibu Blue",
|
||||
combination: "36",
|
||||
ean13: "8058428191284",
|
||||
supplierStock: 1,
|
||||
},
|
||||
],
|
||||
}),
|
||||
});
|
||||
});
|
||||
await page.route("**/api/catalog-maker/get-pictures**", async (route) => {
|
||||
await route.fulfill({
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({
|
||||
items: [
|
||||
{
|
||||
source: { key: "hudy", name: "Hudy", type: "supplier" },
|
||||
searchUrl: "https://www.hudy.cz/vyhledavani?q=8058428191284",
|
||||
candidates: [
|
||||
{
|
||||
rawTitle: "Aequilibrium Trek Woman GTX",
|
||||
url: "https://www.hudy.cz/product",
|
||||
pictures: [
|
||||
"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='64'%3E%3Crect width='80' height='64' fill='red'/%3E%3C/svg%3E",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}),
|
||||
});
|
||||
});
|
||||
|
||||
await page.addInitScript(() => {
|
||||
localStorage.setItem("catalog-maker:selected-manufacturer", "13");
|
||||
});
|
||||
await page.goto("/");
|
||||
await page.waitForFunction(() => document.querySelector("#manufacturerSelect")?.value === "13");
|
||||
await page.locator("#getPicturesButton").click();
|
||||
|
||||
await expect(page.locator("#sourceModal")).toBeVisible();
|
||||
await expect(page.locator(".picture-candidate-title")).toHaveText("Hudy picture #1");
|
||||
await expect(page.locator(".picture-candidate-dimensions")).toContainText("Size:");
|
||||
await expect(page.locator(".picture-candidate-target")).toContainText("Target: color Carbon/Malibu Blue");
|
||||
await expect(page.locator(".picture-candidate-save")).toHaveText("Save to DB");
|
||||
});
|
||||
|
||||
test("uses one shared height for the top panel headers", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
const heights = await page.locator("#sidebarDrawer .sidebar-drawer-header, .secondary-panel .column-header, .main-workspace .column-header").evaluateAll((elements) => elements.map((element) => Math.round(element.getBoundingClientRect().height)));
|
||||
|
||||
Reference in New Issue
Block a user