Zum Inhalt

tests/e2e/multi-species.spec.ts

import { expect, test } from '@playwright/test';

test('editor shows global, species and matrix sections', async ({ page }) => {
  await page.goto('/');
  await page.waitForTimeout(500);
  await page.keyboard.press('e');
  await expect(page.getByText('Global', { exact: true })).toBeVisible();
  await expect(page.getByText('Species', { exact: true })).toBeVisible();
  await expect(page.getByText('Interaction Matrix')).toBeVisible();
});

test('species panel exposes per-species parameters', async ({ page }) => {
  await page.goto('/');
  await page.waitForTimeout(500);
  await page.keyboard.press('e');
  // Spawn pattern is in Global (open by default).
  await expect(page.getByText('Spawn pattern')).toBeVisible();
  // Species section is collapsed by default — expand it and verify a slider
  // that is visible in the default "All" tab (Population share is hidden in
  // All because it'd normalise to 1/3 / 1/3 / 1/3 regardless of value).
  await page.getByRole('button', { name: /Species/ }).click();
  await expect(page.getByText('Move speed')).toBeVisible();
});

test('library lists multiple multi-species presets', async ({ page }) => {
  await page.goto('/');
  await page.waitForTimeout(500);
  await page.keyboard.press('l');
  await expect(page.getByText('Dreamy').first()).toBeVisible();
  await expect(page.getByText('Mystic')).toBeVisible();
});

test('respawn hotkey keeps the app alive', async ({ page }) => {
  await page.goto('/');
  await page.waitForTimeout(500);
  await page.keyboard.press('r');
  await page.waitForTimeout(300);
  await expect(page.getByText('Physarum')).toBeVisible();
});