2023-05-19 15:23:15 +00:00
|
|
|
import { expect } from '@playwright/test'
|
|
|
|
import { test } from './fixtures'
|
|
|
|
import { IsMac } from './utils';
|
|
|
|
|
|
|
|
if (!IsMac) {
|
2023-05-23 08:31:37 +00:00
|
|
|
test('window should not be maximized on first launch', async ({ page, app }) => {
|
2023-05-19 15:23:15 +00:00
|
|
|
await expect(page.locator('.window-controls .maximize-toggle.maximize')).toHaveCount(1)
|
|
|
|
})
|
|
|
|
|
2023-05-23 08:31:37 +00:00
|
|
|
test('window should be maximized and icon should change on maximize-toggle click', async ({ page }) => {
|
2023-05-22 09:41:31 +00:00
|
|
|
await page.click('.window-controls .maximize-toggle.maximize')
|
2023-05-19 15:23:15 +00:00
|
|
|
|
|
|
|
await expect(page.locator('.window-controls .maximize-toggle.restore')).toHaveCount(1)
|
|
|
|
})
|
|
|
|
|
2023-05-23 08:31:37 +00:00
|
|
|
test('window should be restored and icon should change on maximize-toggle click', async ({ page }) => {
|
2023-05-22 09:41:31 +00:00
|
|
|
await page.click('.window-controls .maximize-toggle.restore')
|
2023-05-19 15:23:15 +00:00
|
|
|
|
|
|
|
await expect(page.locator('.window-controls .maximize-toggle.maximize')).toHaveCount(1)
|
|
|
|
})
|
2023-05-23 08:31:37 +00:00
|
|
|
|
|
|
|
test('window controls should be hidden on fullscreen mode', async ({ page }) => {
|
|
|
|
// Keyboard press F11 won't work, probably because it's a chromium shortcut (not a document event)
|
|
|
|
await page.evaluate(`window.document.body.requestFullscreen()`)
|
|
|
|
|
2023-05-26 10:25:41 +00:00
|
|
|
await expect(page.locator('.window-controls .maximize-toggle')).toHaveCount(0)
|
2023-05-23 08:31:37 +00:00
|
|
|
})
|
|
|
|
|
2023-05-26 10:25:41 +00:00
|
|
|
test('window controls should be visible when we exit fullscreen mode', async ({ page }) => {
|
|
|
|
await page.click('.window-controls .fullscreen-toggle')
|
|
|
|
|
|
|
|
await expect(page.locator('.window-controls')).toHaveCount(1)
|
|
|
|
})
|
2023-05-19 15:23:15 +00:00
|
|
|
}
|