Brak opisu

templates.spec.js 1.1KB

1234567891011121314151617181920212223242526
  1. import { test, expect } from '@playwright/test';
  2. import crypto from 'node:crypto';
  3. test.beforeEach(async({ page }) => {
  4. await page.goto('/manage/templates');
  5. });
  6. test('should create report template', async ({ page }) => {
  7. await page.getByRole('button', { name: 'Add template' }).click();
  8. const templateName = `The test template name - ${crypto.randomUUID()}`;
  9. await page.getByLabel('Template name', { exact: true }).fill(templateName);
  10. await page.getByRole('button', { name: 'Report type' }).click();
  11. await page.getByRole('listbox').getByRole('option', { name: 'Investigation' }).click();
  12. await page.getByRole('button', { name: 'Language' }).click();
  13. await page.getByRole('listbox').getByRole('option', { name: 'French' }).click();
  14. await page.getByLabel('Template description').fill('description');
  15. await page.getByLabel('Template file :').fill('Generated report name');
  16. await page.locator('input[name="file"]').setInputFiles('./data/report.md');
  17. await page.getByRole('button', { name: 'Save' }).click();
  18. await expect(page.getByRole('link', { name: templateName })).toBeVisible();
  19. });