Skip to content

Commit

Permalink
change tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kristianka committed Jun 18, 2024
1 parent 327f837 commit 8bbf955
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions frontend/e2e/main.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,46 +28,46 @@ test.describe("Boxdb-app frontend", async () => {

test("Added box is displayed in the list", async ({ page }) => {
const boxLabel = `This is a test box ${random}`;
const box = await page.getByLabel(boxLabel);
expect(box).not.toBeNull();
const boxLocator = page.locator(`text=${boxLabel}`);
await expect(boxLocator).toHaveCount(1);
});

test("You can click the box and view detailed info", async ({ page }) => {
const boxLabel = `This is a test box ${random}`;
// test("You can click the box and view detailed info", async ({ page }) => {
// const boxLabel = `This is a test box ${random}`;

await page.waitForSelector('[data-testid="BoxListItem"]', {
state: "visible",
});
const boxListItem = await page
.locator('[data-testid="BoxListItem"]')
.first();
// await page.waitForSelector('[data-testid="BoxListItem"]', {
// state: "visible",
// });
// const boxListItem = await page
// .locator('[data-testid="BoxListItem"]')
// .first();

console.log("boxListItem", boxListItem);
await expect(boxListItem).not.toBeNull();
await boxListItem.click();
// console.log("boxListItem", boxListItem);
// await expect(boxListItem).not.toBeNull();
// await boxListItem.click();

const msg = page.getByText("Click on a box to see its information");
await expect(msg).toHaveCount(0);
// const msg = page.getByText("Click on a box to see its information");
// await expect(msg).toHaveCount(0);

// Check that the box details are displayed
await expect(page.getByTestId("BoxDetailsId")).not.toBeNull();
await expect(page.getByTestId("BoxDetailsUndoButton")).not.toBeNull();
await expect(page.getByTestId("BoxDetailsDeleteButton")).not.toBeNull();
// // Check that the box details are displayed
// await expect(page.getByTestId("BoxDetailsId")).not.toBeNull();
// await expect(page.getByTestId("BoxDetailsUndoButton")).not.toBeNull();
// await expect(page.getByTestId("BoxDetailsDeleteButton")).not.toBeNull();

// Verify the width, height, and depth input values. needs to be done like this
// since they are number inputs
await expect(page.locator('[data-testid="BoxDetailsWidth"]')).toHaveValue(
"10",
);
await expect(page.locator('[data-testid="BoxDetailsHeight"]')).toHaveValue(
"20",
);
await expect(page.locator('[data-testid="BoxDetailsDepth"]')).toHaveValue(
"30",
);
await expect(page.getByTestId("BoxDetailsComment")).toHaveText(boxLabel);
await expect(page.getByTestId("BoxDetailsSubmitButton")).not.toBeNull();
});
// // Verify the width, height, and depth input values. needs to be done like this
// // since they are number inputs
// await expect(page.locator('[data-testid="BoxDetailsWidth"]')).toHaveValue(
// "10",
// );
// await expect(page.locator('[data-testid="BoxDetailsHeight"]')).toHaveValue(
// "20",
// );
// await expect(page.locator('[data-testid="BoxDetailsDepth"]')).toHaveValue(
// "30",
// );
// await expect(page.getByTestId("BoxDetailsComment")).toHaveText(boxLabel);
// await expect(page.getByTestId("BoxDetailsSubmitButton")).not.toBeNull();
// });

test.afterEach(async ({ page }, testInfo) => {
console.log("Taking screenshot to /e2e/screenshots/");
Expand Down

0 comments on commit 8bbf955

Please sign in to comment.