2023-03-08 21:40:25 +03:00
|
|
|
import { expect } from '@playwright/test';
|
|
|
|
|
2023-03-24 01:15:40 +03:00
|
|
|
import { openHomePage } from '../libs/load-page';
|
2023-03-28 08:25:16 +03:00
|
|
|
import { waitMarkdownImported } from '../libs/page-logic';
|
2023-03-24 01:15:40 +03:00
|
|
|
import { test } from '../libs/playwright';
|
|
|
|
import { createWorkspace } from '../libs/workspace';
|
2023-03-08 21:40:25 +03:00
|
|
|
|
|
|
|
test.describe('Open AFFiNE', () => {
|
|
|
|
test('Open last workspace when back to affine', async ({ page }) => {
|
2023-03-24 01:15:40 +03:00
|
|
|
await openHomePage(page);
|
2023-03-28 08:25:16 +03:00
|
|
|
await waitMarkdownImported(page);
|
2023-03-08 21:40:25 +03:00
|
|
|
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
|
|
|
|
await page.waitForTimeout(3000);
|
|
|
|
// show workspace list
|
|
|
|
await page.getByTestId('workspace-name').click();
|
|
|
|
|
|
|
|
//check workspace list length
|
|
|
|
const workspaceCards = await page.$$('data-testid=workspace-card');
|
|
|
|
expect(workspaceCards.length).toBe(2);
|
|
|
|
await workspaceCards[1].click();
|
2023-04-14 23:03:16 +03:00
|
|
|
await openHomePage(page);
|
2023-03-08 21:40:25 +03:00
|
|
|
|
|
|
|
const workspaceNameDom = await page.getByTestId('workspace-name');
|
|
|
|
const currentWorkspaceName = await workspaceNameDom.evaluate(
|
|
|
|
node => node.textContent
|
|
|
|
);
|
|
|
|
expect(currentWorkspaceName).toEqual('New Workspace 2');
|
|
|
|
});
|
|
|
|
});
|
2023-03-30 23:17:36 +03:00
|
|
|
|
|
|
|
test.describe('AFFiNE change log', () => {
|
|
|
|
test('Open affine in first time after updated', async ({ page }) => {
|
|
|
|
await openHomePage(page);
|
|
|
|
const changeLogItem = page.locator('[data-testid=change-log]');
|
|
|
|
await expect(changeLogItem).toBeVisible();
|
|
|
|
const closeButton = page.locator('[data-testid=change-log-close-button]');
|
|
|
|
await closeButton.click();
|
|
|
|
await expect(changeLogItem).not.toBeVisible();
|
|
|
|
await page.goto('http://localhost:8080');
|
|
|
|
const currentChangeLogItem = page.locator('[data-testid=change-log]');
|
|
|
|
await expect(currentChangeLogItem).not.toBeVisible();
|
|
|
|
});
|
|
|
|
test('Click right-bottom corner change log icon', async ({ page }) => {
|
|
|
|
await openHomePage(page);
|
|
|
|
await waitMarkdownImported(page);
|
|
|
|
await page.locator('[data-testid=help-island]').click();
|
|
|
|
const editorRightBottomChangeLog = page.locator(
|
|
|
|
'[data-testid=right-bottom-change-log-icon]'
|
|
|
|
);
|
2023-04-14 00:22:49 +03:00
|
|
|
await page.waitForTimeout(50);
|
2023-03-30 23:17:36 +03:00
|
|
|
expect(await editorRightBottomChangeLog.isVisible()).toEqual(true);
|
|
|
|
await page.getByRole('link', { name: 'All pages' }).click();
|
|
|
|
const normalRightBottomChangeLog = page.locator(
|
|
|
|
'[data-testid=right-bottom-change-log-icon]'
|
|
|
|
);
|
|
|
|
expect(await normalRightBottomChangeLog.isVisible()).toEqual(true);
|
|
|
|
});
|
|
|
|
});
|