dimsum-e2e-tests 3.80.0-next.4 → 3.80.0-next.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +168 -0
- package/DSStorybook/baseline.js +0 -186
- package/ds-accordion/DSAccordion.visual.spec.js +0 -14
- package/ds-accordion/DSAccordionCO.js +0 -2
- package/ds-apppicker/aria-disabled/DSAppPicker.aria-disabled.visual.spec.js +14 -1
- package/ds-apppicker/basic/DSAppPicker.basic.visual.spec.js +12 -7
- package/ds-banner/DSBanner.text-resize.visual.spec.js +2 -0
- package/ds-banner/DSBanner.text-wrapping.visual.spec.js +3 -6
- package/ds-banner/DSBanner.visual.spec.js +7 -8
- package/ds-banner/DSBannerCO.js +189 -4
- package/ds-banner/aria-and-role/DSBanner.aria-and-role.func.spec.js +113 -2
- package/ds-banner/ids/DSBanner.ids.func.spec.js +66 -0
- package/ds-banner/live-region-lang-dir/DSBanner.live-region-lang-dir.func.spec.js +54 -0
- package/ds-banner/slide-animation/DSBanner.slide-animation.func.spec.js +105 -0
- package/ds-banner/slots/DSBanner.slots.axe-core.func.spec.js +24 -0
- package/ds-banner/slots/DSBanner.slots.func.spec.js +13 -0
- package/ds-banner/slots/DSBanner.slots.visual.spec.js +3 -2
- package/ds-banner/title-element/DSBanner.title-element.func.spec.js +29 -0
- package/ds-chip/DSChip.axe-core.func.spec.js +0 -17
- package/ds-chip/DSChip.visual.spec.js +0 -22
- package/ds-chip/DSChipCO.js +0 -6
- package/ds-fast-list/DSFastListCO.js +37 -0
- package/ds-fast-list/basic/DSFastList.basic.axe-core.func.spec.js +28 -0
- package/ds-fast-list/basic/DSFastList.basic.visual.spec.js +23 -0
- package/ds-fast-list/scroll-to-index/DSFastList.scroll-to-index.func.spec.js +45 -0
- package/ds-indeterminate-progress-indicator/DSIndeterminateProgressIndicatorCO.js +4 -0
- package/ds-indeterminate-progress-indicator/accessible-name/DSIndeterminateProgressIndicator.accessible-name.func.spec.js +51 -0
- package/ds-leftnavigation/LeftNavigation.fullFeatures.axe-core.func.spec.js +37 -0
- package/ds-leftnavigation/LeftNavigation.isSkeleton.axe-core.func.spec.js +23 -0
- package/ds-leftnavigation/LeftNavigation.keepingItems.axe-core.func.spec.js +34 -0
- package/ds-leftnavigation/LeftNavigation.loadingIndicator.axe-core.func.spec.js +41 -0
- package/ds-leftnavigation/LeftNavigation.notificationBadge.axe-core.func.spec.js +21 -0
- package/ds-leftnavigation/LeftNavigation.searchBar.axe-core.func.spec.js +26 -0
- package/ds-leftnavigation/LeftNavigation.showCase.axe-core.func.spec.js +23 -0
- package/ds-leftnavigation/LeftNavigation.tooltip.axe-core.func.spec.js +28 -0
- package/ds-leftnavigation/LeftNavigation.wrappedText.axe-core.func.spec.js +27 -0
- package/ds-menu-button/DSMenuButtonCO.js +18 -0
- package/ds-menu-button/activable/DSMenuButton.activableMenuItem.keyboardnav.func.spec.js +10 -8
- package/ds-menu-button/submenu/DSMenuButton.subMenuItem.keyboardnav.func.spec.js +33 -10
- package/ds-modal-slide/inside-dialog/ModalSlide.insideDialog.func.spec.js +45 -0
- package/ds-panel-header/DSPanelHeader.func.spec.js +24 -0
- package/ds-panel-header/DSPanelHeaderCO.js +17 -0
- package/ds-pills-v2/DSPillsV2CO.js +53 -1
- package/ds-pills-v2/pitfalls/DSPills.inputPill.func.spec.js +26 -0
- package/ds-pills-v2/pitfalls/DSPills.inputWithFormItemBlockURL.axe-core.func.spec.js +38 -0
- package/ds-pills-v2/pitfalls/DSPills.inputWithFormItemBlockURL.func.spec.js +72 -0
- package/ds-progress-indicator/DSProgressIndicator.axe-core.func.spec.js +8 -5
- package/ds-progress-indicator/DSProgressIndicator.func.spec.js +31 -4
- package/ds-progress-indicator/DSProgressIndicator.visual.spec.js +14 -6
- package/ds-progress-indicator/DSProgressIndicatorCO.js +87 -9
- package/ds-progress-indicator/aria-contract/DSProgressIndicator.aria-contract.func.spec.js +104 -0
- package/ds-progress-indicator/slots/DSProgressIndicator.slots.axe-core.func.spec.js +31 -0
- package/ds-progress-indicator/slots/DSProgressIndicator.slots.func.spec.js +87 -0
- package/ds-progress-indicator/slots/DSProgressIndicator.slots.visual.spec.js +27 -0
- package/ds-progress-indicator/variant/DSProgressIndicator.single-bar-variant.func.spec.js +44 -0
- package/ds-progress-indicator/variant/DSProgressIndicator.single-bar-variant.visual.spec.js +19 -0
- package/ds-ribbon/DSRibbonCO.js +21 -0
- package/ds-ribbon/keyboard-accessible-row/DSRibbon.keyboard-accessible-row.visual.spec.js +40 -0
- package/ds-ribbon/wrap-columns/DSRibbon.wrap-columns.visual.spec.js +18 -0
- package/ds-shuttle-v2/load-more/DSShuttleV2.load-more.keyboard.func.spec.js +46 -17
- package/ds-slider-v2/DSSliderV2.axe-core.func.spec.js +21 -0
- package/ds-slider-v2/DSSliderV2.visual.spec.js +19 -1
- package/ds-slider-v2/DSSliderV2CO.js +6 -1
- package/ds-slider-v2/has-error/DSSliderV2.has-error.visual.spec.js +44 -0
- package/ds-slider-v2/interaction-states/DSSliderV2.interaction-states.visual.spec.js +53 -0
- package/ds-virtuallist/DSVirtualList.visual.spec.js +4 -5
- package/ds-virtuallist/DSVirtualListCO.js +28 -9
- package/ds-virtuallist/basic/DSVirtualList.basic.axe-core.func.spec.js +28 -0
- package/ds-virtuallist/scroll-to-index/DSVirtualList.scroll-to-index.func.spec.js +45 -0
- package/package.json +149 -149
- package/paths.js +3 -49
- package/ds-leftnavigation/LeftNavigation.axe-core.func.spec.js +0 -172
- package/ds-mobile/Accordion/DSAccordion.visual.spec.js +0 -33
- package/ds-mobile/Accordion/DSAccordionCO.js +0 -37
- package/ds-mobile/CategoryBox/CategoryBox.visual.spec.js +0 -18
- package/ds-mobile/CategoryBox/CategoryBoxCO.js +0 -17
- package/ds-mobile/CollectionBox/CollectionBox.visual.spec.js +0 -16
- package/ds-mobile/CollectionBox/CollectionBoxCO.js +0 -15
- package/ds-mobile/GlobalHeader/DSGlobalHeader.visual.spec.js +0 -55
- package/ds-mobile/GlobalHeader/DSGlobalHeaderCO.js +0 -36
- package/ds-mobile/GroupBox/GroupBox.visual.spec.js +0 -15
- package/ds-mobile/GroupBox/GroupBoxCO.js +0 -15
- package/ds-mobile/InfiniteLoader/InfiniteLoader.func.spec.js +0 -90
- package/ds-mobile/InfiniteLoader/InfiniteLoaderCO.js +0 -29
- package/ds-mobile/MobileActionToolbar/MobileActionToolbar.visual.spec.js +0 -39
- package/ds-mobile/MobileActionToolbar/MobileActionToolbarCO.js +0 -19
- package/ds-mobile/MobileBanner/MobileBanner.visual.spec.js +0 -23
- package/ds-mobile/MobileBanner/MobileBannerCO.js +0 -23
- package/ds-mobile/MobileCard/Card.func.spec.js +0 -38
- package/ds-mobile/MobileCard/Card.visual.spec.js +0 -103
- package/ds-mobile/MobileCard/MobileCardCO.js +0 -42
- package/ds-mobile/MobileContextMenu/MobileContextMenu.func.spec.js +0 -88
- package/ds-mobile/MobileContextMenu/MobileContextMenu.visual.spec.js +0 -31
- package/ds-mobile/MobileContextMenu/MobileContextMenuCO.js +0 -72
- package/ds-mobile/MobileDatePicker/MobileDatePicker.func.spec.js +0 -15
- package/ds-mobile/MobileDatePicker/MobileDatePicker.visual.spec.js +0 -15
- package/ds-mobile/MobileDatePicker/MobileDatePickerCO.js +0 -35
- package/ds-mobile/MobileDropdownMenu/MobileDropdownMenu.func.spec.js +0 -38
- package/ds-mobile/MobileDropdownMenu/MobileDropdownMenu.visual.spec.js +0 -16
- package/ds-mobile/MobileDropdownMenu/MobileDropdownMenuCO.js +0 -37
- package/ds-mobile/MobileEmptyState/MobileEmptyState.visual.spec.js +0 -15
- package/ds-mobile/MobileEmptyState/MobileEmptyStateCO.js +0 -14
- package/ds-mobile/MobileFilterbar/MobileFilterbar.visual.spec.js +0 -39
- package/ds-mobile/MobileFilterbar/MobileFilterbarCO.js +0 -19
- package/ds-mobile/MobileFooter/MobileFooter.func.spec.js +0 -26
- package/ds-mobile/MobileFooter/MobileFooter.visual.spec.js +0 -51
- package/ds-mobile/MobileFooter/MobileFooterCO.js +0 -27
- package/ds-mobile/MobileListItem/MobileListItem.visual.spec.js +0 -56
- package/ds-mobile/MobileListItem/MobileListItemCO.js +0 -19
- package/ds-mobile/MobileLoadingPage/MobileLoadingPage.visual.spec.js +0 -37
- package/ds-mobile/MobileLoadingPage/MobileLoadingPageCO.js +0 -23
- package/ds-mobile/MobilePageHeader/MobilePageHeader.func.spec.js +0 -22
- package/ds-mobile/MobilePageHeader/MobilePageHeader.visual.spec.js +0 -135
- package/ds-mobile/MobilePageHeader/MobilePageHeaderCO.js +0 -67
- package/ds-mobile/MobileSelectList/MobileSelectList.visual.spec.js +0 -56
- package/ds-mobile/MobileSelectList/MobileSelectListCO.js +0 -21
- package/ds-mobile/MobileSeparator/MobileSeparator.visual.spec.js +0 -28
- package/ds-mobile/MobileSeparator/MobileSeparatorCO.js +0 -17
- package/ds-mobile/MobileTimePicker/MobileTimePickerCO.js +0 -41
- package/ds-mobile/Modal/MobileModal.visual.spec.js +0 -56
- package/ds-mobile/Modal/MobileModalCO.js +0 -28
- package/ds-mobile/PageFilter/PageFilter.visual.spec.js +0 -46
- package/ds-mobile/PageFilter/PageFilterCO.js +0 -19
- package/ds-mobile/PageForm/PageForm.visual.spec.js +0 -14
- package/ds-mobile/PageForm/PageFormCO.js +0 -11
- package/ds-mobile/PageList/PageList.visual.spec.js +0 -31
- package/ds-mobile/PageList/PageListCO.js +0 -19
- package/ds-mobile/PageSummary/PageSummary.visual.spec.js +0 -20
- package/ds-mobile/PageSummary/PageSummaryCO.js +0 -11
- package/ds-mobile/SwipeToRefresh/SwipeToRefresh.func.spec.js +0 -26
- package/ds-mobile/SwipeToRefresh/SwipeToRefreshCO.js +0 -20
- package/ds-mobile/Tabs/MobileTabs.visual.spec.js +0 -91
- package/ds-mobile/Tabs/TabsCO.js +0 -37
- package/ds-mobile/Tooltip/MobileTooltip.func.spec.js +0 -17
- package/ds-mobile/Tooltip/MobileTooltip.visual.spec.js +0 -16
- package/ds-mobile/Tooltip/TooltipCO.js +0 -23
- package/ds-mobile/helpers.js +0 -7
|
@@ -1,26 +1,104 @@
|
|
|
1
1
|
import { PATH_E2E_PROGRESS_INDICATOR } from '../paths';
|
|
2
2
|
import { PageObject, Urlbuilder } from '../helpers';
|
|
3
3
|
|
|
4
|
+
// Slot testids owned by the component (packages/atom/ds-progress-indicator/src/constants/index.ts).
|
|
5
|
+
// Note the lowercase `i` in "progressindicator": it comes from DSProgressIndicatorName.
|
|
6
|
+
const SLOT_TESTID = {
|
|
7
|
+
ROOT: 'ds-progressindicator-root',
|
|
8
|
+
TITLE: 'ds-progressindicator-title',
|
|
9
|
+
COUNTER: 'ds-progressindicator-counter',
|
|
10
|
+
PROGRESS_BAR: 'ds-progressindicator-progress-bar',
|
|
11
|
+
PROGRESS: 'ds-progressindicator-progress',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// In segmented mode every segment reuses the PROGRESS testid, and the stories render several
|
|
15
|
+
// indicators per page, so selectors are scoped by the story's per-scenario `*-case` wrapper.
|
|
16
|
+
// Omit `caseTestId` for single-indicator stories such as BasicTest.
|
|
17
|
+
const scoped = (testId, caseTestId) =>
|
|
18
|
+
caseTestId ? `[data-testid="${caseTestId}"] [data-testid="${testId}"]` : `[data-testid="${testId}"]`;
|
|
19
|
+
|
|
4
20
|
export default class DSProgressIndicatorCO extends PageObject {
|
|
5
21
|
// Desktop
|
|
6
22
|
static basicURL = new Urlbuilder(PATH_E2E_PROGRESS_INDICATOR, 'basic-test');
|
|
7
23
|
|
|
8
24
|
static othersURL = new Urlbuilder(PATH_E2E_PROGRESS_INDICATOR, 'others-test');
|
|
9
25
|
|
|
10
|
-
static
|
|
11
|
-
|
|
26
|
+
static ariaContractURL = new Urlbuilder(PATH_E2E_PROGRESS_INDICATOR, 'aria-contract-test');
|
|
27
|
+
|
|
28
|
+
static slotsURL = new Urlbuilder(PATH_E2E_PROGRESS_INDICATOR, 'slots-test');
|
|
29
|
+
|
|
30
|
+
static singleBarVariantURL = new Urlbuilder(PATH_E2E_PROGRESS_INDICATOR, 'single-bar-variant-test');
|
|
31
|
+
|
|
32
|
+
static SLOT_TESTID = SLOT_TESTID;
|
|
33
|
+
|
|
34
|
+
// selectors
|
|
35
|
+
static async getRoot(caseTestId) {
|
|
36
|
+
return $(scoped(SLOT_TESTID.ROOT, caseTestId));
|
|
12
37
|
}
|
|
13
38
|
|
|
14
|
-
static async
|
|
15
|
-
return $(
|
|
39
|
+
static async getTitle(caseTestId) {
|
|
40
|
+
return $(scoped(SLOT_TESTID.TITLE, caseTestId));
|
|
16
41
|
}
|
|
17
42
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
43
|
+
static async getCounter(caseTestId) {
|
|
44
|
+
return $(scoped(SLOT_TESTID.COUNTER, caseTestId));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static async getProgressBar(caseTestId) {
|
|
48
|
+
return $(scoped(SLOT_TESTID.PROGRESS_BAR, caseTestId));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// First (or only) progressbar of a case. Use getProgressBars for the segmented ones.
|
|
52
|
+
static async getProgress(caseTestId) {
|
|
53
|
+
return $(scoped(SLOT_TESTID.PROGRESS, caseTestId));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static async getProgressBars(caseTestId) {
|
|
57
|
+
return $$(scoped(SLOT_TESTID.PROGRESS, caseTestId));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Text node DSTypography renders inside a slot, e.g. getTypographyIn(SLOT_TESTID.TITLE).
|
|
61
|
+
static async getTypographyIn(slotTestId, caseTestId) {
|
|
62
|
+
return $(`${scoped(slotTestId, caseTestId)} [data-dimsum-slot="dsTypographyRoot"]`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Slot-level lookups, for asserting the data-dimsum-slot contract independently of the testids.
|
|
66
|
+
static async getSlot(slotName, caseTestId) {
|
|
67
|
+
const prefix = caseTestId ? `[data-testid="${caseTestId}"] ` : '';
|
|
68
|
+
return $(`${prefix}[data-dimsum-slot="${slotName}"]`);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
static async getSlots(slotName, caseTestId) {
|
|
72
|
+
const prefix = caseTestId ? `[data-testid="${caseTestId}"] ` : '';
|
|
73
|
+
return $$(`${prefix}[data-dimsum-slot="${slotName}"]`);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// aria-labelledby points at a React.useId() value containing ":", which is not a valid CSS id
|
|
77
|
+
// selector, so the target has to be resolved through the attribute selector instead of "#id".
|
|
78
|
+
static async getByIdAttribute(id) {
|
|
79
|
+
return $(`[id="${id}"]`);
|
|
21
80
|
}
|
|
22
81
|
|
|
23
|
-
// selectors
|
|
24
|
-
// actions
|
|
25
82
|
// utils
|
|
83
|
+
// OthersTest drives two indicators with setInterval counters. They stop once each counter reaches
|
|
84
|
+
// its max, so the story is only deterministic after both have landed on their final totals.
|
|
85
|
+
//
|
|
86
|
+
// The texts are read in a single browser.execute rather than by mapping over $$: WebdriverIO's
|
|
87
|
+
// element array overrides .map() to return a Promise, so Promise.all(list.map(...)) throws
|
|
88
|
+
// "object is not iterable". One round trip per poll is also cheaper than four.
|
|
89
|
+
static async waitForAnimatedCountersToSettle() {
|
|
90
|
+
await browser.waitUntil(
|
|
91
|
+
async () => {
|
|
92
|
+
const texts = await browser.execute(
|
|
93
|
+
(testId) => Array.from(document.querySelectorAll(`[data-testid="${testId}"]`), (el) => el.textContent),
|
|
94
|
+
SLOT_TESTID.COUNTER,
|
|
95
|
+
);
|
|
96
|
+
return texts.length >= 4 && texts[1] === '400 of 400' && texts[2] === '330 of 330';
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
timeout: 15000,
|
|
100
|
+
timeoutMsg: 'animated progress indicators never reached their final value',
|
|
101
|
+
},
|
|
102
|
+
);
|
|
103
|
+
}
|
|
26
104
|
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import DSProgressIndicatorCO from '../DSProgressIndicatorCO';
|
|
2
|
+
|
|
3
|
+
// Coverage for the accessibility remediation shipped in PUI-18856 (PR #8353):
|
|
4
|
+
// PUI-18671 the progressbar used to carry a hardcoded aria-label="progress bar". It is now named
|
|
5
|
+
// by the visible title through aria-labelledby, and that string survives only as the
|
|
6
|
+
// fallback for an untitled indicator.
|
|
7
|
+
// PUI-18673 aria-valuetext now mirrors whatever the visible counter renders, default or custom.
|
|
8
|
+
// PUI-18675 each segment accepts a `label` that becomes its own accessible name. Only the Dimsum
|
|
9
|
+
// half of that defect is assertable here; the visible non-colour alternative is the
|
|
10
|
+
// consumer's, see stories/docs/principles/a11y/tradesoff.
|
|
11
|
+
// PUI-18672 an invalid `max` no longer produces width: NaN% and an inverted ARIA range. `max` was
|
|
12
|
+
// deliberately NOT made required (KNOWN_INTENTIONAL_DEVIATIONS.md, deviation 6), so what
|
|
13
|
+
// is asserted below is the shipped fail-safe: an indeterminate progressbar.
|
|
14
|
+
//
|
|
15
|
+
// Every assertion is a DOM attribute, which is identical across engines, so this runs Chrome only.
|
|
16
|
+
// The `|| 'Chrome'` branch is mandatory: BrowserStack reports the capitalised name and a
|
|
17
|
+
// lowercase-only guard would register zero tests while still exiting 0.
|
|
18
|
+
if (
|
|
19
|
+
(!browser.capabilities['ice:options'].isPhone &&
|
|
20
|
+
!browser.capabilities['ice:options'].isTablet &&
|
|
21
|
+
browser.capabilities.browserName === 'chrome') ||
|
|
22
|
+
browser.capabilities.browserName === 'Chrome'
|
|
23
|
+
) {
|
|
24
|
+
describe('PUI-19209 - DSProgressIndicator:: progressbar ARIA contract - Func', () => {
|
|
25
|
+
before('loading page', async () => {
|
|
26
|
+
const errorOnGo = await DSProgressIndicatorCO.ariaContractURL.go();
|
|
27
|
+
if (errorOnGo) throw errorOnGo;
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('01: should name the progressbar from the visible title and fall back when untitled', async () => {
|
|
31
|
+
const titled = await DSProgressIndicatorCO.getProgress('titled-case');
|
|
32
|
+
await titled.waitForDisplayed();
|
|
33
|
+
await expect(titled).not.toHaveAttribute('aria-label');
|
|
34
|
+
|
|
35
|
+
// The id is generated with React.useId(), so it is resolved at runtime rather than hardcoded.
|
|
36
|
+
const labelledBy = await titled.getAttribute('aria-labelledby');
|
|
37
|
+
const title = await DSProgressIndicatorCO.getTitle('titled-case');
|
|
38
|
+
await expect(await title.getAttribute('id')).toEqual(labelledBy);
|
|
39
|
+
await expect(await DSProgressIndicatorCO.getByIdAttribute(labelledBy)).toHaveText('Uploading documents');
|
|
40
|
+
|
|
41
|
+
const titleless = await DSProgressIndicatorCO.getProgress('titleless-case');
|
|
42
|
+
await expect(titleless).toHaveAttribute('aria-label', 'progress bar');
|
|
43
|
+
await expect(titleless).not.toHaveAttribute('aria-labelledby');
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('02: should mirror the visible counter in aria-valuetext for default and custom renderers', async () => {
|
|
47
|
+
const defaultCounter = await DSProgressIndicatorCO.getCounter('titled-case');
|
|
48
|
+
await expect(defaultCounter).toHaveText('50 of 100');
|
|
49
|
+
const defaultBar = await DSProgressIndicatorCO.getProgress('titled-case');
|
|
50
|
+
await expect(defaultBar).toHaveAttribute('aria-valuetext', '50 of 100');
|
|
51
|
+
|
|
52
|
+
const customCounter = await DSProgressIndicatorCO.getCounter('custom-counter-case');
|
|
53
|
+
await expect(customCounter).toHaveText('3 files remaining');
|
|
54
|
+
const customBar = await DSProgressIndicatorCO.getProgress('custom-counter-case');
|
|
55
|
+
await expect(customBar).toHaveAttribute('aria-valuetext', '3 files remaining');
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('03: should give each labelled segment its own accessible name', async () => {
|
|
59
|
+
const labelled = await DSProgressIndicatorCO.getProgressBars('labelled-segments-case');
|
|
60
|
+
await expect(labelled).toBeElementsArrayOfSize(2);
|
|
61
|
+
|
|
62
|
+
// A segment label wins over the indicator title, so aria-labelledby is dropped entirely.
|
|
63
|
+
await expect(labelled[0]).toHaveAttribute('aria-label', 'Approved documents');
|
|
64
|
+
await expect(labelled[0]).not.toHaveAttribute('aria-labelledby');
|
|
65
|
+
await expect(labelled[1]).toHaveAttribute('aria-label', 'Rejected documents');
|
|
66
|
+
await expect(labelled[1]).not.toHaveAttribute('aria-labelledby');
|
|
67
|
+
|
|
68
|
+
// Each segment reports its own range rather than the aggregate shown by the counter.
|
|
69
|
+
await expect(labelled[0]).toHaveAttribute('aria-valuetext', '50 of 100');
|
|
70
|
+
await expect(labelled[1]).toHaveAttribute('aria-valuetext', '100 of 200');
|
|
71
|
+
|
|
72
|
+
// An unlabelled segment still falls back to the indicator title.
|
|
73
|
+
const mixed = await DSProgressIndicatorCO.getProgressBars('mixed-segments-case');
|
|
74
|
+
await expect(mixed).toBeElementsArrayOfSize(2);
|
|
75
|
+
await expect(mixed[0]).toHaveAttribute('aria-label', 'Completed');
|
|
76
|
+
await expect(mixed[1]).not.toHaveAttribute('aria-label');
|
|
77
|
+
const fallbackId = await mixed[1].getAttribute('aria-labelledby');
|
|
78
|
+
await expect(await DSProgressIndicatorCO.getByIdAttribute(fallbackId)).toHaveText('Batch upload');
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('04: should render indeterminate for an invalid max and clamp an overflowing value', async () => {
|
|
82
|
+
const expectIndeterminate = async (caseId) => {
|
|
83
|
+
const bar = await DSProgressIndicatorCO.getProgress(caseId);
|
|
84
|
+
await expect(bar).toHaveAttribute('role', 'progressbar');
|
|
85
|
+
await expect(bar).not.toHaveAttribute('aria-valuenow');
|
|
86
|
+
await expect(bar).not.toHaveAttribute('aria-valuemin');
|
|
87
|
+
await expect(bar).not.toHaveAttribute('aria-valuemax');
|
|
88
|
+
await expect(bar).not.toHaveAttribute('aria-valuetext');
|
|
89
|
+
// The pre-fix behaviour was width: NaN%; the guard now yields a valid zero-length fill.
|
|
90
|
+
await expect(await bar.getAttribute('style')).toContain('width: 0%');
|
|
91
|
+
// The indicator is still named, so the invalid range degrades without losing the label.
|
|
92
|
+
await expect(bar).toHaveAttribute('aria-labelledby');
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
await expectIndeterminate('omitted-max-case');
|
|
96
|
+
await expectIndeterminate('zero-max-case');
|
|
97
|
+
|
|
98
|
+
const overflow = await DSProgressIndicatorCO.getProgress('overflow-case');
|
|
99
|
+
await expect(overflow).toHaveAttribute('aria-valuenow', '100');
|
|
100
|
+
await expect(overflow).toHaveAttribute('aria-valuemax', '100');
|
|
101
|
+
await expect(await overflow.getAttribute('style')).toContain('width: 100%');
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import DSProgressIndicatorCO from '../DSProgressIndicatorCO';
|
|
2
|
+
import { axeCoreCheck } from '../../helpers';
|
|
3
|
+
|
|
4
|
+
// SlotsTest is the only ProgressIndicator story that overrides color/backgroundColor, so it is the
|
|
5
|
+
// one place where the test code itself can introduce a contrast regression. This run is what makes
|
|
6
|
+
// the WCAG 2 AA pairs in the story load-bearing rather than advisory. It also guards the
|
|
7
|
+
// consumer-supplied slot aria-label against colliding with the component's own naming.
|
|
8
|
+
//
|
|
9
|
+
// Chrome only: axe-core results do not vary by engine. The `|| 'Chrome'` branch is mandatory,
|
|
10
|
+
// BrowserStack reports the capitalised name and a lowercase-only guard registers zero tests.
|
|
11
|
+
if (
|
|
12
|
+
(!browser.capabilities['ice:options'].isPhone &&
|
|
13
|
+
!browser.capabilities['ice:options'].isTablet &&
|
|
14
|
+
browser.capabilities.browserName === 'chrome') ||
|
|
15
|
+
browser.capabilities.browserName === 'Chrome'
|
|
16
|
+
) {
|
|
17
|
+
describe('PUI-19212 - DSProgressIndicator:: slot theming - Axe-Core', () => {
|
|
18
|
+
before('loading page', async () => {
|
|
19
|
+
const errorOnGo = await DSProgressIndicatorCO.slotsURL.go();
|
|
20
|
+
if (errorOnGo) throw errorOnGo;
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('01: should have no accessibility violations with custom slot theming', async () => {
|
|
24
|
+
const root = await DSProgressIndicatorCO.getSlot('dsProgressindicatorRoot', 'segmented-slots-case');
|
|
25
|
+
await root.waitForDisplayed();
|
|
26
|
+
|
|
27
|
+
const result = await axeCoreCheck();
|
|
28
|
+
expect(result.length).toBe(0);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import DSProgressIndicatorCO from '../DSProgressIndicatorCO';
|
|
2
|
+
|
|
3
|
+
// Slot contract coverage for the compliance migration in PUI-18856 / PUI-18941. The package dropped
|
|
4
|
+
// ds-classnames/aggregatedClasses for the native slot system, so each visual element must now be
|
|
5
|
+
// addressable through data-dimsum-slot and must accept consumer slot props.
|
|
6
|
+
//
|
|
7
|
+
// The consumer's `data-testid` REPLACES the component default, which is why this spec addresses the
|
|
8
|
+
// elements through data-dimsum-slot and then asserts the overridden testid, rather than the other
|
|
9
|
+
// way round.
|
|
10
|
+
//
|
|
11
|
+
// Slot attribute pass-through is engine-independent, so this runs Chrome only. The `|| 'Chrome'`
|
|
12
|
+
// branch is mandatory: BrowserStack reports the capitalised name and a lowercase-only guard would
|
|
13
|
+
// register zero tests while still exiting 0.
|
|
14
|
+
if (
|
|
15
|
+
(!browser.capabilities['ice:options'].isPhone &&
|
|
16
|
+
!browser.capabilities['ice:options'].isTablet &&
|
|
17
|
+
browser.capabilities.browserName === 'chrome') ||
|
|
18
|
+
browser.capabilities.browserName === 'Chrome'
|
|
19
|
+
) {
|
|
20
|
+
describe('PUI-19210 - DSProgressIndicator:: slot contract and slot prop forwarding - Func', () => {
|
|
21
|
+
before('loading page', async () => {
|
|
22
|
+
const errorOnGo = await DSProgressIndicatorCO.slotsURL.go();
|
|
23
|
+
if (errorOnGo) throw errorOnGo;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('01: should expose the five slots on both the single and the segmented indicator', async () => {
|
|
27
|
+
const expectFiveSlots = async (caseId) => {
|
|
28
|
+
const [root, title, counter, progressBar, progress] = await Promise.all([
|
|
29
|
+
DSProgressIndicatorCO.getSlot('dsProgressindicatorRoot', caseId),
|
|
30
|
+
DSProgressIndicatorCO.getSlot('dsProgressindicatorTitle', caseId),
|
|
31
|
+
DSProgressIndicatorCO.getSlot('dsProgressindicatorCounter', caseId),
|
|
32
|
+
DSProgressIndicatorCO.getSlot('dsProgressindicatorProgressBar', caseId),
|
|
33
|
+
DSProgressIndicatorCO.getSlot('dsProgressindicatorProgress', caseId),
|
|
34
|
+
]);
|
|
35
|
+
|
|
36
|
+
await root.waitForDisplayed();
|
|
37
|
+
await expect(root).toHaveAttribute('data-testid', 'custom-root-data');
|
|
38
|
+
await expect(title).toHaveAttribute('data-testid', 'custom-title-data');
|
|
39
|
+
await expect(counter).toHaveAttribute('data-testid', 'custom-counter-data');
|
|
40
|
+
await expect(progressBar).toHaveAttribute('data-testid', 'custom-progress-bar-data');
|
|
41
|
+
await expect(progress).toHaveAttribute('data-testid', 'custom-progress-data');
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
await expectFiveSlots('single-slots-case');
|
|
45
|
+
await expectFiveSlots('segmented-slots-case');
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('02: should forward consumer slot props to every slot and to each segment', async () => {
|
|
49
|
+
const [title, counter, progress] = await Promise.all([
|
|
50
|
+
DSProgressIndicatorCO.getSlot('dsProgressindicatorTitle', 'single-slots-case'),
|
|
51
|
+
DSProgressIndicatorCO.getSlot('dsProgressindicatorCounter', 'single-slots-case'),
|
|
52
|
+
DSProgressIndicatorCO.getSlot('dsProgressindicatorProgress', 'single-slots-case'),
|
|
53
|
+
]);
|
|
54
|
+
|
|
55
|
+
await expect(title).toHaveAttribute('lang', 'en');
|
|
56
|
+
await expect(counter).toHaveAttribute('title', 'custom counter title');
|
|
57
|
+
|
|
58
|
+
// The progress slot carries role="progressbar", so a slot-level aria-label is legal there and
|
|
59
|
+
// is forwarded. It does not become the accessible name though: the component also emits its
|
|
60
|
+
// own aria-labelledby pointing at the title, and aria-labelledby outranks aria-label. Chrome's
|
|
61
|
+
// accessibility tree names these bars after their title, not "custom progress aria".
|
|
62
|
+
//
|
|
63
|
+
// That is the intended outcome, not a gap. Keeping the name tied to the visible title is the
|
|
64
|
+
// WCAG 2.5.3 Label in Name principle, and localisation is handled by passing a translated
|
|
65
|
+
// `title` rather than by overriding the label. The slot-level aria-label only takes effect on
|
|
66
|
+
// a titleless indicator, where the component would otherwise fall back to "progress bar".
|
|
67
|
+
// Asserting both attributes here pins the forwarding contract without implying the override
|
|
68
|
+
// wins the name.
|
|
69
|
+
await expect(progress).toHaveAttribute('role', 'progressbar');
|
|
70
|
+
await expect(progress).toHaveAttribute('aria-label', 'custom progress aria');
|
|
71
|
+
await expect(progress).toHaveAttribute('aria-labelledby');
|
|
72
|
+
|
|
73
|
+
// Slot props must reach every segment, not just the first one. The segments are addressed by
|
|
74
|
+
// index rather than with .map(): WebdriverIO's element array overrides .map() to return a
|
|
75
|
+
// Promise, so Promise.all(segments.map(...)) throws "object is not iterable".
|
|
76
|
+
const segments = await DSProgressIndicatorCO.getSlots('dsProgressindicatorProgress', 'segmented-slots-case');
|
|
77
|
+
await expect(segments).toBeElementsArrayOfSize(3);
|
|
78
|
+
|
|
79
|
+
await expect(segments[0]).toHaveAttribute('data-testid', 'custom-progress-data');
|
|
80
|
+
await expect(segments[0]).toHaveAttribute('aria-label', 'custom progress aria');
|
|
81
|
+
await expect(segments[1]).toHaveAttribute('data-testid', 'custom-progress-data');
|
|
82
|
+
await expect(segments[1]).toHaveAttribute('aria-label', 'custom progress aria');
|
|
83
|
+
await expect(segments[2]).toHaveAttribute('data-testid', 'custom-progress-data');
|
|
84
|
+
await expect(segments[2]).toHaveAttribute('aria-label', 'custom progress aria');
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import DSProgressIndicatorCO from '../DSProgressIndicatorCO';
|
|
2
|
+
|
|
3
|
+
// Visual half of the PUI-18856 slot migration: proves the styleOverrides payload actually reaches
|
|
4
|
+
// each slot after the move off ds-classnames. The functional spec covers the attribute contract, so
|
|
5
|
+
// this only needs the rendered appearance.
|
|
6
|
+
//
|
|
7
|
+
// This snapshot also guards the cascade fix for the `progress-bar` slot: its styleOverride used to lose to
|
|
8
|
+
// the retained SCSS rule `.em-ds-determinate-progress-indicator .em-ds-progress-bar` (two classes beat the
|
|
9
|
+
// single styled-components class) and the track stayed grey. The package now re-emits every slot override
|
|
10
|
+
// that a legacy descendant rule could beat under `&&&`, so all five slots take their overrides here. jsdom
|
|
11
|
+
// does not honour specificity, so this real-browser snapshot is the only place the cascade itself is proven.
|
|
12
|
+
if (!browser.capabilities['ice:options'].isPhone && !browser.capabilities['ice:options'].isTablet) {
|
|
13
|
+
describe('PUI-19211 - DSProgressIndicator:: slot theming - Visual', () => {
|
|
14
|
+
before('loading page', async () => {
|
|
15
|
+
const errorOnGo = await DSProgressIndicatorCO.slotsURL.go();
|
|
16
|
+
if (errorOnGo) throw errorOnGo;
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('01: should display the single and segmented indicators with slot theming applied', async () => {
|
|
20
|
+
const root = await DSProgressIndicatorCO.getSlot('dsProgressindicatorRoot', 'segmented-slots-case');
|
|
21
|
+
await root.waitForDisplayed();
|
|
22
|
+
|
|
23
|
+
const snapshot = await browser.percyCheckScreenshot();
|
|
24
|
+
await expect(snapshot).toEqual(0);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import DSProgressIndicatorCO from '../DSProgressIndicatorCO';
|
|
2
|
+
|
|
3
|
+
// Tests for the fix introduced in PUI-18677: `variant` used to be ignored in single-bar mode, so every
|
|
4
|
+
// single bar rendered the default fill.
|
|
5
|
+
//
|
|
6
|
+
// Theme-agnostic on purpose: no colour value is pinned. Each variant only has to paint a fill that differs
|
|
7
|
+
// from the default one; the exact palette is guarded by the visual spec.
|
|
8
|
+
//
|
|
9
|
+
// Chrome only: a computed style of a static story does not vary by engine. The `|| 'Chrome'` branch is
|
|
10
|
+
// mandatory, BrowserStack reports the capitalised name and a lowercase-only guard registers zero tests.
|
|
11
|
+
if (
|
|
12
|
+
(!browser.capabilities['ice:options'].isPhone &&
|
|
13
|
+
!browser.capabilities['ice:options'].isTablet &&
|
|
14
|
+
browser.capabilities.browserName === 'chrome') ||
|
|
15
|
+
browser.capabilities.browserName === 'Chrome'
|
|
16
|
+
) {
|
|
17
|
+
describe('PUI-19235 - DSProgressIndicator:: single-bar variant fill colour - Func', () => {
|
|
18
|
+
before('loading page', async () => {
|
|
19
|
+
const errorOnGo = await DSProgressIndicatorCO.singleBarVariantURL.go();
|
|
20
|
+
if (errorOnGo) throw errorOnGo;
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('01: should paint each single-bar variant fill differently from the default', async () => {
|
|
24
|
+
const fillColour = async (caseId) => {
|
|
25
|
+
const bar = await DSProgressIndicatorCO.getProgress(caseId);
|
|
26
|
+
await bar.waitForDisplayed();
|
|
27
|
+
return (await bar.getCSSProperty('background-color')).parsed.hex;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const defaultColour = await fillColour('default-case');
|
|
31
|
+
const success = await fillColour('success-case');
|
|
32
|
+
const warning = await fillColour('warning-case');
|
|
33
|
+
const info = await fillColour('info-case');
|
|
34
|
+
const error = await fillColour('error-case');
|
|
35
|
+
|
|
36
|
+
await expect(success).not.toEqual(defaultColour);
|
|
37
|
+
await expect(warning).not.toEqual(defaultColour);
|
|
38
|
+
await expect(info).not.toEqual(defaultColour);
|
|
39
|
+
await expect(error).not.toEqual(defaultColour);
|
|
40
|
+
// The variants must also be told apart from each other, not just from the default.
|
|
41
|
+
await expect(new Set([defaultColour, success, warning, info, error]).size).toBe(5);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import DSProgressIndicatorCO from '../DSProgressIndicatorCO';
|
|
2
|
+
|
|
3
|
+
// Tests for the fix introduced in PUI-18677: the single-bar `variant` now reaches the fill. The functional
|
|
4
|
+
// spec only proves the colours differ; this baseline records the actual palette per variant.
|
|
5
|
+
if (!browser.capabilities['ice:options'].isPhone && !browser.capabilities['ice:options'].isTablet) {
|
|
6
|
+
describe('PUI-19236 - DSProgressIndicator:: single-bar variant fill colour - Visual', () => {
|
|
7
|
+
before('loading page', async () => {
|
|
8
|
+
const errorOnGo = await DSProgressIndicatorCO.singleBarVariantURL.go();
|
|
9
|
+
if (errorOnGo) throw errorOnGo;
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('01: should display one single-bar indicator per variant', async () => {
|
|
13
|
+
await (await DSProgressIndicatorCO.getProgress('error-case')).waitForDisplayed();
|
|
14
|
+
|
|
15
|
+
const snapshot = await browser.percyCheckScreenshot();
|
|
16
|
+
await expect(snapshot).toEqual(0);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
}
|
package/ds-ribbon/DSRibbonCO.js
CHANGED
|
@@ -12,6 +12,10 @@ export default class DSRibbonCO extends PageObject {
|
|
|
12
12
|
|
|
13
13
|
static themingURL = new Urlbuilder(PATH_E2E_RIBBON, 'theming-test');
|
|
14
14
|
|
|
15
|
+
static wrapColumnsURL = new Urlbuilder(PATH_E2E_RIBBON, 'wrap-columns-test');
|
|
16
|
+
|
|
17
|
+
static keyboardAccessibleRowURL = new Urlbuilder(PATH_E2E_RIBBON, 'keyboard-accessible-row-test');
|
|
18
|
+
|
|
15
19
|
static async getRibbon() {
|
|
16
20
|
return $('[data-testid="button-wrapper"]');
|
|
17
21
|
}
|
|
@@ -91,6 +95,23 @@ export default class DSRibbonCO extends PageObject {
|
|
|
91
95
|
return $('[data-testid="ribbon-card-theming"]');
|
|
92
96
|
}
|
|
93
97
|
|
|
98
|
+
// Wrap Columns / Keyboard Accessible Row selectors
|
|
99
|
+
static async getRowInContainer(containerTestId) {
|
|
100
|
+
return $(`[data-testid="${containerTestId}"] [data-dimsum-slot="dsRibbonRibbonRow"]`);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
static async getWrapColumnsRow() {
|
|
104
|
+
return DSRibbonCO.getRowInContainer('ribbon-wrap-columns-container');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
static async getFocusableRow() {
|
|
108
|
+
return DSRibbonCO.getRowInContainer('ribbon-focusable-row-container');
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
static async getExpandProcessedBtn() {
|
|
112
|
+
return $('[data-testid="expand-processed-btn"]');
|
|
113
|
+
}
|
|
114
|
+
|
|
94
115
|
// Snapshots
|
|
95
116
|
static snapshotPath(example = 'basic') {
|
|
96
117
|
return PageObject.getSnapshotPathBuilder('Ribbon', example, 'ds-modal');
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Key } from 'webdriverio';
|
|
2
|
+
import DSRibbonCO from '../DSRibbonCO';
|
|
3
|
+
|
|
4
|
+
// Kept at module scope so the waitUntil below stays within the max-nested-callbacks limit.
|
|
5
|
+
const readScrollLeft = (el) => el.scrollLeft;
|
|
6
|
+
|
|
7
|
+
if (!browser.capabilities['ice:options'].isPhone && !browser.capabilities['ice:options'].isTablet) {
|
|
8
|
+
// Tests for the fix introduced in PUI-19188 (scrolling row had no tabindex and could not be reached by keyboard)
|
|
9
|
+
describe('PUI-19230 - DSRibbon:: scrolling row keyboard access - Visual', () => {
|
|
10
|
+
before('loading page', async () => {
|
|
11
|
+
const errorOnGo = await DSRibbonCO.keyboardAccessibleRowURL.go();
|
|
12
|
+
if (errorOnGo) throw errorOnGo;
|
|
13
|
+
const row = await DSRibbonCO.getFocusableRow();
|
|
14
|
+
await row.waitForDisplayed();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('01: should display the focus indicator on the scrolling row', async () => {
|
|
18
|
+
await browser.keys(Key.Tab);
|
|
19
|
+
const row = await DSRibbonCO.getFocusableRow();
|
|
20
|
+
await expect(row).toBeFocused();
|
|
21
|
+
// The row advertises "use the arrow keys to reach the remaining columns", so drive that before
|
|
22
|
+
// the snapshot: arrow keys keep focus on the row, so the Tab in 02 still reaches the button.
|
|
23
|
+
const scrollLeftBefore = await browser.execute(readScrollLeft, row);
|
|
24
|
+
await browser.keys(Key.ArrowRight);
|
|
25
|
+
await browser.waitUntil(async () => (await browser.execute(readScrollLeft, row)) > scrollLeftBefore, {
|
|
26
|
+
timeoutMsg: 'expected ArrowRight to scroll the focused row towards the off-screen columns',
|
|
27
|
+
});
|
|
28
|
+
const snapshot = await browser.percyCheckScreenshot();
|
|
29
|
+
await expect(snapshot).toEqual(0);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('02: should display the off-screen button scrolled into view with focus', async () => {
|
|
33
|
+
await browser.keys(Key.Tab);
|
|
34
|
+
const btn = await DSRibbonCO.getExpandProcessedBtn();
|
|
35
|
+
await expect(btn).toBeFocused();
|
|
36
|
+
const snapshot = await browser.percyCheckScreenshot();
|
|
37
|
+
await expect(snapshot).toEqual(0);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import DSRibbonCO from '../DSRibbonCO';
|
|
2
|
+
|
|
3
|
+
if (!browser.capabilities['ice:options'].isPhone && !browser.capabilities['ice:options'].isTablet) {
|
|
4
|
+
// Tests for the fix introduced in PUI-19188 (row scrolled at narrow widths, off-screen columns unreachable)
|
|
5
|
+
describe('PUI-19229 - DSRibbon:: wrapColumns row wrapping - Visual', () => {
|
|
6
|
+
before('loading page', async () => {
|
|
7
|
+
const errorOnGo = await DSRibbonCO.wrapColumnsURL.go();
|
|
8
|
+
if (errorOnGo) throw errorOnGo;
|
|
9
|
+
const row = await DSRibbonCO.getWrapColumnsRow();
|
|
10
|
+
await row.waitForDisplayed();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('01: should display the default scrolling row and the wrapped row', async () => {
|
|
14
|
+
const snapshot = await browser.percyCheckScreenshot();
|
|
15
|
+
await expect(snapshot).toEqual(0);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -3,8 +3,23 @@
|
|
|
3
3
|
import { Key } from 'webdriverio';
|
|
4
4
|
import DSShuttleV2CO from '../DSShuttleV2CO';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Tab forward until `element` holds focus, then assert it does. Chromium, Gecko and WebKit do not
|
|
8
|
+
* agree on how many stops sit between the two panels, so a fixed Tab count activates the wrong
|
|
9
|
+
* control on some engines. Bounded so a missing stop fails with this assertion instead of looping.
|
|
10
|
+
*/
|
|
11
|
+
const tabUntilFocused = async (element, maxTabs = 10) => {
|
|
12
|
+
for (let i = 0; i < maxTabs; i += 1) {
|
|
13
|
+
// eslint-disable-next-line no-await-in-loop
|
|
14
|
+
if (await element.isFocused()) break;
|
|
15
|
+
// eslint-disable-next-line no-await-in-loop
|
|
16
|
+
await browser.keys(Key.Tab);
|
|
17
|
+
}
|
|
18
|
+
await expect(element).toBeFocused();
|
|
19
|
+
};
|
|
20
|
+
|
|
6
21
|
if (!browser.capabilities['ice:options'].isPhone && !browser.capabilities['ice:options'].isTablet) {
|
|
7
|
-
describe('PUI-9799 - Shuttle V2, TabStops with BAB and LoadMore -Func.', () => {
|
|
22
|
+
describe('PUI-9799 - Shuttle V2, TabStops with BAB and LoadMore - Keyboard Func.', () => {
|
|
8
23
|
before(async () => {
|
|
9
24
|
const errorOnGo = await DSShuttleV2CO.loadMoreURL.go();
|
|
10
25
|
if (errorOnGo) throw errorOnGo;
|
|
@@ -19,43 +34,57 @@ if (!browser.capabilities['ice:options'].isPhone && !browser.capabilities['ice:o
|
|
|
19
34
|
await expect(BAB).toBeDisplayed();
|
|
20
35
|
await expect(sourcePanelCheckbox).toBeFocused();
|
|
21
36
|
});
|
|
22
|
-
it('
|
|
37
|
+
it('02: should tab and focus the source panel', async () => {
|
|
23
38
|
await browser.keys(Key.Tab);
|
|
24
39
|
const sourcePanel = await DSShuttleV2CO.getListWrapperMid(0);
|
|
25
40
|
await expect(sourcePanel).toBeFocused();
|
|
26
41
|
});
|
|
27
|
-
it('
|
|
42
|
+
it('03: should tab and focus the BAB', async () => {
|
|
28
43
|
await browser.keys(Key.Tab);
|
|
29
44
|
const BAB = await DSShuttleV2CO.getMoveMultipleButton(0);
|
|
30
45
|
await expect(BAB).toBeFocused();
|
|
31
46
|
});
|
|
32
|
-
it('
|
|
47
|
+
it('04: should tab and focus the loadmore', async () => {
|
|
33
48
|
await browser.keys(Key.Tab);
|
|
34
49
|
const loadMore = await DSShuttleV2CO.getListBottomLoadMoreBtn(0);
|
|
35
50
|
await expect(loadMore).toBeFocused();
|
|
36
51
|
});
|
|
37
|
-
it('
|
|
52
|
+
it('05: should tab and focus the global checkbox from destination panel', async () => {
|
|
38
53
|
await browser.keys(Key.Tab);
|
|
39
54
|
const destinationPanelCheckbox = await DSShuttleV2CO.getCheckboxByIndex(1);
|
|
40
55
|
await expect(destinationPanelCheckbox).toBeFocused();
|
|
41
56
|
});
|
|
42
|
-
it('
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
await
|
|
57
|
+
it('06: should move all the items to destination panel', async () => {
|
|
58
|
+
// Tab counts are not portable: the stops between the two panels differ per engine, and a
|
|
59
|
+
// hard-coded count lands Return on the wrong control in Safari. Walk until the target has
|
|
60
|
+
// focus instead, which asserts the same stops on every browser.
|
|
61
|
+
await tabUntilFocused(await DSShuttleV2CO.getCheckboxByIndex(0));
|
|
62
|
+
await browser.keys(Key.Return); // select every source item
|
|
63
|
+
await tabUntilFocused(await DSShuttleV2CO.getMoveMultipleButton());
|
|
64
|
+
await browser.keys(Key.Return); // move them to the destination
|
|
65
|
+
await browser.waitUntil(async () => (await DSShuttleV2CO.getItemsFromSource()).length === 0, {
|
|
66
|
+
timeoutMsg: 'expected the source panel to be emptied into the destination',
|
|
67
|
+
});
|
|
47
68
|
const emptyListWrapper = await DSShuttleV2CO.getEmptyListWrapper();
|
|
48
69
|
await expect(emptyListWrapper).toHaveText(expect.stringContaining('There are no items to display'));
|
|
49
70
|
});
|
|
50
|
-
it('
|
|
51
|
-
await
|
|
52
|
-
await browser.keys(Key.Return);
|
|
53
|
-
|
|
54
|
-
await browser.
|
|
55
|
-
|
|
71
|
+
it('07: should load the first page back into the emptied destination panel', async () => {
|
|
72
|
+
await tabUntilFocused(await DSShuttleV2CO.getCheckboxByIndex(1));
|
|
73
|
+
await browser.keys(Key.Return); // select every destination item
|
|
74
|
+
await tabUntilFocused(await DSShuttleV2CO.getMoveMultipleButton());
|
|
75
|
+
await browser.keys(Key.Return); // move them out of the destination
|
|
76
|
+
await browser.waitUntil(async () => (await DSShuttleV2CO.getItemsFromDestination()).length === 0, {
|
|
77
|
+
timeoutMsg: 'expected the destination panel to be emptied back into the source',
|
|
78
|
+
});
|
|
79
|
+
await tabUntilFocused(await DSShuttleV2CO.getListBottomLoadMoreBtn(1));
|
|
80
|
+
await browser.keys(Key.Return); // load the first page back in
|
|
81
|
+
// Where focus lands after load more is not asserted: Chromium parks it on the panel body,
|
|
82
|
+
// Firefox and Safari do not, so it is engine behaviour rather than a component contract.
|
|
83
|
+
await browser.waitUntil(async () => (await DSShuttleV2CO.getItemsFromDestination()).length === 3, {
|
|
84
|
+
timeoutMsg: 'expected destination load more to append its first page of 3 items',
|
|
85
|
+
});
|
|
56
86
|
const destinationItems = (await DSShuttleV2CO.getItemsFromDestination()).length;
|
|
57
87
|
await expect(destinationItems).toBe(3);
|
|
58
|
-
await expect(destinationPanel).toBeFocused();
|
|
59
88
|
});
|
|
60
89
|
});
|
|
61
90
|
}
|