import { Locator, Page, expect } from "@playwright/test";
import { WebAllLocators } from "../locator";

export class SellerProductApprove {
    readonly page: Page;
    readonly locators: WebAllLocators;

    constructor(page: Page) {
        this.page = page;
        this.locators = new WebAllLocators(page);
    }

    async adminMarketplaceProductSectionGoto() {
        await this.page.goto("admin/marketplace/products");
    }

    async sellerProductApproved() {
        await this.adminMarketplaceProductSectionGoto();
        await this.locators.massCheckbox.click();
        await this.page.waitForTimeout(2000);
        await this.locators.clickSelectActionButton.click();

        await this.locators.updateStatus.hover();

        await this.locators.clickApprovedButton.click();

        await this.locators.clickAgreeButton.click();
        await this.page.waitForTimeout(5000);
        await expect(this.locators.approvedSuccessToast).toBeVisible();
    }
}
