Skip to content

Commit

Permalink
add more tests, enable firefox & safari
Browse files Browse the repository at this point in the history
  • Loading branch information
kristianka committed Jun 18, 2024
1 parent 2b617f4 commit 4a19ad6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 17 deletions.
29 changes: 20 additions & 9 deletions frontend/e2e/main.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ test.describe("Boxdb-app frontend", async () => {
await expect(page.locator('text="Box dimensions database"')).toHaveCount(1);
});

test("Doesn't thrown an error", async ({ page }) => {
// Wait for 10 seconds
await page.waitForTimeout(10000);
const errors = await page.locator("text=Error").count();
expect(errors).toBe(0);
});

test("You can add a box", async ({ page }) => {
await expect(page.locator('text="No boxes found."')).toHaveCount(1);
await page.click("[data-testid=addBoxButton]");
Expand Down Expand Up @@ -74,9 +67,27 @@ test.describe("Boxdb-app frontend", async () => {
await expect(page.getByTestId("BoxDetailsSubmitButton")).not.toBeNull();
});

// test("You can delete a box", async ({ page }) => {
test("You can delete a box", async ({ page }) => {
await page.waitForSelector('[data-testid="BoxListItem"]', {
state: "visible",
});
const boxListItem = await page
.locator('[data-testid="BoxListItem"]')
.first();

// });
await expect(boxListItem).not.toBeNull();
await boxListItem.click();

// Setup listener for the confirmation dialog before clicking the delete button
page.on("dialog", async (dialog) => {
await dialog.accept();
});

await page.click("[data-testid=BoxDetailsDeleteButton]");
// check that removed box is not in the list
await expect(boxListItem).toBeHidden();
await expect(page.locator('text="No boxes found."')).toHaveCount(1);
});

test.afterEach(async ({ page }, testInfo) => {
console.log(testInfo.title, testInfo.status);
Expand Down
16 changes: 8 additions & 8 deletions frontend/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ export default defineConfig({
use: { ...devices["Desktop Chrome"] },
},

// {
// name: "firefox",
// use: { ...devices["Desktop Firefox"] },
// },
{
name: "firefox",
use: { ...devices["Desktop Firefox"] },
},

// {
// name: "webkit",
// use: { ...devices["Desktop Safari"] },
// },
{
name: "webkit",
use: { ...devices["Desktop Safari"] },
},

/* Test against mobile viewports. */
// {
Expand Down

0 comments on commit 4a19ad6

Please sign in to comment.