Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding direct logout test. #40394

Merged
merged 14 commits into from
Apr 18, 2023
Merged
24 changes: 24 additions & 0 deletions tests/System/integration/site/components/com_users/Logout.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
describe('Test in frontend that the users logout view', () => {
it('can log out the user without a menu item', () => {
// Make sure we are really logged in
cy.doFrontendLogin(null, null, false);
cy.visit('/index.php?option=com_users&view=login&layout=logout&task=user.menulogout');

cy.contains(`Hi ${Cypress.env('name')}`).should('not.exist');
// This is disabled for now as it looks like cypress has an issue after redirect with the session
// cy.get('#system-message-container').should('contain.text', 'You have been logged out.');
});

it('can log out the user in a menu item', () => {
cy.db_createMenuItem({ title: 'Automated logout', link: 'index.php?option=com_users&view=login&layout=logout&task=user.menulogout' })
.then(() => {
// Make sure we are really logged in
cy.doFrontendLogin(null, null, false);
cy.visit('/');
cy.get('a:contains(Automated logout)').click();

cy.contains(`Hi ${Cypress.env('name')}`).should('not.exist');
cy.get('#system-message-container').should('contain.text', 'You have been logged out.');
});
});
});