mirror of
https://github.com/Redocly/redoc.git
synced 2025-11-04 17:57:30 +03:00
Co-authored-by: Roman Hotsiy <gotsijroman@gmail.com> Co-authored-by: Alex Varchuk <olexandr.varchuk@gmail.com> Co-authored-by: Oprysk Vyacheslav <vyacheslav@redocly.com> Co-authored-by: Ivan Kropyvnytskyi <130547411+ivankropyvnytskyi@users.noreply.github.com> Co-authored-by: Yevhen Pylyp <yevhen.pylyp@redocly.com> Co-authored-by: Vladyslav Makarenko <vladyslav.makarenko@redocly.com> Co-authored-by: Yevhenii Medviediev <yevhenii.medviediev@redocly.com> Co-authored-by: Oleksii Horbachevskyi <oleksii.horbachevskyi@redocly.com> Co-authored-by: volodymyr-rutskyi <rutskyi.v@gmail.com> Co-authored-by: Adam Altman <adam@redoc.ly> Co-authored-by: Andrew Tatomyr <andrew.tatomyr@redocly.com> Co-authored-by: Anastasiia Derymarko <anastasiia@redocly.com> Co-authored-by: Roman Marshevskyy <roman.marshevskyy@redoc.ly> Co-authored-by: Lorna Mitchell <lorna.mitchell@redocly.com> Co-authored-by: Taylor Krusen <taylor.krusen@redocly.com>
57 lines
2.2 KiB
TypeScript
57 lines
2.2 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
|
|
import Section from '../page-objects/Section';
|
|
import Menu from '../page-objects/Menu';
|
|
|
|
test.describe('Navigation', () => {
|
|
let menu: Menu;
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
menu = new Menu(page);
|
|
await page.goto('/index.html');
|
|
});
|
|
|
|
test('menu: should open the operation details when the operation IDs have quotes', async ({
|
|
page,
|
|
}) => {
|
|
await menu.clickThroughMenu('pet', 'OperationId with quotes');
|
|
await expect(page.locator('[data-testid="operation-item-header"]').nth(2)).toContainText(
|
|
'OperationId with quotes',
|
|
);
|
|
|
|
await expect(page).toHaveURL(/.*operationidwith%22quotes/);
|
|
});
|
|
|
|
test('menu: should encode URL when the operation IDs have backslashes', async ({ page }) => {
|
|
await menu.clickThroughMenu('pet', 'OperationId with backslash');
|
|
await expect(page.locator('[data-testid="operation-item-header"]').nth(3)).toContainText(
|
|
'OperationId with backslash',
|
|
);
|
|
|
|
await expect(page).toHaveURL(/.*operationidwith%5Cbackslash/i);
|
|
});
|
|
|
|
test('deepLink: should exists deep links for all properties', async ({ page }) => {
|
|
await menu.clickThroughMenu('pet', 'Add a new pet to the store');
|
|
const addPetOperation = new Section(page, 'pet/addpet');
|
|
await addPetOperation.verifyAllSchemaLinksHaveHref();
|
|
|
|
await page.evaluate(() => window.scrollTo(0, 0));
|
|
|
|
await menu.clickThroughMenu('user', 'Create user');
|
|
const createUserOperation = new Section(page, 'user/createuser');
|
|
await createUserOperation.verifyAllSchemaLinksHaveHref();
|
|
});
|
|
|
|
test('deepLink: should exists deep links for headers', async ({ page }) => {
|
|
await menu.clickThroughMenu('Introduction');
|
|
|
|
const introSection = new Section(page, 'section');
|
|
await introSection.verifyHeaderDeepLink('section/OpenAPI-Specification');
|
|
await introSection.verifyHeaderDeepLink('section/openapi-specification/Subheader-1');
|
|
await introSection.verifyHeaderDeepLink('section/openapi-specification/Subheader-2');
|
|
await introSection.verifyHeaderDeepLink('section/openapi-specification/Subheader-3');
|
|
await introSection.verifyHeaderDeepLink('section/openapi-specification/Subheader-4');
|
|
});
|
|
});
|