snapshot of https://github.com/toeverything/AFFiNE.git (canary, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Build & Test / Analyze (javascript, affine) (push) Failing after 4s
Build & Test / Analyze (typescript, affine) (push) Failing after 3s
Build & Test / Rust test filter (push) Failing after 4s
Build & Test / Check yarn binary (push) Failing after 3s
Build & Test / E2E BlockSuite Test (3) (push) Failing after 3s
Build & Test / Analyze (javascript, blocksuite) (push) Failing after 3s
Build & Test / Analyze (typescript, blocksuite) (push) Failing after 3s
Build & Test / Mobile native build filter (push) Failing after 3s
Build & Test / E2E BlockSuite Test (1) (push) Failing after 4s
Build & Test / E2E BlockSuite Test (2) (push) Failing after 4s
Build & Test / E2E Mobile Test (1) (push) Failing after 3s
Build & Test / Unit Test (1) (push) Has been skipped
Build & Test / Unit Test (2) (push) Has been skipped
Build & Test / Unit Test (3) (push) Has been skipped
Build & Test / Unit Test (4) (push) Has been skipped
Build & Test / Unit Test (5) (push) Has been skipped
Build & Test / Native Unit Test (push) Has been skipped
Build & Test / E2E BlockSuite Test (4) (push) Failing after 3s
Build & Test / E2E BlockSuite Test (5) (push) Failing after 3s
Build & Test / E2E BlockSuite Cross Browser Test (push) Failing after 3s
Build & Test / E2E Mobile Test (2) (push) Failing after 3s
Build & Test / Build AFFiNE native (x86_64-unknown-linux-gnu) (push) Failing after 3s
Build & Test / Build Server native (push) Failing after 3s
Build & Test / Check Git Status (push) Has been skipped
Build & Test / Server Test (0, 4) (push) Has been skipped
Build & Test / Server Test (1, 4) (push) Has been skipped
Build & Test / Server Test (2, 4) (push) Has been skipped
Build & Test / Server Test (3, 4) (push) Has been skipped
Build & Test / Server Test with Elasticsearch (push) Has been skipped
Build & Test / Build @affine/electron renderer (push) Failing after 3s
Build & Test / Copilot test filter (push) Failing after 4s
Build & Test / Lint Rust (push) Has been skipped
Build & Test / Server Test with Embedded Search (push) Has been skipped
Build & Test / Server Test with Manticore Search (push) Has been skipped
Build & Test / Server E2E Test (push) Has been skipped
Build & Test / Cloud Desktop E2E Test (push) Has been skipped
Build & Test / Cloud E2E Test 1/2 (push) Has been skipped
Build & Test / Cloud E2E Test 2/2 (push) Has been skipped
Build & Test / Build Android app (push) Has been skipped
Build & Test / Test Android app (push) Has been skipped
Build & Test / Run native tests (push) Has been skipped
Build & Test / Server Copilot Api Test (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (1, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (2, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (3, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (4, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (5, 5) (push) Has been skipped
Release / Canary Gate (push) Has been skipped
Build & Test / Build AFFiNE native (aarch64-apple-darwin) (push) Has been cancelled
Build & Test / Lint (push) Has been cancelled
Build & Test / Typecheck (push) Has been cancelled
Build & Test / Build AFFiNE native (x86_64-apple-darwin) (push) Has been cancelled
Build & Test / Desktop Test (ubuntu-latest, linux, x64, x86_64-unknown-linux-gnu, true) (push) Has been cancelled
Build & Test / Desktop Test (windows-latest, windows, x64, x86_64-pc-windows-msvc, true) (push) Has been cancelled
Build & Test / E2E Test (1) (push) Has been cancelled
Build & Test / E2E Test (2) (push) Has been cancelled
Build & Test / E2E Test (3) (push) Has been cancelled
Build & Test / E2E Test (4) (push) Has been cancelled
Build & Test / E2E Test (5) (push) Has been cancelled
Build & Test / Build AFFiNE native (aarch64-pc-windows-msvc) (push) Has been cancelled
Build & Test / Build AFFiNE native (x86_64-pc-windows-msvc) (push) Has been cancelled
Build & Test / Desktop Test (macos-latest, macos, arm64, aarch64-apple-darwin, true) (push) Has been cancelled
Build & Test / Desktop Test (macos-latest, macos, x64, x86_64-apple-darwin, false) (push) Has been cancelled
Build & Test / 3, 2, 1 Launch (push) Has been cancelled
Build & Test / Build iOS app (push) Has been cancelled
Copilot Test Automatically / Setup Test (push) Failing after 1s
Release / Prepare (push) Failing after 1s
Release / Release Cloud (push) Has been skipped
Release / Release Desktop (push) Has been skipped
Release / Release Mobile (push) Has been skipped
Release / Release Docker Image (push) Has been skipped
Some checks failed
Build & Test / Analyze (javascript, affine) (push) Failing after 4s
Build & Test / Analyze (typescript, affine) (push) Failing after 3s
Build & Test / Rust test filter (push) Failing after 4s
Build & Test / Check yarn binary (push) Failing after 3s
Build & Test / E2E BlockSuite Test (3) (push) Failing after 3s
Build & Test / Analyze (javascript, blocksuite) (push) Failing after 3s
Build & Test / Analyze (typescript, blocksuite) (push) Failing after 3s
Build & Test / Mobile native build filter (push) Failing after 3s
Build & Test / E2E BlockSuite Test (1) (push) Failing after 4s
Build & Test / E2E BlockSuite Test (2) (push) Failing after 4s
Build & Test / E2E Mobile Test (1) (push) Failing after 3s
Build & Test / Unit Test (1) (push) Has been skipped
Build & Test / Unit Test (2) (push) Has been skipped
Build & Test / Unit Test (3) (push) Has been skipped
Build & Test / Unit Test (4) (push) Has been skipped
Build & Test / Unit Test (5) (push) Has been skipped
Build & Test / Native Unit Test (push) Has been skipped
Build & Test / E2E BlockSuite Test (4) (push) Failing after 3s
Build & Test / E2E BlockSuite Test (5) (push) Failing after 3s
Build & Test / E2E BlockSuite Cross Browser Test (push) Failing after 3s
Build & Test / E2E Mobile Test (2) (push) Failing after 3s
Build & Test / Build AFFiNE native (x86_64-unknown-linux-gnu) (push) Failing after 3s
Build & Test / Build Server native (push) Failing after 3s
Build & Test / Check Git Status (push) Has been skipped
Build & Test / Server Test (0, 4) (push) Has been skipped
Build & Test / Server Test (1, 4) (push) Has been skipped
Build & Test / Server Test (2, 4) (push) Has been skipped
Build & Test / Server Test (3, 4) (push) Has been skipped
Build & Test / Server Test with Elasticsearch (push) Has been skipped
Build & Test / Build @affine/electron renderer (push) Failing after 3s
Build & Test / Copilot test filter (push) Failing after 4s
Build & Test / Lint Rust (push) Has been skipped
Build & Test / Server Test with Embedded Search (push) Has been skipped
Build & Test / Server Test with Manticore Search (push) Has been skipped
Build & Test / Server E2E Test (push) Has been skipped
Build & Test / Cloud Desktop E2E Test (push) Has been skipped
Build & Test / Cloud E2E Test 1/2 (push) Has been skipped
Build & Test / Cloud E2E Test 2/2 (push) Has been skipped
Build & Test / Build Android app (push) Has been skipped
Build & Test / Test Android app (push) Has been skipped
Build & Test / Run native tests (push) Has been skipped
Build & Test / Server Copilot Api Test (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (1, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (2, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (3, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (4, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (5, 5) (push) Has been skipped
Release / Canary Gate (push) Has been skipped
Build & Test / Build AFFiNE native (aarch64-apple-darwin) (push) Has been cancelled
Build & Test / Lint (push) Has been cancelled
Build & Test / Typecheck (push) Has been cancelled
Build & Test / Build AFFiNE native (x86_64-apple-darwin) (push) Has been cancelled
Build & Test / Desktop Test (ubuntu-latest, linux, x64, x86_64-unknown-linux-gnu, true) (push) Has been cancelled
Build & Test / Desktop Test (windows-latest, windows, x64, x86_64-pc-windows-msvc, true) (push) Has been cancelled
Build & Test / E2E Test (1) (push) Has been cancelled
Build & Test / E2E Test (2) (push) Has been cancelled
Build & Test / E2E Test (3) (push) Has been cancelled
Build & Test / E2E Test (4) (push) Has been cancelled
Build & Test / E2E Test (5) (push) Has been cancelled
Build & Test / Build AFFiNE native (aarch64-pc-windows-msvc) (push) Has been cancelled
Build & Test / Build AFFiNE native (x86_64-pc-windows-msvc) (push) Has been cancelled
Build & Test / Desktop Test (macos-latest, macos, arm64, aarch64-apple-darwin, true) (push) Has been cancelled
Build & Test / Desktop Test (macos-latest, macos, x64, x86_64-apple-darwin, false) (push) Has been cancelled
Build & Test / 3, 2, 1 Launch (push) Has been cancelled
Build & Test / Build iOS app (push) Has been cancelled
Copilot Test Automatically / Setup Test (push) Failing after 1s
Release / Prepare (push) Failing after 1s
Release / Release Cloud (push) Has been skipped
Release / Release Desktop (push) Has been skipped
Release / Release Mobile (push) Has been skipped
Release / Release Docker Image (push) Has been skipped
This commit is contained in:
159
tests/affine-mobile/e2e/home.spec.ts
Normal file
159
tests/affine-mobile/e2e/home.spec.ts
Normal file
@@ -0,0 +1,159 @@
|
||||
import { test } from '@affine-test/kit/mobile';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { expandCollapsibleSection, pageBack } from './utils';
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
currentWorkspace?: {
|
||||
meta: { id: string; flavour: string };
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
test('after loaded, will land on the home page', async ({ page }) => {
|
||||
await expect(page).toHaveURL(/.*\/home/);
|
||||
});
|
||||
|
||||
test('stale first-open state still restores one local workspace', async ({
|
||||
context,
|
||||
}) => {
|
||||
await context.addInitScript(() => {
|
||||
window.localStorage.setItem('app_config', '{"onBoarding":false}');
|
||||
window.localStorage.setItem('is-first-open', 'false');
|
||||
});
|
||||
const page = await context.newPage();
|
||||
|
||||
await page.goto('http://localhost:8080/');
|
||||
await page.waitForFunction(() => window.currentWorkspace !== undefined);
|
||||
const firstWorkspace = await page.evaluate(async () => {
|
||||
if (!window.currentWorkspace) {
|
||||
await new Promise<void>(resolve => {
|
||||
window.addEventListener('affine:workspace:change', () => resolve(), {
|
||||
once: true,
|
||||
});
|
||||
});
|
||||
}
|
||||
return window.currentWorkspace?.meta;
|
||||
});
|
||||
|
||||
expect(firstWorkspace?.flavour).toBe('local');
|
||||
await page.goto(
|
||||
`http://localhost:8080/workspace/${firstWorkspace?.id ?? ''}/home`
|
||||
);
|
||||
await expect(page.getByRole('searchbox')).toBeVisible();
|
||||
await page
|
||||
.locator('[data-testid="workspace-selector-trigger"]:visible')
|
||||
.click();
|
||||
await expect(
|
||||
page.getByRole('dialog').getByTestId('workspace-avatar')
|
||||
).toHaveCount(1);
|
||||
|
||||
await page.reload();
|
||||
await page.waitForFunction(() => window.currentWorkspace !== undefined);
|
||||
const reloadedWorkspace = await page.evaluate(
|
||||
() => window.currentWorkspace?.meta
|
||||
);
|
||||
expect(reloadedWorkspace?.id).toBe(firstWorkspace?.id);
|
||||
});
|
||||
|
||||
test('workspace selector does not offer workspace creation', async ({
|
||||
page,
|
||||
}) => {
|
||||
await expect(page.getByRole('searchbox')).toBeVisible();
|
||||
await page
|
||||
.locator('[data-testid="workspace-selector-trigger"]:visible')
|
||||
.click();
|
||||
await expect(page.getByText('Workspace', { exact: true })).toBeVisible();
|
||||
await expect(page.getByTestId('new-workspace')).toHaveCount(0);
|
||||
await expect(page.getByText('Name your workspace')).toHaveCount(0);
|
||||
});
|
||||
|
||||
test('app tabs is visible', async ({ page }) => {
|
||||
const tabs = page.locator('#app-tabs');
|
||||
await expect(tabs).toHaveCount(1);
|
||||
await expect(tabs).toBeVisible();
|
||||
|
||||
await expect(tabs.getByRole('tab', { name: 'home' })).toBeVisible();
|
||||
await expect(tabs.getByRole('tab', { name: 'all' })).toBeVisible();
|
||||
await expect(tabs.getByRole('tab', { name: 'journal' })).toBeVisible();
|
||||
await expect(tabs.getByRole('tab', { name: 'new' })).toBeVisible();
|
||||
});
|
||||
|
||||
test('notifications prompt unauthenticated users to sign in', async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.getByTestId('notification-button').tap();
|
||||
const notifications = page.getByText('Sign in to continue');
|
||||
await expect(notifications).toBeVisible();
|
||||
await page.getByRole('button', { name: 'Sign in' }).click();
|
||||
await expect(page.getByTestId('continue-login-button')).toBeVisible();
|
||||
});
|
||||
|
||||
test('recent docs', async ({ page }) => {
|
||||
const recentSection = await expandCollapsibleSection(page, 'recent');
|
||||
|
||||
const docs = recentSection.getByTestId('doc-card');
|
||||
const firstDoc = docs.first();
|
||||
|
||||
await expect(firstDoc).toBeVisible();
|
||||
|
||||
const title = await firstDoc
|
||||
.getByTestId('doc-card-header')
|
||||
.getByRole('heading')
|
||||
.textContent();
|
||||
|
||||
// when click favorite icon, will show in the favorites section
|
||||
await docs.getByRole('button', { name: 'favorite' }).first().click();
|
||||
|
||||
const favList = await expandCollapsibleSection(page, 'favorites');
|
||||
await expect(favList).toBeVisible();
|
||||
|
||||
if (title) {
|
||||
await expect(favList).toContainText(title);
|
||||
}
|
||||
});
|
||||
|
||||
test('all tab', async ({ page }) => {
|
||||
const docsTab = page.locator('#app-tabs').getByRole('tab', { name: 'all' });
|
||||
await expect(docsTab).toBeVisible();
|
||||
|
||||
await docsTab.click();
|
||||
|
||||
const todayDocs = page.getByTestId('doc-list-item');
|
||||
await expect(todayDocs.first()).toBeVisible();
|
||||
expect(await todayDocs.count()).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
test('search restores query and results without reopening the keyboard', async ({
|
||||
page,
|
||||
}) => {
|
||||
await expandCollapsibleSection(page, 'recent');
|
||||
const title = await page
|
||||
.getByTestId('doc-card')
|
||||
.first()
|
||||
.getByTestId('doc-card-header')
|
||||
.getByRole('heading')
|
||||
.textContent();
|
||||
expect(title).toBeTruthy();
|
||||
await page.getByRole('searchbox').click();
|
||||
await expect(page).toHaveURL(/\/search$/);
|
||||
await expect(page.locator('#app-tabs')).toBeHidden();
|
||||
const search = page.getByRole('searchbox');
|
||||
await search.fill(title ?? '');
|
||||
const result = page.locator('[data-scroll] [data-testid="doc-card"]').first();
|
||||
await expect(result).toBeVisible();
|
||||
await result.click();
|
||||
await expect(page).not.toHaveURL(/\/search$/);
|
||||
await pageBack(page);
|
||||
await expect(page).toHaveURL(/\/search$/);
|
||||
await expect(page.getByRole('searchbox')).toHaveValue(title ?? '');
|
||||
await expect(
|
||||
page.locator('[data-scroll] [data-testid="doc-card"]').first()
|
||||
).toBeVisible();
|
||||
expect(
|
||||
await page
|
||||
.getByRole('searchbox')
|
||||
.evaluate(el => el === document.activeElement)
|
||||
).toBe(false);
|
||||
});
|
||||
Reference in New Issue
Block a user