Aliasing with cypress using as function
describe('create backup button', function() {
beforeEach(() => {
cy.get('a#ai1wm-create-backup').as('button')
})
it('Create backup button should be visible, has right text and attributes', function() {
cy.get('@button')
.should('be.visible')
.should('have.attr', 'href', '#')
.should('have.class', 'ai1wm-button-green')
.should('contain', 'Create backup')
.children('i.ai1wm-icon-export')
.should('be.empty')
})
it('Clicking the Create backup button should trigger the export', function() {
cy.get('@button').click()
// Export test logic comes here
})
})