aboutsummaryrefslogtreecommitdiff
path: root/src/tools/yaml-to-json-converter/yaml-to-json.e2e.spec.ts
blob: 10db449571b5aa7b4c0323cf794dbc4830c386b6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { test, expect } from '@playwright/test';

test.describe('Tool - Yaml to json', () => {
  test.beforeEach(async ({ page }) => {
    await page.goto('/yaml-to-json-converter');
  });

  test('Has correct title', async ({ page }) => {
    await expect(page).toHaveTitle('YAML to JSON converter - IT Tools');
  });

  test('Yaml is parsed and output clean json', async ({ page }) => {
    await page.getByTestId('input').fill('foo: bar\nlist:\n  - item\n  - key: value');

    const generatedJson = await page.getByTestId('area-content').innerText();

    expect(generatedJson.trim()).toEqual(
      `
{
   "foo": "bar",
   "list": [
      "item",
      {
         "key": "value"
      }
   ]
}
   `.trim(),
    );
  });
});