mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 18:26:05 +08:00
feat: move theme switch and language switch to editor option menu (#2025)
Co-authored-by: himself65 <himself65@outlook.com>
This commit is contained in:
@@ -9,7 +9,7 @@ test('Switch to edgeless by switch edgeless item', async ({ page }) => {
|
||||
await waitMarkdownImported(page);
|
||||
const btn = await page.getByTestId('switch-edgeless-mode-button');
|
||||
await btn.click();
|
||||
|
||||
await page.waitForTimeout(100);
|
||||
const edgeless = page.locator('affine-edgeless-page');
|
||||
expect(await edgeless.isVisible()).toBe(true);
|
||||
|
||||
@@ -27,7 +27,6 @@ test('Convert to edgeless by editor header items', async ({ page }) => {
|
||||
await clickPageMoreActions(page);
|
||||
const menusEdgelessItem = page.getByTestId('editor-option-menu-edgeless');
|
||||
await menusEdgelessItem.click({ delay: 100 });
|
||||
|
||||
const edgeless = page.locator('affine-edgeless-page');
|
||||
expect(await edgeless.isVisible()).toBe(true);
|
||||
});
|
||||
|
||||
@@ -3,7 +3,6 @@ import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
import { waitMarkdownImported } from '../libs/page-logic';
|
||||
import { clickSideBarCurrentWorkspaceBanner } from '../libs/sidebar';
|
||||
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
|
||||
|
||||
test('preset workspace name', async ({ page }) => {
|
||||
@@ -24,7 +23,9 @@ test('preset workspace name', async ({ page }) => {
|
||||
test('Open language switch menu', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await clickSideBarCurrentWorkspaceBanner(page);
|
||||
const editorOptionMenuButton = page.getByTestId('editor-option-menu');
|
||||
await expect(editorOptionMenuButton).toBeVisible();
|
||||
await editorOptionMenuButton.click();
|
||||
const languageMenuButton = page.getByTestId('language-menu-button');
|
||||
await expect(languageMenuButton).toBeVisible();
|
||||
const actual = await languageMenuButton.innerText();
|
||||
|
||||
@@ -22,32 +22,10 @@ test('default white', async ({ browser }) => {
|
||||
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'),
|
||||
});
|
||||
});
|
||||
|
||||
// test('change theme to dark', async ({ page }) => {
|
||||
// const changeThemeContainer = page.locator(
|
||||
// '[data-testid=change-theme-container]'
|
||||
// );
|
||||
// const box = await changeThemeContainer.boundingBox();
|
||||
// expect(box?.x).not.toBeUndefined();
|
||||
//
|
||||
// await page.mouse.move((box?.x ?? 0) + 5, (box?.y ?? 0) + 5);
|
||||
// await page.waitForTimeout(1000);
|
||||
// const darkButton = page.locator('[data-testid=change-theme-dark]');
|
||||
// const darkButtonPositionTop = await darkButton.evaluate(
|
||||
// element => element.getBoundingClientRect().y
|
||||
// );
|
||||
// expect(darkButtonPositionTop).toBe(box?.y);
|
||||
//
|
||||
// await page.mouse.click((box?.x ?? 0) + 5, (box?.y ?? 0) + 5);
|
||||
// const root = page.locator('html');
|
||||
// const themeMode = await root.evaluate(element =>
|
||||
// element.getAttribute('data-theme')
|
||||
// );
|
||||
// expect(themeMode).toBe('dark');
|
||||
// });
|
||||
|
||||
Reference in New Issue
Block a user