Files
chainlit--chainlit/cypress/e2e/action/spec.cy.ts
T
wehub-resource-sync b7f52be4c9
CI / Run CI (push) Has been cancelled
CI / check-backend (push) Has been cancelled
CI / check-frontend (push) Has been cancelled
CI / tests (push) Has been cancelled
CI / e2e-tests (push) Has been cancelled
Copilot Setup Steps / copilot-setup-steps (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:48:47 +08:00

50 lines
2.0 KiB
TypeScript

describe('Action', () => {
it('should correctly execute and display actions', () => {
// Click on "first action"
cy.get('#first-action').should('exist');
cy.get('#first-action').click();
cy.get('.step').should('have.length', 3);
cy.get('.step')
.eq(2)
.should('contain', 'Thanks for pressing: first-action');
// Click on "test action"
cy.get("[id='test-action']").should('exist');
cy.get("[id='test-action']").click();
cy.get('.step').should('have.length', 4);
cy.get('.step').eq(3).should('contain', 'Executed test action!');
cy.get("[id='test-action']").should('exist');
// Click on "removable action"
cy.get("[id='removable-action']").should('exist');
cy.get("[id='removable-action']").click();
cy.get('.step').should('have.length', 5);
cy.get('.step').eq(4).should('contain', 'Executed removable action!');
cy.get("[id='removable-action']").should('not.exist');
cy.get('.step').should('have.length', 5);
cy.get("[id='multiple-action-one']").should('exist');
cy.get("[id='multiple-action-one']").click();
cy.get('.step')
.eq(5)
.should('contain', 'Action(id=multiple-action-one) has been removed!');
cy.get("[id='multiple-action-one']").should('not.exist');
// Click on "multiple action two", should remove the correct action button
cy.get('.step').should('have.length', 6);
cy.get("[id='multiple-action-two']").click();
cy.get('.step')
.eq(6)
.should('contain', 'Action(id=multiple-action-two) has been removed!');
cy.get("[id='multiple-action-two']").should('not.exist');
// Click on "all actions removed", should remove all buttons
cy.get("[id='all-actions-removed']").should('exist');
cy.get("[id='all-actions-removed']").click();
cy.get('.step').eq(7).should('contain', 'All actions have been removed!');
cy.get("[id='all-actions-removed']").should('not.exist');
cy.get("[id='test-action']").should('not.exist');
});
});