Skip to content

Commit

Permalink
[test-fix-2]
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitrov93 committed Apr 14, 2024
1 parent 19ace7f commit f706cc4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
9 changes: 4 additions & 5 deletions tests/Sales/create-sale.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ test("Create sale", async ({ page }) => {
await selectResource(page);

await submitButton.click();
expect(page.getByText("Successfully sold the product!")).toBeVisible();
await expect(page.getByText("Successfully sold the product!")).toBeVisible();
});

test("Create sale with a discount", async ({ page }) => {
Expand All @@ -53,13 +53,12 @@ test("Create sale with a discount", async ({ page }) => {
await selectDate(page, expect);

await selectProduct(page);
await page.locator("#input-156").fill("1");

await page.getByLabel("Discount").first().fill("1");
await selectResource(page);
await page.locator("#input-183").fill("1");
await page.getByLabel("Discount").nth(0).fill("1");

await submitButton.click();
expect(page.getByText("Successfully sold the product!")).toBeVisible();
await expect(page.getByText("Successfully sold the product!")).toBeVisible();
});

test("Create sale - with empty inputs - fails", async ({ page }) => {
Expand Down
12 changes: 4 additions & 8 deletions tests/utils/salesUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,10 @@ export const selectResource = async (page) => {
};

export const checkErrorMessages = async (page, expect) => {
const errorMessages = [
{ selector: "#input-37-messages", message: "Please select at least one" },
{ selector: "#input-40-messages", message: "Please select at least one" },
];

for (const { selector, message } of errorMessages) {
await expect(page.locator(selector).getByText(message)).toBeVisible();
}

await expect(page.getByText('Please select at least one author').first()).toBeVisible()
await expect(page.getByText('Please select at least one author').nth(1)).toBeVisible()

};

export const checkDisabledButtons = async (
Expand Down

0 comments on commit f706cc4

Please sign in to comment.