Skip to content

Commit

Permalink
Adding direct logout test. (joomla#40394)
Browse files Browse the repository at this point in the history
* add cypress test

* test desc. change

* test desc. change

* a

* Update tests/System/integration/site/components/com_users/Logout.cy.js

Co-authored-by: Allon Moritz <allon.moritz@digital-peak.com>

* Adding code into a .then block

* remove space

* disable the logout assert when no menu item

---------

Co-authored-by: Allon Moritz <allon.moritz@digital-peak.com>
  • Loading branch information
charvimehradu and laoneo committed Apr 18, 2023
1 parent 302ea40 commit 0b5bb2b
Showing 1 changed file with 24 additions and 0 deletions.
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.');
});
});
});

0 comments on commit 0b5bb2b

Please sign in to comment.