Skip to content

Commit 898c7ce

Browse files
committed
added function for capability check in support script
1 parent 23d4e6f commit 898c7ce

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/cypress/support/pageObjects/performancePage.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,27 @@ class performancePage {
106106
this.getDesktopToggle().should( 'have.attr', 'aria-checked', 'true' );
107107
}
108108

109+
linkPrefetchCapabilityCheck( type ) {
110+
this.getDropDownForLinkPrefetch().click();
111+
this.getDropDownForLinkPrefetch()
112+
.invoke( 'text' )
113+
.then( ( buttonLabel ) => {
114+
if ( 'onlyMouseDown' === type ) {
115+
cy.get('[data-cy="link-prefetch-behavior-desktop"] .nfd-select__options > li')
116+
.should('have.length', 1)
117+
.invoke('text')
118+
.then(itemText => {
119+
const trimmedText = itemText.trim();
120+
cy.log('Found element text:', trimmedText);
121+
expect(trimmedText).to.equal('Prefetch on Mouse Down');
122+
});
123+
} else {
124+
cy.get('[data-cy="link-prefetch-behavior-desktop"] .nfd-select__options > li')
125+
.should('have.length', 2);
126+
}
127+
});
128+
}
129+
109130
compareDropdownLabelAndSelectedOption() {
110131
// Get the text from the dropdown button label
111132
this.getDropDownForLinkPrefetch()

0 commit comments

Comments
 (0)