test: fix e2e (#4390)

This commit is contained in:
Alex Yang
2023-09-16 20:50:26 -07:00
committed by GitHub
parent bebe69d483
commit 40e094dcdd
5 changed files with 13 additions and 7 deletions

View File

@@ -24,7 +24,7 @@ export const NotFoundPage = ({
const t = useAFFiNEI18N();
return (
<div className={notFoundPageContainer}>
<div className={notFoundPageContainer} data-testid="not-found">
<div>
<div className={wrapper}>
<NotFoundPattern />

View File

@@ -3,6 +3,6 @@ import { expect } from '@playwright/test';
test('visit 404 page', async ({ page }) => {
await page.goto('http://localhost:8080/404');
const notFoundTip = page.locator('[data-testid=notFound]');
const notFoundTip = page.getByTestId('not-found');
await expect(notFoundTip).toBeVisible();
});

View File

@@ -21,7 +21,9 @@ test('should create a page with a local first avatar and remove it', async ({
.getByTestId('create-workspace-input')
.type('Test Workspace 1', { delay: 50 });
await page.getByTestId('create-workspace-create-button').click();
await page.getByTestId('workspace-name').click();
await page.getByTestId('workspace-name').click({
delay: 50,
});
await page.getByTestId('workspace-card').nth(1).click();
await page.getByTestId('settings-modal-trigger').click();
await page.getByTestId('current-workspace-label').click();
@@ -29,10 +31,14 @@ test('should create a page with a local first avatar and remove it', async ({
.getByTestId('upload-avatar')
.setInputFiles(resolve(rootDir, 'tests', 'fixtures', 'smile.png'));
await page.mouse.click(0, 0);
await page.getByTestId('workspace-name').click();
await page.getByTestId('workspace-name').click({
delay: 50,
});
await page.getByTestId('workspace-card').nth(0).click();
await page.waitForTimeout(1000);
await page.getByTestId('workspace-name').click();
await page.getByTestId('workspace-name').click({
delay: 50,
});
await page.getByTestId('workspace-card').nth(1).click();
const blobUrl = await page
.getByTestId('workspace-avatar')

View File

@@ -137,7 +137,7 @@ test('Navigate to the 404 page and try to open quick search', async ({
page,
}) => {
await page.goto('http://localhost:8080/404');
const notFoundTip = page.locator('[data-testid=notFound]');
const notFoundTip = page.getByTestId('not-found');
await expect(notFoundTip).toBeVisible();
await openQuickSearchByShortcut(page);
const quickSearch = page.locator('[data-testid=quickSearch]');

View File

@@ -9,7 +9,7 @@ test('goto not found page', async ({ page }) => {
const currentUrl = page.url();
const invalidUrl = currentUrl.replace('hello-world', 'invalid');
await page.goto(invalidUrl);
await expect(page.getByTestId('notFound')).toBeVisible();
await expect(page.getByTestId('not-found')).toBeVisible();
});
test('goto not found workspace', async ({ page }) => {