2023-04-25 06:12:48 +03:00
|
|
|
import { expect } from '@playwright/test';
|
2023-04-28 09:40:44 +03:00
|
|
|
|
2023-05-09 10:30:01 +03:00
|
|
|
import { test } from './fixture';
|
2023-04-28 09:40:44 +03:00
|
|
|
|
2023-05-09 10:30:01 +03:00
|
|
|
test('new page', async ({ page, workspace }) => {
|
2023-04-25 02:53:36 +03:00
|
|
|
await page.getByTestId('new-page-button').click({
|
|
|
|
delay: 100,
|
|
|
|
});
|
|
|
|
await page.waitForSelector('v-line');
|
2023-05-09 10:30:01 +03:00
|
|
|
const flavour = (await workspace.current()).flavour;
|
2023-04-25 02:53:36 +03:00
|
|
|
expect(flavour).toBe('local');
|
|
|
|
});
|
2023-04-28 09:26:14 +03:00
|
|
|
|
2023-05-09 10:30:01 +03:00
|
|
|
test('app theme', async ({ page, electronApp }) => {
|
2023-04-28 09:40:44 +03:00
|
|
|
const root = page.locator('html');
|
|
|
|
{
|
|
|
|
const themeMode = await root.evaluate(element =>
|
|
|
|
element.getAttribute('data-theme')
|
|
|
|
);
|
|
|
|
expect(themeMode).toBe('light');
|
2023-05-09 10:30:01 +03:00
|
|
|
|
2023-05-10 06:04:36 +03:00
|
|
|
const theme = await electronApp.evaluate(({ nativeTheme }) => {
|
|
|
|
return nativeTheme.shouldUseDarkColors ? 'dark' : 'light';
|
2023-05-09 10:30:01 +03:00
|
|
|
});
|
|
|
|
|
2023-05-10 06:04:36 +03:00
|
|
|
expect(theme).toBe('light');
|
2023-04-28 09:40:44 +03:00
|
|
|
}
|
2023-05-09 10:30:01 +03:00
|
|
|
|
2023-04-28 09:40:44 +03:00
|
|
|
{
|
2023-05-09 10:30:01 +03:00
|
|
|
await page.getByTestId('editor-option-menu').click();
|
|
|
|
await page.getByTestId('change-theme-dark').click();
|
|
|
|
await page.waitForTimeout(50);
|
2023-05-10 06:04:36 +03:00
|
|
|
const themeMode = await root.evaluate(element =>
|
|
|
|
element.getAttribute('data-theme')
|
|
|
|
);
|
|
|
|
expect(themeMode).toBe('dark');
|
|
|
|
const theme = await electronApp.evaluate(({ nativeTheme }) => {
|
|
|
|
return nativeTheme.shouldUseDarkColors ? 'dark' : 'light';
|
2023-05-09 10:30:01 +03:00
|
|
|
});
|
2023-05-10 06:04:36 +03:00
|
|
|
expect(theme).toBe('dark');
|
2023-04-28 09:40:44 +03:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2023-05-09 10:30:01 +03:00
|
|
|
test('affine cloud disabled', async ({ page }) => {
|
2023-04-28 09:26:14 +03:00
|
|
|
await page.getByTestId('new-page-button').click({
|
|
|
|
delay: 100,
|
|
|
|
});
|
|
|
|
await page.waitForSelector('v-line');
|
|
|
|
await page.getByTestId('current-workspace').click();
|
|
|
|
await page.getByTestId('sign-in-button').click();
|
|
|
|
await page.getByTestId('disable-affine-cloud-modal').waitFor({
|
|
|
|
state: 'visible',
|
|
|
|
});
|
|
|
|
});
|
2023-05-09 10:30:01 +03:00
|
|
|
|
|
|
|
test('affine onboarding button', async ({ page }) => {
|
2023-05-04 10:29:16 +03:00
|
|
|
await page.getByTestId('help-island').click();
|
|
|
|
await page.getByTestId('easy-guide').click();
|
|
|
|
const onboardingModal = page.locator('[data-testid=onboarding-modal]');
|
|
|
|
expect(await onboardingModal.isVisible()).toEqual(true);
|
|
|
|
const switchVideo = page.locator(
|
|
|
|
'[data-testid=onboarding-modal-switch-video]'
|
|
|
|
);
|
|
|
|
expect(await switchVideo.isVisible()).toEqual(true);
|
|
|
|
await page.getByTestId('onboarding-modal-next-button').click();
|
|
|
|
const editingVideo = page.locator(
|
|
|
|
'[data-testid=onboarding-modal-editing-video]'
|
|
|
|
);
|
|
|
|
expect(await editingVideo.isVisible()).toEqual(true);
|
|
|
|
await page.getByTestId('onboarding-modal-ok-button').click();
|
|
|
|
|
|
|
|
expect(await onboardingModal.isVisible()).toEqual(false);
|
|
|
|
});
|