fix: windows rust cache (#1710)

This commit is contained in:
Peng Xiao 2023-03-28 13:25:16 +08:00 committed by GitHub
parent 26b030ecda
commit 5a508b1fe4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 129 additions and 23 deletions

View File

@ -95,7 +95,7 @@ runs:
id: playwright-version
if: ${{ inputs.playwright-install == 'true' }}
shell: bash
run: echo "{version}=$(yarn why --json @playwright/test | grep -h 'workspace:.' | jq --raw-output '.children[].locator' | sed -e 's/@playwright\/test@.*://')" >> GITHUB_OUTPUT
run: echo "version=$(yarn why --json @playwright/test | grep -h 'workspace:.' | jq --raw-output '.children[].locator' | sed -e 's/@playwright\/test@.*://')" >> $GITHUB_OUTPUT
# Attempt to restore the correct Playwright browser binaries based on the
# currently installed version of Playwright (The browser binary versions

View File

@ -173,6 +173,11 @@ jobs:
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './packages/octobase-node -> target'
- uses: actions/download-artifact@v3
with:
name: before-make-web-static
@ -183,18 +188,13 @@ jobs:
name: before-make-electron-dist
path: apps/electron/dist
- name: move octobase Binary
run: cp ./packages/octobase-node/octobase.*.node ./apps/electron/dist/layers/main/
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './packages/octobase-node -> target'
- name: build octobase-node
run: yarn build:octobase-node
working-directory: apps/electron
- name: move octobase Binary
run: cp ./packages/octobase-node/octobase.*.node ./apps/electron/dist/layers/main/
- name: make build
run: yarn make-windows-x64
working-directory: apps/electron

View File

@ -51,6 +51,15 @@ export function _initPageWithDemoMarkdown(
const frameId = page.addBlock('affine:frame', {}, pageBlockId);
page.addBlock('affine:paragraph', {}, frameId);
const contentParser = new ContentParser(page);
contentParser.importMarkdown(demoText, frameId);
contentParser.importMarkdown(demoText, frameId).then(() => {
document.dispatchEvent(
new CustomEvent('markdown:imported', {
detail: {
workspaceId: page.workspace.id,
pageId: page.id,
},
})
);
});
page.workspace.setPageMeta(page.id, { demoTitle });
}

View File

@ -1,7 +1,15 @@
import type { Page } from '@playwright/test';
export async function waitMarkdownImported(page: Page) {
return page.evaluate(
() =>
new Promise(resolve => {
document.addEventListener('markdown:imported', resolve);
})
);
}
export async function newPage(page: Page) {
await page.waitForSelector('v-line');
// fixme(himself65): if too fast, the page will crash
await page.getByTestId('new-page-button').click({
delay: 100,

View File

@ -1,5 +1,7 @@
import { expect } from '@playwright/test';
import { waitMarkdownImported } from '../libs/page-logic';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const userA = require('../fixtures/userA.json');
import { test } from '../libs/playwright';
@ -19,6 +21,7 @@ import {
test.describe('affine workspace', () => {
test('should login with user A', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
const [a] = await createFakeUser();
await loginUser(page, a);
await clickSideBarCurrentWorkspaceBanner(page);
@ -30,6 +33,7 @@ test.describe('affine workspace', () => {
test('should enable affine workspace successfully', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
const [a] = await createFakeUser();
await loginUser(page, a);
const name = `test-${Date.now()}`;

View File

@ -1,12 +1,13 @@
import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page';
import { clickPageMoreActions } from '../libs/page-logic';
import { clickPageMoreActions, waitMarkdownImported } from '../libs/page-logic';
import { test } from '../libs/playwright';
test.describe('Change page mode(Page or Edgeless)', () => {
test('Switch to edgeless by switch edgeless item', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
const btn = await page.getByTestId('switch-edgeless-mode-button');
await btn.click();
@ -16,6 +17,7 @@ test.describe('Change page mode(Page or Edgeless)', () => {
test('Convert to edgeless by editor header items', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await clickPageMoreActions(page);
const menusEdgelessItem = page.getByTestId('editor-option-menu-edgeless');
await menusEdgelessItem.click({ delay: 100 });

View File

@ -1,11 +1,13 @@
import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page';
import { waitMarkdownImported } from '../libs/page-logic';
import { test } from '../libs/playwright';
test.describe('Open contact us', () => {
test('Click right-bottom corner contact icon', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await page.locator('[data-testid=help-island]').click();
const rightBottomContactUs = page.locator(
'[data-testid=right-bottom-contact-us-icon]'

View File

@ -1,11 +1,13 @@
import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page';
import { waitMarkdownImported } from '../libs/page-logic';
import { test } from '../libs/playwright';
test.describe('Layout ui', () => {
test('Collapse Sidebar', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await page.getByTestId('sliderBar-arrowButton-collapse').click();
const sliderBarArea = page.getByTestId('sliderBar');
await expect(sliderBarArea).not.toBeVisible();
@ -13,6 +15,7 @@ test.describe('Layout ui', () => {
test('Expand Sidebar', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await page.getByTestId('sliderBar-arrowButton-collapse').click();
const sliderBarArea = page.getByTestId('sliderBar');
await expect(sliderBarArea).not.toBeVisible();

View File

@ -1,13 +1,14 @@
import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page';
import { newPage } from '../libs/page-logic';
import { newPage, waitMarkdownImported } from '../libs/page-logic';
import { test } from '../libs/playwright';
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
test.describe('Local first create page', () => {
test('should create a page with a local first avatar', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await newPage(page);
await page.getByTestId('workspace-name').click();
await page.getByTestId('new-workspace').click({ delay: 50 });

View File

@ -1,7 +1,11 @@
import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page';
import { getBlockSuiteEditorTitle, newPage } from '../libs/page-logic';
import {
getBlockSuiteEditorTitle,
newPage,
waitMarkdownImported,
} from '../libs/page-logic';
import { test } from '../libs/playwright';
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
@ -10,6 +14,7 @@ test.describe('Local first delete page', () => {
page,
}) => {
await openHomePage(page);
await waitMarkdownImported(page);
await newPage(page);
await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to restore');

View File

@ -1,6 +1,7 @@
import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page';
import { waitMarkdownImported } from '../libs/page-logic';
import { test } from '../libs/playwright';
import { clickSideBarSettingButton } from '../libs/sidebar';
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
@ -10,6 +11,7 @@ test.describe('Local first delete workspace', () => {
page,
}) => {
await openHomePage(page);
await waitMarkdownImported(page);
await clickSideBarSettingButton(page);
await page.getByTestId('delete-workspace-button').click();
const workspaceNameDom = await page.getByTestId('workspace-name');

View File

@ -5,6 +5,7 @@ import {
clickPageMoreActions,
getBlockSuiteEditorTitle,
newPage,
waitMarkdownImported,
} from '../libs/page-logic';
import { test } from '../libs/playwright';
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
@ -12,6 +13,7 @@ import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
test.describe('Local first export page', () => {
test.skip('New a page ,then open it and export html', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await newPage(page);
await getBlockSuiteEditorTitle(page).click();
await page

View File

@ -5,6 +5,7 @@ import {
clickPageMoreActions,
getBlockSuiteEditorTitle,
newPage,
waitMarkdownImported,
} from '../libs/page-logic';
import { test } from '../libs/playwright';
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
@ -12,6 +13,7 @@ import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
test.describe('Local first favorite and cancel favorite page', () => {
test('New a page and open it ,then favorite it', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await newPage(page);
await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite');
@ -29,6 +31,7 @@ test.describe('Local first favorite and cancel favorite page', () => {
});
test('Cancel favorite', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await newPage(page);
await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite');

View File

@ -5,6 +5,7 @@ import {
clickPageMoreActions,
getBlockSuiteEditorTitle,
newPage,
waitMarkdownImported,
} from '../libs/page-logic';
import { test } from '../libs/playwright';
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
@ -12,6 +13,7 @@ import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
test.describe('Local first favorite items ui', () => {
test('Show favorite items in sidebar', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await newPage(page);
await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite');
@ -36,6 +38,7 @@ test.describe('Local first favorite items ui', () => {
test('Show favorite items in favorite list', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await newPage(page);
await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite');

View File

@ -1,13 +1,18 @@
import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page';
import { getBlockSuiteEditorTitle, newPage } from '../libs/page-logic';
import {
getBlockSuiteEditorTitle,
newPage,
waitMarkdownImported,
} from '../libs/page-logic';
import { test } from '../libs/playwright';
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
test.describe('local first new page', () => {
test('click btn new page', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
const originPageId = page.url().split('/').reverse()[0];
await newPage(page);
const newPageId = page.url().split('/').reverse()[0];
@ -17,6 +22,7 @@ test.describe('local first new page', () => {
test('click btn bew page and find it in all pages', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await newPage(page);
await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page');

View File

@ -1,13 +1,18 @@
import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page';
import { getBlockSuiteEditorTitle, newPage } from '../libs/page-logic';
import {
getBlockSuiteEditorTitle,
newPage,
waitMarkdownImported,
} from '../libs/page-logic';
import { test } from '../libs/playwright';
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
test.describe('local first new page', () => {
test('click btn bew page and open in tab', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await newPage(page);
await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page');

View File

@ -1,7 +1,11 @@
import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page';
import { getBlockSuiteEditorTitle, newPage } from '../libs/page-logic';
import {
getBlockSuiteEditorTitle,
newPage,
waitMarkdownImported,
} from '../libs/page-logic';
import { test } from '../libs/playwright';
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
@ -10,6 +14,7 @@ test.describe('Local first delete page', () => {
page,
}) => {
await openHomePage(page);
await waitMarkdownImported(page);
await newPage(page);
await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to restore');

View File

@ -1,6 +1,7 @@
import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page';
import { waitMarkdownImported } from '../libs/page-logic';
import { test } from '../libs/playwright';
import { clickSideBarSettingButton } from '../libs/sidebar';
@ -9,6 +10,7 @@ test.describe('Local first setting page', () => {
page,
}) => {
await openHomePage(page);
await waitMarkdownImported(page);
const element = await page.getByTestId(
'slider-bar-workspace-setting-button'
);

View File

@ -5,6 +5,7 @@ import {
clickPageMoreActions,
getBlockSuiteEditorTitle,
newPage,
waitMarkdownImported,
} from '../libs/page-logic';
import { test } from '../libs/playwright';
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
@ -12,6 +13,7 @@ import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
test.describe('Local first delete page', () => {
test('New a page ,then open it and show delete modal', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await newPage(page);
await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to delete');
@ -34,6 +36,7 @@ test.describe('Local first delete page', () => {
page,
}) => {
await openHomePage(page);
await waitMarkdownImported(page);
await newPage(page);
await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to delete');

View File

@ -1,7 +1,11 @@
import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page';
import { getBlockSuiteEditorTitle, newPage } from '../libs/page-logic';
import {
getBlockSuiteEditorTitle,
newPage,
waitMarkdownImported,
} from '../libs/page-logic';
import { test } from '../libs/playwright';
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
@ -10,6 +14,7 @@ test.describe('Local first trash page', () => {
page,
}) => {
await openHomePage(page);
await waitMarkdownImported(page);
await newPage(page);
await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to delete');

View File

@ -1,6 +1,7 @@
import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page';
import { waitMarkdownImported } from '../libs/page-logic';
import { test } from '../libs/playwright';
import { clickSideBarAllPageButton } from '../libs/sidebar';
import { createWorkspace } from '../libs/workspace';
@ -8,6 +9,7 @@ import { createWorkspace } from '../libs/workspace';
test.describe('Local first workspace list', () => {
test('just one item in the workspace list at first', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
const workspaceName = page.getByTestId('workspace-name');
await workspaceName.click();
expect(
@ -20,6 +22,7 @@ test.describe('Local first workspace list', () => {
test('create one workspace in the workspace list', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
const newWorkspaceNameStr = 'New Workspace';
await createWorkspace({ name: newWorkspaceNameStr }, page);
@ -48,6 +51,7 @@ test.describe('Local first workspace list', () => {
test('create multi workspace in the workspace list', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await createWorkspace({ name: 'New Workspace 2' }, page);
await createWorkspace({ name: 'New Workspace 3' }, page);

View File

@ -1,6 +1,7 @@
import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page';
import { waitMarkdownImported } from '../libs/page-logic';
import { test } from '../libs/playwright';
import { clickSideBarCurrentWorkspaceBanner } from '../libs/sidebar';
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
@ -8,6 +9,7 @@ import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
test.describe('Local first default workspace', () => {
test('preset workspace name', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
const workspaceName = page.getByTestId('workspace-name');
await page.waitForTimeout(1000);
expect(await workspaceName.textContent()).toBe('Demo Workspace');
@ -24,6 +26,7 @@ test.describe('Local first default workspace', () => {
test.describe('Language switch', () => {
test('Open language switch menu', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await clickSideBarCurrentWorkspaceBanner(page);
const languageMenuButton = page.getByTestId('language-menu-button');
await expect(languageMenuButton).toBeVisible();

View File

@ -1,12 +1,14 @@
import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page';
import { waitMarkdownImported } from '../libs/page-logic';
import { test } from '../libs/playwright';
import { createWorkspace } from '../libs/workspace';
test.describe('Open AFFiNE', () => {
test('Open last workspace when back to affine', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await createWorkspace({ name: 'New Workspace 2' }, page);
// FIXME: can not get when the new workspace is surely created, hack a timeout to wait
// waiting for page loading end

View File

@ -2,7 +2,7 @@ import { expect, type Page } from '@playwright/test';
import { withCtrlOrMeta } from '../libs/keyboard';
import { openHomePage } from '../libs/load-page';
import { newPage } from '../libs/page-logic';
import { newPage, waitMarkdownImported } from '../libs/page-logic';
import { test } from '../libs/playwright';
const openQuickSearchByShortcut = async (page: Page) =>
@ -32,6 +32,7 @@ async function titleIsFocused(page: Page) {
test.describe('Open quick search', () => {
test('Click slider bar button', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await newPage(page);
const quickSearchButton = page.locator(
'[data-testid=slider-bar-quick-search-button]'
@ -43,6 +44,7 @@ test.describe('Open quick search', () => {
test('Click arrowDown icon after title', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await newPage(page);
const quickSearchButton = page.locator(
'[data-testid=slider-bar-quick-search-button]'
@ -54,6 +56,7 @@ test.describe('Open quick search', () => {
test('Press the shortcut key cmd+k', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await newPage(page);
await openQuickSearchByShortcut(page);
const quickSearch = page.locator('[data-testid=quickSearch]');
@ -64,6 +67,7 @@ test.describe('Open quick search', () => {
test.describe('Add new page in quick search', () => {
test('Create a new page without keyword', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await newPage(page);
await openQuickSearchByShortcut(page);
const addNewPage = page.locator('[data-testid=quick-search-add-new-page]');
@ -74,6 +78,7 @@ test.describe('Add new page in quick search', () => {
test('Create a new page with keyword', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await newPage(page);
await openQuickSearchByShortcut(page);
await page.keyboard.insertText('test123456');
@ -87,6 +92,7 @@ test.describe('Add new page in quick search', () => {
test.describe('Search and select', () => {
test('Enter a keyword to search for', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await newPage(page);
await openQuickSearchByShortcut(page);
await page.keyboard.insertText('test123456');
@ -95,6 +101,7 @@ test.describe('Search and select', () => {
});
test('Create a new page and search this page', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await newPage(page);
await openQuickSearchByShortcut(page);
await page.keyboard.insertText('test123456');
@ -126,6 +133,7 @@ test.describe('Disable search on 404 page', () => {
test.describe('Open quick search on the published page', () => {
test('Open quick search on local page', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await newPage(page);
await openQuickSearchByShortcut(page);
const publishedSearchResults = page.locator('[publishedSearchResults]');
@ -136,6 +144,7 @@ test.describe('Open quick search on the published page', () => {
test.describe('Focus event for quick search', () => {
test('Autofocus input after opening quick search', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await newPage(page);
await openQuickSearchByShortcut(page);
const locator = page.locator('[cmdk-input]');
@ -144,6 +153,7 @@ test.describe('Focus event for quick search', () => {
});
test('Autofocus input after select', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await newPage(page);
await openQuickSearchByShortcut(page);
await page.keyboard.press('ArrowUp');
@ -153,6 +163,7 @@ test.describe('Focus event for quick search', () => {
});
test('Focus title after creating a new page', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await newPage(page);
await openQuickSearchByShortcut(page);
const addNewPage = page.locator('[data-testid=quick-search-add-new-page]');
@ -165,6 +176,7 @@ test.describe('Novice guidance for quick search', () => {
page,
}) => {
await openHomePage(page);
await waitMarkdownImported(page);
const quickSearchTips = page.locator('[data-testid=quick-search-tips]');
await expect(quickSearchTips).not.toBeVisible();
await page.getByTestId('sliderBar-arrowButton-collapse').click();

View File

@ -1,11 +1,13 @@
import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page';
import { waitMarkdownImported } from '../libs/page-logic';
import { test } from '../libs/playwright';
test.describe('Shortcuts Modal', () => {
test('Open shortcuts modal', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await page.locator('[data-testid=help-island]').click();
const shortcutsIcon = page.locator('[data-testid=shortcuts-icon]');

View File

@ -1,11 +1,13 @@
import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page';
import { waitMarkdownImported } from '../libs/page-logic';
import { test } from '../libs/playwright';
test.describe('subpage', () => {
test('Create subpage', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await page.getByTestId('sliderBar-arrowButton-collapse').click();
const sliderBarArea = page.getByTestId('sliderBar');
await expect(sliderBarArea).not.toBeVisible();

View File

@ -1,6 +1,7 @@
import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page';
import { waitMarkdownImported } from '../libs/page-logic';
import { test } from '../libs/playwright';
test.describe('Change Theme', () => {
@ -11,6 +12,7 @@ test.describe('Change Theme', () => {
});
const page = await context.newPage();
await openHomePage(page);
await waitMarkdownImported(page);
await page.waitForSelector('html');
const root = page.locator('html');
const themeMode = await root.evaluate(element =>
@ -18,10 +20,19 @@ test.describe('Change Theme', () => {
);
expect(themeMode).toBe('light');
const lightButton = page.locator('[data-testid=change-theme-dark]');
await page.mouse.move(0, 0);
await page.waitForTimeout(50);
expect(await lightButton.isVisible()).toBe(false);
const rightMenu = page.getByTestId('editor-option-menu');
const rightMenuBox = await rightMenu.boundingBox();
const lightButton = page.getByTestId('change-theme-light');
const lightButtonBox = await lightButton.boundingBox();
const darkButton = page.getByTestId('change-theme-dark');
const darkButtonBox = await darkButton.boundingBox();
if (!rightMenuBox || !lightButtonBox || !darkButtonBox) {
throw new Error('rightMenuBox or lightButtonBox or darkButtonBox is nil');
}
expect(darkButtonBox.x).toBeLessThan(rightMenuBox.x);
expect(darkButtonBox.y).toBeGreaterThan(rightMenuBox.y);
expect(lightButtonBox.y).toBeCloseTo(rightMenuBox.y);
expect(lightButtonBox.x).toBeCloseTo(darkButtonBox.x);
});
// test('change theme to dark', async ({ page }) => {