2023-04-17 00:02:41 +03:00
|
|
|
import { resolve } from 'node:path';
|
|
|
|
|
2023-04-28 09:40:44 +03:00
|
|
|
import { test, testResultDir } from '@affine-test/kit/playwright';
|
2023-07-13 12:05:01 +03:00
|
|
|
import { openHomePage } from '@affine-test/kit/utils/load-page';
|
2023-09-02 06:31:07 +03:00
|
|
|
import { waitForEditorLoad } from '@affine-test/kit/utils/page-logic';
|
2023-02-05 13:41:18 +03:00
|
|
|
import { expect } from '@playwright/test';
|
2023-02-17 10:33:32 +03:00
|
|
|
|
2023-12-19 10:17:54 +03:00
|
|
|
test.use({
|
|
|
|
colorScheme: 'light',
|
|
|
|
});
|
|
|
|
|
2023-04-28 09:40:44 +03:00
|
|
|
// default could be anything, according to the system
|
2023-12-19 10:17:54 +03:00
|
|
|
test('default white', async ({ page }) => {
|
2023-04-17 00:02:41 +03:00
|
|
|
await openHomePage(page);
|
2023-09-02 06:31:07 +03:00
|
|
|
await waitForEditorLoad(page);
|
2023-04-17 00:02:41 +03:00
|
|
|
const root = page.locator('html');
|
2023-11-29 07:43:35 +03:00
|
|
|
const themeMode = await root.evaluate(element => element.dataset.theme);
|
2023-04-17 00:02:41 +03:00
|
|
|
expect(themeMode).toBe('light');
|
2023-04-28 09:40:44 +03:00
|
|
|
await page.screenshot({
|
2023-04-17 00:02:41 +03:00
|
|
|
path: resolve(testResultDir, 'affine-light-theme.png'),
|
|
|
|
});
|
2023-07-31 10:56:51 +03:00
|
|
|
await page.getByTestId('settings-modal-trigger').click();
|
|
|
|
await page.getByTestId('appearance-panel-trigger').click();
|
2023-04-17 00:02:41 +03:00
|
|
|
await page.waitForTimeout(50);
|
2023-07-31 10:56:51 +03:00
|
|
|
await page.getByTestId('dark-theme-trigger').click();
|
2023-11-29 07:43:35 +03:00
|
|
|
const darkMode = await root.evaluate(element => element.dataset.theme);
|
2023-07-31 10:56:51 +03:00
|
|
|
expect(darkMode).toBe('dark');
|
2023-04-28 09:40:44 +03:00
|
|
|
await page.screenshot({
|
2023-04-17 00:02:41 +03:00
|
|
|
path: resolve(testResultDir, 'affine-dark-theme.png'),
|
|
|
|
});
|
2022-11-10 15:51:06 +03:00
|
|
|
});
|