-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: contentswitcher avttests (#14735)
- Loading branch information
1 parent
725e6fe
commit a0cf45d
Showing
2 changed files
with
77 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
e2e/components/ContentSwitcher/ContentSwitcher-test.avt.e2e.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); |