BrauzerLab
← Back to missions 40 / 50

Negative Assertions

Medium ~180 sec

After the page loads, the “Loading…” element is hidden. Your job: use expect to assert that this element is no longer visible — but this time the assertion will go in the opposite direction.

In Playwright, a negative assertion (expect(locator).not.assertion()) negates the assertion: the element is not visible, the text is absent, the element is not enabled. This form is used via the .not chain on expect.

The page object is already available. Find the #loading-spinner element and assert that it is not visible.

You can negate toBeVisible, toContainText, and other assertions using the not prefix.

TASK

Assert that an element is not present.

Provided for you
import { test, expect } from '@playwright/test';

test('Negative Assertions', async ({ page }) => {
  await page.goto('https://lab.local/mission/negative-assertions');
  // ↓ Your code goes below ↓
});
Editor
https://lab.local/mission/negative-assertions
Loading...
Results will appear here — press Run or Check.