Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

chore: e2e - count() -> toHaveCount() (#1097)

Akshay Agrawale9312ae3480f
diff --git a/frontend/e2e-tests/cells.spec.ts b/frontend/e2e-tests/cells.spec.ts
index 28c6b6c8a6..1a7214fd6a 100644
--- a/frontend/e2e-tests/cells.spec.ts
+++ b/frontend/e2e-tests/cells.spec.ts
@@ -48,14 +48,14 @@ test("page renders 2 cells", async ({ page }) => {
// No add buttons are visible
await expect(
- page.getByTestId("create-cell-button").locator(":visible").count(),
- ).resolves.toBe(0);
+ page.getByTestId("create-cell-button").locator(":visible"),
+ ).toHaveCount(0);
// Hover over a cell the 'add cell' button appears
await page.hover("text=Cell 1");
await expect(
- page.getByTestId("create-cell-button").locator(":visible").count(),
- ).resolves.toBe(2);
+ page.getByTestId("create-cell-button").locator(":visible"),
+ ).toHaveCount(2);
// Clicking the first button creates a new cell at the top
await page
diff --git a/frontend/e2e-tests/components.spec.ts b/frontend/e2e-tests/components.spec.ts
index 584b7fa1e0..21e7a72e5a 100644
--- a/frontend/e2e-tests/components.spec.ts
+++ b/frontend/e2e-tests/components.spec.ts
@@ -36,7 +36,7 @@ test("page renders read only view in read mode", async ({ page }) => {
// Filename is not visible
await expect(page.getByText("components.py").last()).not.toBeVisible();
// Has elements with class name 'controls'
- expect(await page.locator("#save-button").count()).toBe(0);
+ await expect(page.locator("#save-button")).toHaveCount(0);
// Can see output
await expect(page.locator("h1").getByText("UI Elements")).toBeVisible();
diff --git a/frontend/e2e-tests/disabled.spec.ts b/frontend/e2e-tests/disabled.spec.ts
index 2f20688c55..4c0338e68e 100644
--- a/frontend/e2e-tests/disabled.spec.ts
+++ b/frontend/e2e-tests/disabled.spec.ts
@@ -23,8 +23,8 @@ test("disabled cells", async ({ page }) => {
// No add buttons are visible
await expect(
- page.getByTestId("create-cell-button").locator(":visible").count(),
- ).resolves.toBe(0);
+ page.getByTestId("create-cell-button").locator(":visible"),
+ ).toHaveCount(0);
// Hover over a cell the drag button button appears
// Click the drag button and then disable the cell
diff --git a/frontend/e2e-tests/helper.ts b/frontend/e2e-tests/helper.ts
index 41d27797c7..95ae50216d 100644
--- a/frontend/e2e-tests/helper.ts
+++ b/frontend/e2e-tests/helper.ts
@@ -14,8 +14,8 @@ export async function createCellBelow(opts: {
// Hover over a cell the 'add cell' button appears
await page.hover(cellSelector);
await expect(
- page.getByTestId("create-cell-button").locator(":visible").count(),
- ).resolves.toBe(2);
+ page.getByTestId("create-cell-button").locator(":visible"),
+ ).toHaveCount(2);
// Clicking the first button creates a new cell below
await page
diff --git a/frontend/e2e-tests/mode.spec.ts b/frontend/e2e-tests/mode.spec.ts
index 03ff3a2ad9..841e32f952 100644
--- a/frontend/e2e-tests/mode.spec.ts
+++ b/frontend/e2e-tests/mode.spec.ts
@@ -49,7 +49,7 @@ test("page renders read only view in read mode", async ({ page }) => {
// Filename is not visible
await expect(page.getByText("components.py").last()).not.toBeVisible();
// Has elements with class name 'controls'
- expect(await page.locator("#save-button").count()).toBe(0);
+ await expect(page.locator("#save-button")).toHaveCount(0);
// Can see output
await expect(page.locator("h1").getByText("UI Elements")).toBeVisible();