mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-28 10:26:18 +03:00
2ff5ef9d5d
Co-authored-by: himself65 <himself65@outlook.com>
32 lines
1.0 KiB
TypeScript
32 lines
1.0 KiB
TypeScript
import { resolve } from 'node:path';
|
|
|
|
import { test, testResultDir } from '@affine-test/kit/playwright';
|
|
import { expect } from '@playwright/test';
|
|
|
|
import { openHomePage } from '../libs/load-page';
|
|
import { waitMarkdownImported } from '../libs/page-logic';
|
|
|
|
// default could be anything, according to the system
|
|
test('default white', async ({ browser }) => {
|
|
const context = await browser.newContext({
|
|
colorScheme: 'light',
|
|
});
|
|
const page = await context.newPage();
|
|
await openHomePage(page);
|
|
await waitMarkdownImported(page);
|
|
const root = page.locator('html');
|
|
const themeMode = await root.evaluate(element =>
|
|
element.getAttribute('data-theme')
|
|
);
|
|
expect(themeMode).toBe('light');
|
|
await page.screenshot({
|
|
path: resolve(testResultDir, 'affine-light-theme.png'),
|
|
});
|
|
await page.getByTestId('editor-option-menu').click();
|
|
await page.getByTestId('change-theme-dark').click();
|
|
await page.waitForTimeout(50);
|
|
await page.screenshot({
|
|
path: resolve(testResultDir, 'affine-dark-theme.png'),
|
|
});
|
|
});
|