Skip to content

Commit

Permalink
feat: contentswitcher avttests (#14735)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreancardona authored Oct 18, 2023
1 parent 725e6fe commit a0cf45d
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 2 deletions.
4 changes: 2 additions & 2 deletions e2e/components/ComboButton/ComboButton-test.avt.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { expect, test } from '@playwright/test';
import { visitStory } from '../../test-utils/storybook';

test.describe('ComboButton @avt', () => {
test('@avt-default-state ComboButton ', async ({ page }) => {
test('@avt-default-state ComboButton', async ({ page }) => {
await visitStory(page, {
component: 'ComboButton',
id: 'components-combobutton--default',
Expand All @@ -22,7 +22,7 @@ test.describe('ComboButton @avt', () => {
await expect(page).toHaveNoACViolations('ComboButton');
});

test('@avt-advanced-states ComboButton With Danger ', async ({ page }) => {
test('@avt-advanced-states ComboButton With Danger', async ({ page }) => {
await visitStory(page, {
component: 'ComboButton',
id: 'components-combobutton--with-danger',
Expand Down
75 changes: 75 additions & 0 deletions e2e/components/ContentSwitcher/ContentSwitcher-test.avt.e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/**
* Copyright IBM Corp. 2023
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

import { expect, test } from '@playwright/test';
import { visitStory } from '../../test-utils/storybook';

test.describe('ContentSwitcher @avt', () => {
test('@avt-default-state ContentSwitcher', async ({ page }) => {
await visitStory(page, {
component: 'ContentSwitcher',
id: 'components-contentswitcher--default',
globals: {
theme: 'white',
},
});
await expect(page).toHaveNoACViolations('ContentSwitcher');
});

test('@avt-advanced-states ComboButton Icon Only', async ({ page }) => {
await visitStory(page, {
component: 'ContentSwitcher',
id: 'components-contentswitcher--icon-only',
globals: {
theme: 'white',
},
});
await expect(page).toHaveNoACViolations('ContentSwitcher--icon-only');
});

test('@avt-keyboard-nav ContentSwitcher', async ({ page }) => {
await visitStory(page, {
component: 'ComboButton',
id: 'components-contentswitcher--default',
globals: {
theme: 'white',
},
});
const firstContentTab = page.getByRole('tab', { name: 'First section' });
const secondContentTab = page.getByRole('tab', { name: 'Second section' });
const thirdContentTab = page.getByRole('tab', { name: 'Third section' });

// Testing content switcher
await expect(firstContentTab).toBeVisible();
await page.keyboard.press('ArrowRight');
await expect(secondContentTab).toBeVisible();
await page.keyboard.press('ArrowRight');
await expect(thirdContentTab).toBeVisible();
});

test('@avt-keyboard-nav ContentSwitcher Icon only', async ({ page }) => {
await visitStory(page, {
component: 'ComboButton',
id: 'components-contentswitcher--icon-only',
globals: {
theme: 'white',
},
});
const firstIconTab = page.getByRole('tab', { name: 'Table of Contents' });
const secondIconTab = page.getByRole('tab', { name: 'Workspace Test' });
const thirdIconTab = page.getByRole('tab', { name: 'View Mode' });

// Testing content switcher
await expect(firstIconTab).toBeVisible();
await page.keyboard.press('ArrowRight');
await expect(secondIconTab).toBeVisible();
await page.keyboard.press('ArrowRight');
await expect(thirdIconTab).toBeVisible();
});
});

0 comments on commit a0cf45d

Please sign in to comment.