AFFiNE/tests/affine-local/e2e/open-affine.spec.ts

43 lines
1.6 KiB
TypeScript
Raw Normal View History

import { test } from '@affine-test/kit/playwright';
import { openHomePage } from '@affine-test/kit/utils/load-page';
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';
import { expect } from '@playwright/test';
test('Open last workspace when back to affine', async ({ page }) => {
await openHomePage(page);
await waitForEditorLoad(page);
2023-09-02 08:57:04 +03:00
await createLocalWorkspace({ name: 'New Workspace 2' }, page);
await waitForEditorLoad(page);
// 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();
await openHomePage(page);
const workspaceNameDom = page.getByTestId('workspace-name');
const currentWorkspaceName = await workspaceNameDom.evaluate(
node => node.textContent
);
expect(currentWorkspaceName).toEqual('New Workspace 2');
});
test('Download client tip', async ({ page }) => {
2023-05-09 19:07:34 +03:00
await openHomePage(page);
const localDemoTipsItem = page.locator('[data-testid=local-demo-tips]');
await expect(localDemoTipsItem).toBeVisible();
2023-05-09 19:07:34 +03:00
const closeButton = page.locator(
'[data-testid=local-demo-tips-close-button]'
2023-05-09 19:07:34 +03:00
);
await closeButton.click();
await expect(localDemoTipsItem).not.toBeVisible();
await page.reload();
const currentLocalDemoTipsItemItem = page.locator(
'[data-testid=local-demo-tips]'
2023-05-09 19:07:34 +03:00
);
await expect(currentLocalDemoTipsItemItem).toBeVisible();
2023-05-09 19:07:34 +03:00
});