So here is my best guess at how to do this based on all the info given. I advise you to take a data-driven approach, which assumes all menus have the same pattern (which may not be true, I can't say for sure).
There are some gaps in the menu data that you will have to fill out from the app iteslf,
describe('Check the menus', () => {
const menus = [
{
number: 1
name: "Onboarding".
items: [
'Smartcard zuweisen',
'Prim?re Smartcard zuweisen',
'Prim?re Karte drucken und zuweisen',
]
},
{
number: 2
name: "Kartenverwaltung".
items: [
'Aktive und deaktivierte Karten',
// other items here
]
},
// other menus here
];
menus.forEach(menu => {
it(`Check the dropdown menu ${menu.name}`, function () {
cy.visit('http://localhost:25000/', { timeout: 300000 })
cy.wait(10000)
cy.get('.dijitReset.dijitInline.dijitMenuItemLabel.dijitMenuItem')
.eq(menu.number).click(); // open menu
cy.get(`table[title="${menu.name}"]`).should('be.visible'); // confirm opened
menu.items.forEach(item => {
cy.contains('td', item).should('be.visible'); // Confirm items
};
});
})
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…