able-twilight-99822
05/17/2023, 2:34 PM[label="Admin"] selector.
Additional Information:
- The relevant code snippet used to select the menu item is as follows:
testFile.js
javascript
import { When } from 'cypress-cucumber-preprocessor/steps';
import { adminPageDefinitions } from './adminPageDefinitions';
When('I select the {string} Menu', (sideMenu) => {
adminPageDefinitions.selectMenu(sideMenu);
});
adminPageDefinitions.js
javascript
import adminPage from './adminPage';
export const adminPageDefinitions = {
selectMenu(sideMenu) {
cy.get(adminPage.pageElements.sideMenu(sideMenu))
.should('be.visible')
.click();
},
};
adminPage.js
javascript
const adminPage = {
pageElements: {
sideMenu(sideMenu) {
return cy.get(`[label="${sideMenu}"]`);
},
},
};
export default adminPage;
- The error occurs at the line cy.get(adminPage.pageElements.sideMenu(sideMenu)).should('be.visible').click(); in the adminPageDefinitions.js file.
- The error suggests that the sideMenu parameter is undefined or does not match any elements on the page.
- Manually inspecting the page confirms that the menu item with the label "Admin" exists and is visible.
- The timeout error indicates that the menu item is not being located within the specified timeframe.