From 582aed87446591c1f8c5556c218fd07c047814b0 Mon Sep 17 00:00:00 2001 From: DarkSky Date: Sat, 31 Dec 2022 01:59:07 +0800 Subject: [PATCH] Squash all commit from feat/cloud-sync --- .changeset/config.json | 2 +- .github/workflows/build.yml | 1 + .github/workflows/changlog.yml | 2 +- .github/workflows/temp_test.yml | 23 +++++-------------- package.json | 3 ++- packages/app/src/components/header/header.tsx | 4 ++-- .../components/workspace-slider-bar/index.tsx | 8 +++---- tests/change-page-mode.spec.ts | 2 +- tests/contact-us.spec.ts | 11 +++++++-- tests/local-first-delete-page.spec.ts | 2 +- tests/local-first-export-page.spec.ts | 2 +- tests/local-first-favorite-page.spec.ts | 2 +- tests/local-first-favorites-items.spec.ts | 2 +- tests/local-first-new-page.spec.ts | 2 +- tests/local-first-openpage-newtab.spec.ts | 2 +- tests/local-first-show-delete-modal.spec.ts | 2 +- tests/local-first-trash-page.spec.ts | 2 +- tests/local-first-workspace.spec.ts | 2 +- tests/login.spec.ts | 2 +- 19 files changed, 37 insertions(+), 39 deletions(-) diff --git a/.changeset/config.json b/.changeset/config.json index 1304e4b714..1892e1a308 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -5,7 +5,7 @@ "fixed": [], "linked": [], "access": "restricted", - "baseBranch": "feat/filesystem_and_search", + "baseBranch": "feat/cloud-sync", "updateInternalDependencies": "patch", "ignore": [] } diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 205e9664d3..f4f2a94d66 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -71,6 +71,7 @@ jobs: uses: actions/upload-artifact@v3 with: path: ./packages/app/.next + lint: name: Lint and E2E Test runs-on: ubuntu-latest diff --git a/.github/workflows/changlog.yml b/.github/workflows/changlog.yml index 75adf3230f..6a4ced3e20 100644 --- a/.github/workflows/changlog.yml +++ b/.github/workflows/changlog.yml @@ -2,7 +2,7 @@ name: Pathfinder changelog on: push: - branches: [feat/filesystem_and_search, master] + branches: [feat/cloud-sync, master] # Cancels all previous workflow runs for pull requests that have not completed. # See https://docs.github.com/en/actions/using-jobs/using-concurrency diff --git a/.github/workflows/temp_test.yml b/.github/workflows/temp_test.yml index 68c99a8fca..a1fa93bdf0 100644 --- a/.github/workflows/temp_test.yml +++ b/.github/workflows/temp_test.yml @@ -2,9 +2,9 @@ name: Pathfinder Check on: push: - branches: [feat/filesystem_and_search, pathfinder1.1] + branches: [feat/cloud-sync] pull_request: - branches: [feat/filesystem_and_search, pathfinder1.1] + branches: [feat/cloud-sync] # Cancels all previous workflow runs for pull requests that have not completed. # See https://docs.github.com/en/actions/using-jobs/using-concurrency @@ -111,10 +111,13 @@ jobs: with: name: artifact path: packages/app/.next/ - # Temporary shutdown of E2E testing + - name: Lint & E2E Test run: | pnpm lint --max-warnings=0 + PLAYWRIGHT_BROWSERS_PATH=0 npx playwright install chromium + PLAYWRIGHT_BROWSERS_PATH=0 pnpm test + PLAYWRIGHT_BROWSERS_PATH=0 pnpm test:dc env: NEXT_PUBLIC_FIREBASE_API_KEY: ${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }} NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: ${{ secrets.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN }} @@ -123,17 +126,3 @@ jobs: NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID }} NEXT_PUBLIC_FIREBASE_APP_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_APP_ID }} NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID }} - # - name: Lint & E2E Test - # run: | - # pnpm lint --max-warnings=0 - # PLAYWRIGHT_BROWSERS_PATH=0 npx playwright install chromium - # PLAYWRIGHT_BROWSERS_PATH=0 pnpm test - # PLAYWRIGHT_BROWSERS_PATH=0 pnpm test:dc - # env: - # NEXT_PUBLIC_FIREBASE_API_KEY: ${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }} - # NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: ${{ secrets.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN }} - # NEXT_PUBLIC_FIREBASE_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_PROJECT_ID }} - # NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET: ${{ secrets.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET }} - # NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID }} - # NEXT_PUBLIC_FIREBASE_APP_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_APP_ID }} - # NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID }} diff --git a/package.json b/package.json index 2bb9544346..4dfae84b48 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "test:e2e:codegen": "npx playwright codegen http://localhost:8080", "test:unit": "jest", "postinstall": "husky install", - "notify": "node --experimental-modules scripts/notify.mjs" + "notify": "node --experimental-modules scripts/notify.mjs", + "check:ci": "pnpm lint & pnpm test" }, "lint-staged": { "*": "prettier --write --ignore-unknown", diff --git a/packages/app/src/components/header/header.tsx b/packages/app/src/components/header/header.tsx index 21d99f01ce..919d89d7be 100644 --- a/packages/app/src/components/header/header.tsx +++ b/packages/app/src/components/header/header.tsx @@ -11,7 +11,7 @@ import { getWarningMessage, shouldShowWarning } from './utils'; import EditorOptionMenu from './header-right-items/editor-option-menu'; import TrashButtonGroup from './header-right-items/trash-button-group'; import ThemeModeSwitch from './header-right-items/theme-mode-switch'; -// import SyncUser from './header-right-items/sync-user'; +import SyncUser from './header-right-items/sync-user'; const BrowserWarning = ({ show, @@ -40,7 +40,7 @@ const HeaderRightItems: Record = { editorOptionMenu: , trashButtonGroup: , themeModeSwitch: , - syncUser: null, + syncUser: , }; export const Header = ({ diff --git a/packages/app/src/components/workspace-slider-bar/index.tsx b/packages/app/src/components/workspace-slider-bar/index.tsx index b40c268b90..b2f2ef9bdd 100644 --- a/packages/app/src/components/workspace-slider-bar/index.tsx +++ b/packages/app/src/components/workspace-slider-bar/index.tsx @@ -4,7 +4,7 @@ import { StyledArrowButton, StyledLink, StyledListItem, - // StyledListItemForWorkspace, + StyledListItemForWorkspace, StyledNewPageButton, StyledQuickSearch, StyledSliderBar, @@ -12,6 +12,7 @@ import { StyledSubListItem, } from './style'; import { Arrow } from './icons'; +import { WorkspaceSelector } from './WorkspaceSelector'; import Collapse from '@mui/material/Collapse'; import { ArrowDownIcon, @@ -28,7 +29,6 @@ import { useModal } from '@/providers/global-modal-provider'; import { useAppState } from '@/providers/app-state-provider/context'; import { IconButton } from '@/ui/button'; -// import { WorkspaceSelector } from './WorkspaceSelector'; import useLocalStorage from '@/hooks/use-local-storage'; import usePageMetaList from '@/hooks/use-page-meta-list'; import { usePageHelper } from '@/hooks/use-page-helper'; @@ -114,9 +114,9 @@ export const WorkSpaceSliderBar = () => { - {/* + - */} + { expect(await edgeless.isVisible()).toBe(true); }); - test.skip('Convert to edgeless by editor header items', async ({ page }) => { + test('Convert to edgeless by editor header items', async ({ page }) => { await page .getByTestId('editor-header-items') .getByRole('button') diff --git a/tests/contact-us.spec.ts b/tests/contact-us.spec.ts index 0de055787e..447aea1e02 100644 --- a/tests/contact-us.spec.ts +++ b/tests/contact-us.spec.ts @@ -4,11 +4,18 @@ import { loadPage } from './libs/load-page'; loadPage(); test.describe('Open contact us', () => { - test.skip('Click about us', async ({ page }) => { + test('Click about us', async ({ page }) => { const currentWorkspace = page.getByTestId('current-workspace'); await currentWorkspace.click(); // await page.waitForTimeout(1000); - await page.getByText('About AFFiNE').click(); + await page + .getByRole('tooltip', { + name: 'AFFiNE Log in to sync with affine About AFFiNE', + }) + .locator('div') + .filter({ hasText: 'About AFFiNE' }) + .nth(2) + .click(); const contactUsModal = page.locator( '[data-testid=contact-us-modal-content]' ); diff --git a/tests/local-first-delete-page.spec.ts b/tests/local-first-delete-page.spec.ts index 2e95d8b8d5..b4b0be0140 100644 --- a/tests/local-first-delete-page.spec.ts +++ b/tests/local-first-delete-page.spec.ts @@ -4,7 +4,7 @@ import { loadPage } from './libs/load-page'; loadPage(); test.describe('Local first delete page', () => { - test.skip('New a page , then delete it in all pages, permanently delete it', async ({ + test('New a page , then delete it in all pages, permanently delete it', async ({ page, }) => { await page.getByText('New Page').click(); diff --git a/tests/local-first-export-page.spec.ts b/tests/local-first-export-page.spec.ts index 71d9fd4bd6..fbf7a19357 100644 --- a/tests/local-first-export-page.spec.ts +++ b/tests/local-first-export-page.spec.ts @@ -3,7 +3,7 @@ import { loadPage } from './libs/load-page'; loadPage(); -test.describe.skip('Local first export page', () => { +test.describe('Local first export page', () => { test('New a page ,then open it and export html', async ({ page }) => { await page.getByText('New Page').click(); await page.getByPlaceholder('Title').click(); diff --git a/tests/local-first-favorite-page.spec.ts b/tests/local-first-favorite-page.spec.ts index 7a7aec1331..aa95da1b89 100644 --- a/tests/local-first-favorite-page.spec.ts +++ b/tests/local-first-favorite-page.spec.ts @@ -3,7 +3,7 @@ import { loadPage } from './libs/load-page'; loadPage(); -test.describe.skip('Local first favorite and cancel favorite page', () => { +test.describe('Local first favorite and cancel favorite page', () => { test('New a page and open it ,then favorite it', async ({ page }) => { await page.getByText('New Page').click(); await page.getByPlaceholder('Title').click(); diff --git a/tests/local-first-favorites-items.spec.ts b/tests/local-first-favorites-items.spec.ts index 85e3d3c903..68e6fbb5ad 100644 --- a/tests/local-first-favorites-items.spec.ts +++ b/tests/local-first-favorites-items.spec.ts @@ -3,7 +3,7 @@ import { loadPage } from './libs/load-page'; loadPage(); -test.describe.skip('Local first favorite items ui', () => { +test.describe('Local first favorite items ui', () => { test('Show favorite items in sidebar', async ({ page }) => { await page.getByText('New Page').click(); await page.getByPlaceholder('Title').click(); diff --git a/tests/local-first-new-page.spec.ts b/tests/local-first-new-page.spec.ts index a6753cbc2e..6a59ad94bb 100644 --- a/tests/local-first-new-page.spec.ts +++ b/tests/local-first-new-page.spec.ts @@ -3,7 +3,7 @@ import { loadPage } from './libs/load-page'; loadPage(); -test.describe.skip('local first new page', () => { +test.describe('local first new page', () => { test('click btn new page', async ({ page }) => { const originPageId = page.url().split('/').reverse()[0]; await page.getByText('New Page').click(); diff --git a/tests/local-first-openpage-newtab.spec.ts b/tests/local-first-openpage-newtab.spec.ts index b7e698345e..d1a13671aa 100644 --- a/tests/local-first-openpage-newtab.spec.ts +++ b/tests/local-first-openpage-newtab.spec.ts @@ -3,7 +3,7 @@ import { loadPage } from './libs/load-page'; loadPage(); -test.describe.skip('local first new page', () => { +test.describe('local first new page', () => { test('click btn bew page and open in tab', async ({ page }) => { await page.getByText('New Page').click(); await page.getByPlaceholder('Title').click(); diff --git a/tests/local-first-show-delete-modal.spec.ts b/tests/local-first-show-delete-modal.spec.ts index a2cf040b7e..0ec72e3bdc 100644 --- a/tests/local-first-show-delete-modal.spec.ts +++ b/tests/local-first-show-delete-modal.spec.ts @@ -3,7 +3,7 @@ import { loadPage } from './libs/load-page'; loadPage(); -test.describe.skip('Local first delete page', () => { +test.describe('Local first delete page', () => { test('New a page ,then open it and show delete modal', async ({ page }) => { await page.getByText('New Page').click(); await page.getByPlaceholder('Title').click(); diff --git a/tests/local-first-trash-page.spec.ts b/tests/local-first-trash-page.spec.ts index a25c4696b8..9360a618e3 100644 --- a/tests/local-first-trash-page.spec.ts +++ b/tests/local-first-trash-page.spec.ts @@ -3,7 +3,7 @@ import { loadPage } from './libs/load-page'; loadPage(); -test.describe.skip('Local first trash page', () => { +test.describe('Local first trash page', () => { test('New a page , then delete it in all pages, finally find it in trash', async ({ page, }) => { diff --git a/tests/local-first-workspace.spec.ts b/tests/local-first-workspace.spec.ts index 6aaf66786b..f3c1ba9e1c 100644 --- a/tests/local-first-workspace.spec.ts +++ b/tests/local-first-workspace.spec.ts @@ -3,7 +3,7 @@ import { loadPage } from './libs/load-page'; loadPage(); -test.describe.skip('Local first default workspace', () => { +test.describe('Local first default workspace', () => { test('Default workspace name', async ({ page }) => { const workspaceName = page.getByTestId('workspace-name'); expect(await workspaceName.textContent()).toBe('AFFiNE'); diff --git a/tests/login.spec.ts b/tests/login.spec.ts index 24e45092f5..b519bffa21 100644 --- a/tests/login.spec.ts +++ b/tests/login.spec.ts @@ -3,7 +3,7 @@ import { loadPage } from './libs/load-page'; loadPage(); -test.describe.skip('Login Flow', () => { +test.describe('Login Flow', () => { test('Open login modal by click current workspace', async ({ page }) => { await page.getByTestId('current-workspace').click(); await page.waitForTimeout(800);