import { test as base } from "../conf";
import { CasePage } from "../../pom/case/case.page";
import { expect } from "..";

const test = base.extend<{ casePage24: CasePage }>({
    casePage24: async ({ page, conf }, use) => {
        const casePage = new CasePage(page);
        await base.step("Setup: Check start it in true cases", async () => {
            await casePage.waitForSecond(1);
            await casePage.caseLoc.detail.singleBusinesses(conf.data.business).click({ force: true });
            await casePage.waitForSecond(1);
            const startCase = await casePage.caseLoc.detail.requestHadStarIt(conf.data.case_had_star).all();
            if (startCase.length === 0) {
                await casePage.caseLoc.detail.singleBusinesses(conf.data.business).click();
                await casePage.changeStarFocus(conf.data.case_had_star);
            }
        });

        await use(casePage);
    }
});

export { test };
