There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
fix: test case (#3686)
JimmFlyf0cbbc3a8413
diff --git a/tests/affine-local/e2e/all-page.spec.ts b/tests/affine-local/e2e/all-page.spec.tsindex 14acffb989..6b74b3007a 100644--- a/tests/affine-local/e2e/all-page.spec.ts+++ b/tests/affine-local/e2e/all-page.spec.ts@@ -16,7 +16,9 @@ import {import { openHomePage } from '@affine-test/kit/utils/load-page';import {getBlockSuiteEditorTitle,+ newPage,waitEditorLoad,+ waitForAllPagesLoad,} from '@affine-test/kit/utils/page-logic';import { clickSideBarAllPageButton } from '@affine-test/kit/utils/sidebar';import type { Page } from '@playwright/test';@@ -83,10 +85,15 @@ test('allow creation of filters by favorite', async ({ page }) => {).toBe('false');});-test.fixme('allow creation of filters by created time', async ({ page }) => {+test('allow creation of filters by created time', async ({ page }) => {await openHomePage(page);await waitEditorLoad(page);+ await newPage(page);await clickSideBarAllPageButton(page);+ await waitForAllPagesLoad(page);+ const pages = await page.locator('[data-testid="title"]').all();+ const pageCount = pages.length;+ expect(pageCount).not.toBe(0);await createFirstFilter(page, 'Created');await checkFilterName(page, 'after');// init date@@ -108,39 +115,43 @@ test.fixme('allow creation of filters by created time', async ({ page }) => {tomorrow.setDate(tomorrow.getDate() + 1);await fillDatePicker(page, tomorrow);await checkDatePicker(page, tomorrow);- await checkPagesCount(page, 1);+ await checkPagesCount(page, pageCount);});-test.fixme(- 'creation of filters by created time, then click date picker to modify the date',- async ({ page }) => {- await openHomePage(page);- await waitEditorLoad(page);- await clickSideBarAllPageButton(page);- await createFirstFilter(page, 'Created');- await checkFilterName(page, 'after');- // init date- const yesterday = new Date();- yesterday.setDate(yesterday.getDate() - 1);- await checkDatePicker(page, yesterday);- await checkPagesCount(page, 1);- // change date- const today = new Date();- await selectDateFromDatePicker(page, today);- await checkPagesCount(page, 0);- // change filter- await page.locator('[data-testid="filter-name"]').click();- await page- .locator('[data-testid="filter-name-select"]')- .locator('button', { hasText: 'before' })- .click();- const tomorrow = new Date();- tomorrow.setDate(tomorrow.getDate() + 1);- await selectDateFromDatePicker(page, tomorrow);- await checkDatePicker(page, tomorrow);- await checkPagesCount(page, 1);- }-);+test('creation of filters by created time, then click date picker to modify the date', async ({+ page,+}) => {+ await openHomePage(page);+ await waitEditorLoad(page);+ await newPage(page);+ await clickSideBarAllPageButton(page);+ await waitForAllPagesLoad(page);+ const pages = await page.locator('[data-testid="title"]').all();+ const pageCount = pages.length;+ expect(pageCount).not.toBe(0);+ await createFirstFilter(page, 'Created');+ await checkFilterName(page, 'after');+ // init date+ const yesterday = new Date();+ yesterday.setDate(yesterday.getDate() - 1);+ await checkDatePicker(page, yesterday);+ await checkPagesCount(page, 1);+ // change date+ const today = new Date();+ await selectDateFromDatePicker(page, today);+ await checkPagesCount(page, 0);+ // change filter+ await page.locator('[data-testid="filter-name"]').click();+ await page+ .locator('[data-testid="filter-name-select"]')+ .locator('button', { hasText: 'before' })+ .click();+ const tomorrow = new Date();+ tomorrow.setDate(tomorrow.getDate() + 1);+ await selectDateFromDatePicker(page, tomorrow);+ await checkDatePicker(page, tomorrow);+ await checkPagesCount(page, pageCount);+});test('use monthpicker to modify the month of datepicker', async ({ page }) => {await openHomePage(page);@@ -166,20 +177,30 @@ test('use monthpicker to modify the month of datepicker', async ({ page }) => {await checkDatePickerMonth(page, nextMonth);});-test.fixme('allow creation of filters by tags', async ({ page }) => {+test('allow creation of filters by tags', async ({ page }) => {await openHomePage(page);await waitEditorLoad(page);+ await clickSideBarAllPageButton(page);+ await waitForAllPagesLoad(page);+ const pages = await page.locator('[data-testid="title"]').all();+ const pageCount = pages.length;+ expect(pageCount).not.toBe(0);+ await createFirstFilter(page, 'Tags');+ await checkFilterName(page, 'is not empty');+ const pagesWithTags = await page.locator('[data-testid="title"]').all();+ const pagesWithTagsCount = pagesWithTags.length;+ expect(pagesWithTagsCount).not.toBe(0);await createPageWithTag(page, { title: 'Page A', tags: ['A'] });await createPageWithTag(page, { title: 'Page B', tags: ['B'] });await clickSideBarAllPageButton(page);await createFirstFilter(page, 'Tags');await checkFilterName(page, 'is not empty');- await checkPagesCount(page, 2);+ await checkPagesCount(page, pagesWithTagsCount + 2);await changeFilter(page, /^contains all/);- await checkPagesCount(page, 3);+ await checkPagesCount(page, pageCount + 2);await selectTag(page, 'A');await checkPagesCount(page, 1);await changeFilter(page, /^does not contains all/);await selectTag(page, 'B');- await checkPagesCount(page, 2);+ await checkPagesCount(page, pageCount + 1);});diff --git a/tests/affine-local/e2e/local-first-collections-items.spec.ts b/tests/affine-local/e2e/local-first-collections-items.spec.tsindex bdeac477c7..b4917f80e1 100644--- a/tests/affine-local/e2e/local-first-collections-items.spec.ts+++ b/tests/affine-local/e2e/local-first-collections-items.spec.ts@@ -43,7 +43,7 @@ const createAndPinCollection = async (await page.waitForTimeout(100);};-test.fixme('Show collections items in sidebar', async ({ page }) => {+test('Show collections items in sidebar', async ({ page }) => {await createAndPinCollection(page);const collections = page.getByTestId('collections');const items = collections.getByTestId('collection-item');diff --git a/tests/kit/utils/filter.ts b/tests/kit/utils/filter.tsindex f659b33ffa..9bac0d7121 100644--- a/tests/kit/utils/filter.ts+++ b/tests/kit/utils/filter.ts@@ -213,7 +213,7 @@ export async function selectTag(page: Page, name: string | RegExp) {await page.getByTestId('multi-select').getByTestId('select-option')- .getByText(name)+ .getByText(name, { exact: true }).click();await page.getByTestId('filter-arg').click();}diff --git a/tests/kit/utils/page-logic.ts b/tests/kit/utils/page-logic.tsindex e6a8e0521f..07f056f6cd 100644--- a/tests/kit/utils/page-logic.ts+++ b/tests/kit/utils/page-logic.ts@@ -7,6 +7,13 @@ export async function waitEditorLoad(page: Page) {});}+export async function waitForAllPagesLoad(page: Page) {+ // if filters tag is rendered, we believe all_pages is ready+ await page.waitForSelector('[data-testid="create-first-filter"]', {+ timeout: 1000,+ });+}+export async function newPage(page: Page) {// fixme(himself65): if too fast, the page will crashawait page.getByTestId('new-page-button').click({