Skip to content

Commit

Permalink
ODC-7655: Fix domain-mapping tests
Browse files Browse the repository at this point in the history
  • Loading branch information
logonoff committed Oct 2, 2024
1 parent f57b414 commit ae8a48f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ const MultiTypeaheadField: React.FC<MultiTypeaheadFieldProps> = ({
const toggle = (toggleRef: React.Ref<MenuToggleElement>) => (
<MenuToggle
variant="typeahead"
aria-label={ariaLabel}
onClick={onToggleClick}
innerRef={toggleRef}
isExpanded={isOpen}
Expand All @@ -291,6 +290,7 @@ const MultiTypeaheadField: React.FC<MultiTypeaheadFieldProps> = ({
{...(activeItemId && { 'aria-activedescendant': activeItemId })}
role="combobox"
isExpanded={isOpen}
aria-label={ariaLabel}
aria-controls={`${ID_PREFIX}-listbox`}
>
<ChipGroup aria-label={t('console-shared~Current selections')}>
Expand All @@ -301,6 +301,9 @@ const MultiTypeaheadField: React.FC<MultiTypeaheadFieldProps> = ({
ev.stopPropagation();
onSelect(selection);
}}
closeBtnAriaLabel={t('console-shared~Remove {{singularLabel}}', {
singularLabel: getChildren(selection),
})}
>
{getChildren(selection)}
</Chip>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,8 @@ export const hpaPO = {

export const domainPO = {
domainMapping: '[aria-label="Domain mapping"]',
chipGroup: '[aria-label="Chip group category"]',
chipGroup: '.pf-m-typeahead [id*="select-multi-typeahead-"]',
contentScroll: '[id="content-scrollable"]',
removeLabel: '[aria-label="Remove"]',
chipArea: '#form-select-input-serverless-domainMapping-field',
chipDescribe: '[aria-describedby="form-select-input-serverless-domainMapping-field-helper"]',
menuToggle: '.pf-m-typeahead [aria-label="Menu toggle"]',
};
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ When('user clicks Save button', () => {
});

When('user clicks on Show advanced Routing options', () => {
cy.get(domainPO.contentScroll).contains('Show advanced Routing options').click();
cy.get(domainPO.contentScroll).contains('Show advanced Routing options').scrollIntoView();
cy.get(domainPO.contentScroll)
.contains('Show advanced Routing options')
.closest('button')
.click();
});

When('user clicks create button', () => {
Expand Down Expand Up @@ -90,10 +94,11 @@ When(
);

When('user removes already added custom domain mapping {string} and {string}', (d1, d2) => {
cy.get(domainPO.chipArea).should('be.visible').click();
cy.get(`[id="select-option-serverless.domainMapping-${d1}"] button`).should('be.visible').click();
cy.get(`[id="select-option-serverless.domainMapping-${d2}"] button`).should('be.visible').click();
cy.get(domainPO.chipDescribe).should('not.contain', d1).and('not.contain', d2);
cy.get(domainPO.menuToggle).scrollIntoView();
cy.get(domainPO.menuToggle).should('be.visible').click();
cy.get(`button[aria-label="Remove ${d1}"]`).should('be.visible').click();
cy.get(`button[aria-label="Remove ${d2}"]`).should('be.visible').click();
cy.get(domainPO.chipGroup).should('not.contain', d1).and('not.contain', d2);
});

Then(
Expand All @@ -110,7 +115,8 @@ Given('user can see knative service {string} exist in topology page', (workloadN
});

When('user removes already added custom domain mapping {string}', (d1) => {
cy.get(domainPO.chipArea).should('be.visible').click();
cy.get(`[id="select-option-serverless.domainMapping-${d1}"] button`).should('be.visible').click();
cy.get(domainPO.chipDescribe).should('not.contain', d1);
cy.get(domainPO.menuToggle).scrollIntoView();
cy.get(domainPO.menuToggle).should('be.visible').click();
cy.get(`button[id*="value-${d1}"]`).should('be.visible').click();
cy.get(domainPO.chipGroup).should('not.contain', d1);
});

0 comments on commit ae8a48f

Please sign in to comment.