1
0

window.spec.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. import { expect } from '@playwright/test'
  2. import { test } from './fixtures'
  3. import { IsMac } from './utils';
  4. if (!IsMac) {
  5. test('window should not be maximized on first launch', async ({ page, app }) => {
  6. await expect(page.locator('.window-controls .maximize-toggle.maximize')).toHaveCount(1)
  7. })
  8. test('window should be maximized and icon should change on maximize-toggle click', async ({ page }) => {
  9. await page.click('.window-controls .maximize-toggle.maximize')
  10. await expect(page.locator('.window-controls .maximize-toggle.restore')).toHaveCount(1)
  11. })
  12. test('window should be restored and icon should change on maximize-toggle click', async ({ page }) => {
  13. await page.click('.window-controls .maximize-toggle.restore')
  14. await expect(page.locator('.window-controls .maximize-toggle.maximize')).toHaveCount(1)
  15. })
  16. test('window controls should be hidden on fullscreen mode', async ({ page }) => {
  17. // Keyboard press F11 won't work, probably because it's a chromium shortcut (not a document event)
  18. await page.evaluate(`window.document.body.requestFullscreen()`)
  19. await expect(page.locator('.window-controls .maximize-toggle')).toHaveCount(0)
  20. })
  21. test('window controls should be visible when we exit fullscreen mode', async ({ page }) => {
  22. await page.click('.window-controls .fullscreen-toggle')
  23. await expect(page.locator('.window-controls')).toHaveCount(1)
  24. })
  25. }