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

const test = base.extend<{ casePage27: CasePage }>({
    casePage27: async ({ page, conf }, use) => {
        const casePage = new CasePage(page);
        await base.step("Setup: Ensure request is in original case", async () => {
            const requests = await casePage.caseLoc.detail.listRequestOfBusiness.all();

            if (requests.length === 0) {
                await casePage.open();
                await casePage.getDetailCase(conf.data.case_to_move);
                await casePage.tearDownMoveToOldCase(conf.data.case);
                await casePage.open();
                await casePage.getDetailCase(conf.data.case);
            }
        });
        
        await use(casePage);
    }
});

export { test };
