1
0
resumarkdown/tests/general.test.ts

42 lines
1.4 KiB
TypeScript
Raw Permalink Normal View History

/*
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at https://mozilla.org/MPL/2.0/.
*/
2024-10-10 21:02:54 -05:00
import { expect, test } from '@playwright/test';
2024-10-11 00:03:49 -05:00
test('page has headline', async ({ page }) => {
2024-10-10 21:02:54 -05:00
await page.goto('/');
2024-10-12 23:47:09 -05:00
await expect(page.getByRole('banner')).toHaveText('resumarkdown');
2024-10-10 21:02:54 -05:00
});
2024-10-11 00:23:32 -05:00
2024-10-11 21:25:58 -05:00
test('nav items work', async ({ page }) => {
await page.goto('/');
2024-10-12 01:50:08 -05:00
for (const tab of await page.getByRole('tab').all()) {
await tab.click();
await expect(page.getByTestId(`${await tab.textContent()}-pane`)).toBeVisible();
2024-10-11 21:25:58 -05:00
}
});
2024-10-17 11:49:22 -05:00
test('preview accepts content', async ({ page }) => {
await page.goto('/');
await page.getByText('content').click();
await page.getByRole('textbox').fill('# résumé');
const previewFrame = page.getByTitle('résumé preview').contentFrame();
await expect(previewFrame.getByRole('heading')).toHaveText('résumé');
});
test('preview accepts styles', async ({ page }) => {
await page.goto('/');
await page.getByText('content').click();
await page.getByRole('textbox').fill('# blah');
await page.getByText('style', { exact: true }).click();
await page.getByRole('textbox').fill('h1 { color: red; }');
const previewFrame = page.getByTitle('résumé preview').contentFrame();
await expect(previewFrame.getByRole('heading')).toHaveCSS('color', 'rgb(255, 0, 0)');
});