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.1 KB
Raw Blame
import { expect } from '@playwright/test';

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

test.describe('AIBasic/Authority', () => {
  test.beforeEach(async ({ page, utils }) => {
    // Sign out
    await utils.testUtils.setupTestEnvironment(page);
    await utils.chatPanel.openChatPanel(page);
  });

  test('should show messages placeholder when no login', async ({ page }) => {
    await expect(
      page.getByTestId('chat-panel-messages-placeholder')
    ).toBeVisible();
  });

  test('should show error & login button when no login', async ({
    page,
    utils,
  }) => {
    await utils.chatPanel.makeChat(page, 'Hello');

    await expect(page.getByTestId('ai-error')).toBeVisible();
    await expect(page.getByTestId('ai-error-action-button')).toBeVisible();
  });

  test('should support login in error state', async ({ page, utils }) => {
    await utils.chatPanel.makeChat(page, 'Hello');
    const loginButton = page.getByTestId('ai-error-action-button');
    await loginButton.click();

    await expect(page.getByTestId('auth-modal')).toBeVisible();
  });
});