Skip to content

Commit

Permalink
feat: ErrorBoundary avt test (#14754)
Browse files Browse the repository at this point in the history
* feat: add keyboard nav definition tooltip

* feat: errorboundary avt test

* Delete e2e/components/DefinitionTooltip/DefinitionTooltip-test.avt.e2e.js

* Update e2e/components/ErrorBoundary/ErrorBoundary-test.avt.e2e.js

Co-authored-by: Guilherme Datilio Ribeiro <[email protected]>

* Update e2e/components/ErrorBoundary/ErrorBoundary-test.avt.e2e.js

Co-authored-by: Guilherme Datilio Ribeiro <[email protected]>

---------

Co-authored-by: Guilherme Datilio Ribeiro <[email protected]>
Co-authored-by: TJ Egan <[email protected]>
  • Loading branch information
3 people committed Oct 10, 2023
1 parent c65fad0 commit 3166c31
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions e2e/components/ErrorBoundary/ErrorBoundary-test.avt.e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
* Copyright IBM Corp. 2016, 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';

const { expect, test } = require('@playwright/test');
const { visitStory } = require('../../test-utils/storybook');

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

test('@avt-advanced-states ErrorBoundary with Custom context', async ({
page,
}) => {
await visitStory(page, {
component: 'ErrorBoundary',
id: 'components-errorboundary--skeleton',
globals: {
theme: 'white',
},
});
await expect(page).toHaveNoACViolations(
'ErrorBoundary with Custom context'
);
});

test('@avt-keyboard-state default', async ({ page }) => {
await visitStory(page, {
component: 'ErrorBoundary',
id: 'components-errorboundary--default',
globals: {
theme: 'white',
},
args: {
disabled: true,
},
});

const errorBoundaryButton = page.getByRole('button', {
name: 'Toggle throwing error',
});
const elementLocator = page.locator('div.cds--layout');

// Testing ErrorBoundary
await page.keyboard.press('Tab');
await expect(errorBoundaryButton).toBeVisible();
await expect(elementLocator).toContainText('Successfully rendered');
await errorBoundaryButton.click();
await expect(elementLocator).toContainText('Whoops');
});
});

0 comments on commit 3166c31

Please sign in to comment.