Skip to content

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.

990 B
Raw Blame
// eslint-disable no-empty-pattern
import { test as base } from '@affine-test/kit/playwright';
import type { Page } from '@playwright/test';

import { ChatPanelUtils } from '../utils/chat-panel-utils';
import { EditorUtils } from '../utils/editor-utils';
import { TestUtils } from '../utils/test-utils';

interface TestUtilsFixtures {
  utils: {
    testUtils: TestUtils;
    chatPanel: typeof ChatPanelUtils;
    editor: typeof EditorUtils;
  };
  loggedInPage: Page;
}

export const test = base.extend<TestUtilsFixtures>({
  utils: async ({}, use) => {
    const testUtils = TestUtils.getInstance();
    await use({
      testUtils,
      chatPanel: ChatPanelUtils,
      editor: EditorUtils,
    });
  },
  loggedInPage: async ({ browser }, use) => {
    const context = await browser.newContext({
      storageState: 'storageState.json',
    });
    const page = await context.newPage();
    await use(page);
    await context.close();
  },
});

export type TestFixtures = typeof test;