Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ErrorBoundary avt test #14754

Merged
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', () => {
andreancardona marked this conversation as resolved.
Show resolved Hide resolved
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('accessibility-checker ErrorBoundary with Custom context @avt', async ({
andreancardona marked this conversation as resolved.
Show resolved Hide resolved
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');
});
});
Loading