2023-04-25 06:12:48 +03:00
|
|
|
import { test } from '@affine-test/kit/playwright';
|
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 { createWorkspace } from '../libs/workspace';
|
2023-03-08 21:40:25 +03:00
|
|
|
|
2023-04-17 00:02:41 +03:00
|
|
|
test('Open last workspace when back to affine', async ({ page }) => {
|
|
|
|
await openHomePage(page);
|
|
|
|
await waitMarkdownImported(page);
|
|
|
|
await createWorkspace({ name: 'New Workspace 2' }, page);
|
2023-05-12 08:55:45 +03:00
|
|
|
await waitMarkdownImported(page);
|
2023-04-17 00:02:41 +03:00
|
|
|
// show workspace list
|
|
|
|
await page.getByTestId('workspace-name').click();
|
2023-03-08 21:40:25 +03:00
|
|
|
|
2023-04-17 00:02:41 +03:00
|
|
|
//check workspace list length
|
|
|
|
const workspaceCards = await page.$$('data-testid=workspace-card');
|
|
|
|
expect(workspaceCards.length).toBe(2);
|
|
|
|
await workspaceCards[1].click();
|
|
|
|
await openHomePage(page);
|
2023-03-08 21:40:25 +03:00
|
|
|
|
2023-04-17 00:02:41 +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-08 21:40:25 +03:00
|
|
|
});
|
2023-03-30 23:17:36 +03:00
|
|
|
|
2023-05-09 19:07:34 +03:00
|
|
|
test('Download client tip', async ({ page }) => {
|
|
|
|
await openHomePage(page);
|
|
|
|
const downloadClientTipItem = page.locator(
|
|
|
|
'[data-testid=download-client-tip]'
|
|
|
|
);
|
|
|
|
await expect(downloadClientTipItem).toBeVisible();
|
|
|
|
const closeButton = page.locator(
|
|
|
|
'[data-testid=download-client-tip-close-button]'
|
|
|
|
);
|
|
|
|
await closeButton.click();
|
|
|
|
await expect(downloadClientTipItem).not.toBeVisible();
|
|
|
|
await page.goto('http://localhost:8080');
|
|
|
|
const currentDownloadClientTipItem = page.locator(
|
|
|
|
'[data-testid=download-client-tip]'
|
|
|
|
);
|
|
|
|
await expect(currentDownloadClientTipItem).not.toBeVisible();
|
|
|
|
});
|