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.

1.7 KB
Raw Blame
import { expect } from '@playwright/test';

import { test } from '../base/base-test';

test.describe('AIAction/BrainstormIdeasWithMindMap', () => {
  test.beforeEach(async ({ loggedInPage: page, utils }) => {
    await utils.testUtils.setupTestEnvironment(page);
    await utils.chatPanel.openChatPanel(page);
  });

  test('should generate a mind map for the selected content', async ({
    loggedInPage: page,
    utils,
  }) => {
    const { brainstormMindMap } = await utils.editor.askAIWithText(
      page,
      'Panda'
    );
    const { answer, responses } = await brainstormMindMap();
    await expect(answer.locator('mini-mindmap-preview')).toBeVisible();
    expect(responses).toEqual(new Set(['insert-below']));
  });

  test('should generate a mind map for the selected text block in edgeless', async ({
    loggedInPage: page,
    utils,
  }) => {
    const { brainstormMindMap } = await utils.editor.askAIWithEdgeless(
      page,
      async () => {
        await utils.editor.createEdgelessText(page, 'Panda');
      }
    );
    const { answer, responses } = await brainstormMindMap();
    await expect(answer.locator('mini-mindmap-preview')).toBeVisible();
    expect(responses).toEqual(new Set(['insert-below']));
  });

  test('should generate a mind map for the selected note block in edgeless', async ({
    loggedInPage: page,
    utils,
  }) => {
    const { brainstormMindMap } = await utils.editor.askAIWithEdgeless(
      page,
      async () => {
        await utils.editor.createEdgelessNote(page, 'Panda');
      }
    );
    const { answer, responses } = await brainstormMindMap();
    await expect(answer.locator('mini-mindmap-preview')).toBeVisible();
    expect(responses).toEqual(new Set(['insert-below']));
  });
});