mirror of
https://github.com/Redocly/redoc.git
synced 2025-11-05 02:07:31 +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>
60 lines
2.0 KiB
TypeScript
60 lines
2.0 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
|
|
import Section from '../page-objects/Section';
|
|
import Menu from '../page-objects/Menu';
|
|
|
|
test.describe('Menu', () => {
|
|
let menu: Menu;
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
menu = new Menu(page);
|
|
await page.goto('/pages/menu.html');
|
|
});
|
|
|
|
test('should render menu with auto generated tags', async ({ page }) => {
|
|
await page.goto('/pages/menu.html');
|
|
|
|
await menu.clickThroughMenu('pet');
|
|
const menuItems = await menu.verifyAllMenuItemsHaveHref();
|
|
await expect(menuItems).toHaveCount(14);
|
|
await menu.clickThroughMenu('pet');
|
|
await menu.clickThroughMenu('store');
|
|
await expect(menuItems).toHaveCount(9);
|
|
await menu.clickThroughMenu('store');
|
|
|
|
await menu.clickThroughMenu('user');
|
|
await expect(menuItems).toHaveCount(12);
|
|
});
|
|
|
|
test('should render menu with predefined tags', async ({ page }) => {
|
|
await page.goto('/pages/menu.html?specFileName=menu-with-tags.yaml');
|
|
|
|
await menu.clickThroughMenu('pet');
|
|
const menuItems = await menu.verifyAllMenuItemsHaveHref();
|
|
await expect(menuItems).toHaveCount(16);
|
|
|
|
await menu.clickThroughMenu('ApiResponse');
|
|
const catSection = new Section(page, 'pet/cat');
|
|
await expect(catSection.getSection()).toBeVisible();
|
|
await expect(catSection.getSection().locator('h2')).toContainText('Cat');
|
|
|
|
await menu.clickThroughMenu('pet'); // switch to pet list
|
|
await menu.clickThroughMenu('pet'); // close menu
|
|
|
|
await menu.clickThroughMenu('store');
|
|
await expect(menuItems).toHaveCount(9);
|
|
await menu.clickThroughMenu('store');
|
|
|
|
await menu.clickThroughMenu('user');
|
|
await expect(menuItems).toHaveCount(12);
|
|
});
|
|
|
|
test('should render menu with predefined tags and groups', async ({ page }) => {
|
|
await page.goto('/pages/menu.html?specFileName=menu-with-tag-groups.yaml');
|
|
|
|
await menu.clickThroughMenu('pet');
|
|
const menuItems = await menu.verifyAllMenuItemsHaveHref();
|
|
await expect(menuItems).toHaveCount(5);
|
|
});
|
|
});
|