File size: 773 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { test, expect } from '@playwright/test'

test.describe('forced layout example', () => {
  const elements = [
    { tag: '#__next h2', count: 1 },
    { tag: '#__next p', count: 1 },
  ]

  test.beforeEach(async ({ page }) => {
    await page.goto('http://localhost:3000/examples/forced-layout')
  })

  test('checks for the elements', async ({ page }) => {
    for (const { tag, count } of elements) {
      await expect(page.locator(tag)).toHaveCount(count)
    }
  })

  test('checks if elements persist even after everything is deleted', async ({
    page,
  }) => {
    // clear the textbox
    await page.locator('div[role="textbox"]').clear()
    for (const { tag, count } of elements) {
      await expect(page.locator(tag)).toHaveCount(count)
    }
  })
})