2023-04-25 06:12:48 +03:00
|
|
|
import { test } from '@affine-test/kit/playwright';
|
2023-07-13 12:05:01 +03:00
|
|
|
import { openHomePage } from '@affine-test/kit/utils/load-page';
|
2023-09-02 06:31:07 +03:00
|
|
|
import { waitForEditorLoad } from '@affine-test/kit/utils/page-logic';
|
2023-09-02 08:57:04 +03:00
|
|
|
import { createLocalWorkspace } from '@affine-test/kit/utils/workspace';
|
2023-03-08 21:40:25 +03:00
|
|
|
import { expect } from '@playwright/test';
|
|
|
|
|
2023-04-17 00:02:41 +03:00
|
|
|
test('Open last workspace when back to affine', async ({ page }) => {
|
|
|
|
await openHomePage(page);
|
2023-09-02 06:31:07 +03:00
|
|
|
await waitForEditorLoad(page);
|
2023-09-02 08:57:04 +03:00
|
|
|
await createLocalWorkspace({ name: 'New Workspace 2' }, page);
|
2023-09-02 06:31:07 +03:00
|
|
|
await waitForEditorLoad(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-06-07 12:31:54 +03:00
|
|
|
const workspaceNameDom = page.getByTestId('workspace-name');
|
2023-04-17 00:02:41 +03:00
|
|
|
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-07-18 19:53:10 +03:00
|
|
|
test.skip('Download client tip', async ({ page }) => {
|
2023-05-09 19:07:34 +03:00
|
|
|
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]'
|
|
|
|
);
|
2023-07-17 12:45:02 +03:00
|
|
|
await expect(currentDownloadClientTipItem).toBeVisible();
|
2023-05-09 19:07:34 +03:00
|
|
|
});
|
2023-08-13 16:36:29 +03:00
|
|
|
|
|
|
|
test('Check the class name for the scrollbar', async ({ page }) => {
|
|
|
|
//Because the scroll bar in page mode depends on the class name of blocksuite
|
|
|
|
await openHomePage(page);
|
2023-09-02 06:31:07 +03:00
|
|
|
await waitForEditorLoad(page);
|
2023-08-13 16:36:29 +03:00
|
|
|
const affineDocViewport = page.locator('.affine-doc-viewport');
|
|
|
|
await expect(affineDocViewport).toBeVisible();
|
|
|
|
});
|