94 lines
5.4 KiB
TypeScript
94 lines
5.4 KiB
TypeScript
import { expect, test } from '../../fixtures/multi-client';
|
|
import { RegisterPage } from '../../pages/register.page';
|
|
import { ServerSearchPage } from '../../pages/server-search.page';
|
|
|
|
test.describe('Plugin manager UI', () => {
|
|
test.describe.configure({ timeout: 180_000 });
|
|
|
|
test('installs, grants, activates, and logs an all-API test plugin', async ({ createClient }) => {
|
|
const client = await createClient();
|
|
const { page } = client;
|
|
const suffix = Date.now();
|
|
const register = new RegisterPage(page);
|
|
const search = new ServerSearchPage(page);
|
|
|
|
await test.step('Register user and create server context', async () => {
|
|
await register.goto();
|
|
await register.register(`plugin_${suffix}`, 'Plugin Tester', 'TestPass123!');
|
|
await expect(page.getByPlaceholder('Search servers and users...')).toBeVisible({ timeout: 30_000 });
|
|
await search.createServer(`Plugin API Server ${suffix}`, {
|
|
description: 'Plugin manager UI E2E coverage'
|
|
});
|
|
|
|
await expect(page).toHaveURL(/\/room\//, { timeout: 30_000 });
|
|
});
|
|
|
|
await test.step('Open visible Plugins button', async () => {
|
|
await page.getByRole('button', { name: 'Plugins' }).click();
|
|
await expect(page).toHaveURL(/\/plugin-store/, { timeout: 10_000 });
|
|
await expect(page.getByTestId('plugin-store-page')).toBeVisible({ timeout: 10_000 });
|
|
});
|
|
|
|
await test.step('Install fixture plugin from source manifest', async () => {
|
|
await page.getByLabel('Plugin source manifest URL').fill('http://localhost:4200/plugins/e2e-plugin-source.json');
|
|
await page.getByRole('button', { name: 'Add Source' }).click();
|
|
await expect(page.getByRole('heading', { name: 'E2E All API Plugin' })).toBeVisible({ timeout: 15_000 });
|
|
await page.getByRole('button', { name: 'Readme' }).click();
|
|
await expect(page.getByText('Fixture plugin for Playwright coverage.')).toBeVisible({ timeout: 10_000 });
|
|
await page.getByRole('button', { exact: true, name: /^(Install|Install to Server)$/ }).click();
|
|
const installDialog = page.getByRole('dialog', { name: 'E2E All API Plugin' });
|
|
|
|
await expect(installDialog).toBeVisible({ timeout: 10_000 });
|
|
await expect(installDialog.getByText('Install to server', { exact: true })).toBeVisible();
|
|
await page.getByRole('button', { name: 'Install and Activate' }).click();
|
|
await expect(page.locator('article', { hasText: 'E2E All API Plugin' }).getByText('Installed')).toBeVisible({ timeout: 10_000 });
|
|
});
|
|
|
|
await test.step('Open plugin manager from the store page', async () => {
|
|
await page.getByRole('button', { name: 'Manage Plugins' }).click();
|
|
await expect(page.getByTestId('plugin-manager')).toBeVisible({ timeout: 10_000 });
|
|
await expect(page.getByTestId('plugin-manager').getByRole('heading', { name: 'Server plugins' })).toBeVisible();
|
|
await expect(page.getByText('E2E All API Plugin')).toBeVisible();
|
|
});
|
|
|
|
await test.step('Grant capabilities and activate runtime', async () => {
|
|
const manager = page.getByTestId('plugin-manager');
|
|
const pluginCard = manager.locator('article', { hasText: 'E2E All API Plugin' });
|
|
|
|
await manager.getByRole('button', { name: 'Installed' }).click();
|
|
await expect(pluginCard).toBeVisible({ timeout: 10_000 });
|
|
await pluginCard.getByRole('button', { name: 'Select' }).click();
|
|
|
|
await page.getByRole('button', { name: 'Grant all requested' }).click();
|
|
await page.getByRole('button', { name: 'Activate ready plugins' }).click();
|
|
await expect(page.locator('article', { hasText: 'E2E All API Plugin' }).getByText('ready', { exact: true })).toBeVisible({ timeout: 20_000 });
|
|
});
|
|
|
|
await test.step('Verify plugin exercised APIs through logs and extension points', async () => {
|
|
const manager = page.getByTestId('plugin-manager');
|
|
|
|
await manager.getByRole('button', { name: 'Logs' }).click();
|
|
await expect(page.getByText('all-api plugin completed')).toBeVisible({ timeout: 20_000 });
|
|
await expect(page.getByText('all-api plugin ready')).toBeVisible({ timeout: 10_000 });
|
|
await manager.getByRole('button', { name: 'Extension points' }).click();
|
|
await expect(page.getByTestId('plugin-extension-counts')).toContainText('Settings pages');
|
|
await expect(page.getByTestId('plugin-extension-counts')).toContainText('Embed renderers');
|
|
await expect(page.getByTestId('plugin-extension-counts')).toContainText('1');
|
|
await expect(page.getByTestId('plugin-conflict-diagnostics')).toContainText(
|
|
'No duplicate route, action, embed, channel, panel, or settings contribution ids detected.'
|
|
);
|
|
|
|
await manager.getByRole('button', { exact: true, name: 'Requirements' }).click();
|
|
await expect(page.getByTestId('plugin-server-requirements')).toContainText('E2E All API Plugin');
|
|
await expect(page.getByTestId('plugin-server-requirements')).toContainText('enabled');
|
|
|
|
await manager.getByRole('button', { exact: true, name: 'Settings' }).click();
|
|
await expect(page.getByTestId('plugin-generated-settings')).toContainText('E2E settings contribution');
|
|
await expect(page.getByTestId('plugin-generated-settings')).toContainText('"enabled"');
|
|
|
|
await manager.getByRole('button', { exact: true, name: 'Docs' }).click();
|
|
await expect(page.getByTestId('plugin-installed-docs')).toContainText('Calls every public Toju plugin API surface');
|
|
});
|
|
});
|
|
});
|