Skip to content

Commit

Permalink
[5.2] refactor tests to use checkForSystemMessage (#44772)
Browse files Browse the repository at this point in the history
Co-authored-by: Allon Moritz <[email protected]>
  • Loading branch information
heelc29 and laoneo authored Jan 24, 2025
1 parent 1fc5e1c commit 68be1b3
Show file tree
Hide file tree
Showing 39 changed files with 94 additions and 94 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,27 @@ describe('Test in backend that the action logs', () => {

it('has an export button', () => {
cy.get('#toolbar-download1').click();
cy.get('#system-message-container').contains('There are no User Action logs to export').should('exist');
cy.checkForSystemMessage('There are no User Action logs to export');
});

it('can clear logs', () => {
cy.get('#toolbar-delete1').click();
cy.clickDialogConfirm(true);
cy.get('#system-message-container').contains('All User Action logs have been deleted').should('exist');
cy.checkForSystemMessage('All User Action logs have been deleted');
});

it('can delete selected logs', () => {
cy.get('#toolbar-delete').click();
cy.clickDialogConfirm(true);
cy.get('#system-message-container').contains('Please first make a selection from the list').should('exist');
cy.checkForSystemMessage('Please first make a selection from the list');
cy.log('Make a selection first');
cy.doAdministratorLogout();
cy.doAdministratorLogin();
cy.visit('/administrator/index.php?option=com_actionlogs&view=actionlogs');
cy.checkAllResults();
cy.get('#toolbar-delete').click();
cy.clickDialogConfirm(true);
cy.get('#system-message-container').contains('logs deleted').should('exist');
cy.checkForSystemMessage('logs deleted');
cy.task('queryDB', 'TRUNCATE #__action_logs');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Test in backend that the banners form', () => {
cy.get('#jform_name').clear().type('Test banner');
cy.clickToolbarButton('Save & Close');

cy.get('#system-message-container').contains('Banner saved.').should('exist');
cy.checkForSystemMessage('Banner saved.');
cy.contains('Test banner');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('Test in backend that the banners list', () => {
cy.clickToolbarButton('Action');
cy.contains('Publish').click();

cy.get('#system-message-container').contains('Banner published.').should('exist');
cy.checkForSystemMessage('Banner published.');
});
});

Expand All @@ -42,7 +42,7 @@ describe('Test in backend that the banners list', () => {
cy.clickToolbarButton('Action');
cy.contains('Unpublish').click();

cy.get('#system-message-container').contains('Banner unpublished.').should('exist');
cy.checkForSystemMessage('Banner unpublished.');
});
});

Expand All @@ -54,7 +54,7 @@ describe('Test in backend that the banners list', () => {
cy.clickToolbarButton('Action');
cy.contains('Trash').click();

cy.get('#system-message-container').contains('Banner trashed.').should('exist');
cy.checkForSystemMessage('Banner trashed.');
});
});

Expand All @@ -67,7 +67,7 @@ describe('Test in backend that the banners list', () => {
cy.clickToolbarButton('empty trash');
cy.clickDialogConfirm(true);

cy.get('#system-message-container').contains('Banner deleted.').should('exist');
cy.checkForSystemMessage('Banner deleted.');
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('Test in backend that the banner clients form', () => {
cy.get('#jform_contact').clear().type('test banner client');
cy.clickToolbarButton('Save & Close');

cy.get('#system-message-container').contains('Client saved.').should('exist');
cy.checkForSystemMessage('Client saved.');
cy.contains('test banner client');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('Test in backend that the clients list', () => {
cy.clickToolbarButton('Action');
cy.contains('Publish').click();

cy.get('#system-message-container').contains('Client published.').should('exist');
cy.checkForSystemMessage('Client published.');
});
});

Expand All @@ -42,7 +42,7 @@ describe('Test in backend that the clients list', () => {
cy.clickToolbarButton('Action');
cy.contains('Unpublish').click();

cy.get('#system-message-container').contains('Client unpublished.').should('exist');
cy.checkForSystemMessage('Client unpublished.');
});
});

Expand All @@ -54,7 +54,7 @@ describe('Test in backend that the clients list', () => {
cy.clickToolbarButton('Action');
cy.contains('Trash').click();

cy.get('#system-message-container').contains('Client trashed.').should('exist');
cy.checkForSystemMessage('Client trashed.');
});
});

Expand All @@ -67,7 +67,7 @@ describe('Test in backend that the clients list', () => {
cy.clickToolbarButton('empty trash');
cy.clickDialogConfirm(true);

cy.get('#system-message-container').contains('Client deleted.').should('exist');
cy.checkForSystemMessage('Client deleted.');
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ describe('Test in backend that the cache', () => {
cy.get('div.buttons-holder button[data-button-ok]').click();
}
});
cy.get('#system-message-container').contains('Expired cached items have been cleared').should('exist');
cy.checkForSystemMessage('Expired cached items have been cleared');
});

it('can delete all', () => {
cy.get('#toolbar-delete1').click();
cy.get('#system-message-container').contains('All cache group(s) have been cleared').should('exist');
cy.checkForSystemMessage('All cache group(s) have been cleared');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('Test in backend that the categories list', () => {
cy.clickToolbarButton('Action');
cy.contains('Publish').click();

cy.get('#system-message-container').contains('Category published.').should('exist');
cy.checkForSystemMessage('Category published.');
});
});

Expand All @@ -42,7 +42,7 @@ describe('Test in backend that the categories list', () => {
cy.clickToolbarButton('Action');
cy.contains('Unpublish').click();

cy.get('#system-message-container').contains('Category unpublished.').should('exist');
cy.checkForSystemMessage('Category unpublished.');
});
});

Expand All @@ -54,7 +54,7 @@ describe('Test in backend that the categories list', () => {
cy.clickToolbarButton('Action');
cy.contains('Trash').click();

cy.get('#system-message-container').contains('Category trashed.').should('exist');
cy.checkForSystemMessage('Category trashed.');
});
});

Expand All @@ -70,6 +70,6 @@ describe('Test in backend that the categories list', () => {
cy.clickToolbarButton('empty trash');
cy.clickDialogConfirm(true);

cy.get('#system-message-container').contains('Category deleted.').should('exist');
cy.checkForSystemMessage('Category deleted.');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Test in backend that the category form', () => {
cy.get('#jform_title').should('exist').type('Test category');
cy.clickToolbarButton('Save & Close');

cy.get('#system-message-container').contains('Category saved.').should('exist');
cy.checkForSystemMessage('Category saved.');
cy.contains('Test category');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('Test in backend that the checkin', () => {
cy.searchForItem('content');
cy.checkAllResults();
cy.get('#toolbar-checkin').click();
cy.get('#system-message-container').contains('Item checked in').should('exist');
cy.checkForSystemMessage('Item checked in');
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('Test in backend that the application configuration', () => {
cy.get('#sendtestmail').click();

cy.task('getMails').then((mails) => {
cy.get('#system-message-container').should('contain.text', 'The email was sent to');
cy.checkForSystemMessage('The email was sent to');

expect(mails.length).to.equal(1);
cy.wrap(mails[0].body).should('have.string', 'This is a test mail sent using');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Test in backend that the contact form', () => {
cy.get('#jform_name').clear().type('Test contact');
cy.clickToolbarButton('Save & Close');

cy.get('#system-message-container').contains('Contact saved.').should('exist');
cy.checkForSystemMessage('Contact saved.');
cy.contains('Test contact');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('Test in backend that the contacts list', () => {
cy.clickToolbarButton('Action');
cy.contains('Publish').click();

cy.get('#system-message-container').contains('Contact published.').should('exist');
cy.checkForSystemMessage('Contact published.');
});
});

Expand All @@ -42,7 +42,7 @@ describe('Test in backend that the contacts list', () => {
cy.clickToolbarButton('Action');
cy.contains('Unpublish').click();

cy.get('#system-message-container').contains('Contact unpublished.').should('exist');
cy.checkForSystemMessage('Contact unpublished.');
});
});

Expand All @@ -54,7 +54,7 @@ describe('Test in backend that the contacts list', () => {
cy.clickToolbarButton('Action');
cy.contains('.button-featured', 'Feature').click();

cy.get('#system-message-container').contains('Contact featured.').should('exist');
cy.checkForSystemMessage('Contact featured.');
});
});

Expand All @@ -66,7 +66,7 @@ describe('Test in backend that the contacts list', () => {
cy.clickToolbarButton('Action');
cy.contains('Unfeature').click();

cy.get('#system-message-container').contains('Contact unfeatured.').should('exist');
cy.checkForSystemMessage('Contact unfeatured.');
});
});

Expand All @@ -78,7 +78,7 @@ describe('Test in backend that the contacts list', () => {
cy.clickToolbarButton('Action');
cy.contains('Trash').click();

cy.get('#system-message-container').contains('Contact trashed.').should('exist');
cy.checkForSystemMessage('Contact trashed.');
});
});

Expand All @@ -91,7 +91,7 @@ describe('Test in backend that the contacts list', () => {
cy.clickToolbarButton('empty trash');
cy.clickDialogConfirm(true);

cy.get('#system-message-container').contains('Contact deleted.').should('exist');
cy.checkForSystemMessage('Contact deleted.');
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Test in backend that the article form', () => {
cy.get('#jform_title').clear().type('Test article');
cy.clickToolbarButton('Save & Close');

cy.get('#system-message-container').contains('Article saved.').should('exist');
cy.checkForSystemMessage('Article saved.');
cy.contains('Test article');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('Test in backend that the articles list', () => {
cy.clickToolbarButton('Action');
cy.contains('Publish').click();

cy.get('#system-message-container').contains('Article published.').should('exist');
cy.checkForSystemMessage('Article published.');
});
});

Expand All @@ -42,7 +42,7 @@ describe('Test in backend that the articles list', () => {
cy.clickToolbarButton('Action');
cy.contains('Unpublish').click();

cy.get('#system-message-container').contains('Article unpublished.').should('exist');
cy.checkForSystemMessage('Article unpublished.');
});
});

Expand All @@ -54,7 +54,7 @@ describe('Test in backend that the articles list', () => {
cy.clickToolbarButton('Action');
cy.contains('.button-featured', 'Feature').click();

cy.get('#system-message-container').contains('Article featured.').should('exist');
cy.checkForSystemMessage('Article featured.');
});
});

Expand All @@ -66,7 +66,7 @@ describe('Test in backend that the articles list', () => {
cy.clickToolbarButton('Action');
cy.contains('Unfeature').click();

cy.get('#system-message-container').contains('Article unfeatured.').should('exist');
cy.checkForSystemMessage('Article unfeatured.');
});
});

Expand All @@ -78,7 +78,7 @@ describe('Test in backend that the articles list', () => {
cy.clickToolbarButton('Action');
cy.contains('Trash').click();

cy.get('#system-message-container').contains('Article trashed.').should('exist');
cy.checkForSystemMessage('Article trashed.');
});
});

Expand All @@ -91,7 +91,7 @@ describe('Test in backend that the articles list', () => {
cy.clickToolbarButton('empty trash');
cy.clickDialogConfirm(true);

cy.get('#system-message-container').contains('Article deleted.').should('exist');
cy.checkForSystemMessage('Article deleted.');
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Test in backend that the field form', () => {
cy.get('#jform_title').clear().type('Test field');
cy.clickToolbarButton('Save & Close');

cy.get('#system-message-container').contains('Field saved').should('exist');
cy.checkForSystemMessage('Field saved');
cy.contains('Test field');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('Test in backend that the custom fields list', () => {
cy.clickToolbarButton('Action');
cy.contains('Publish').click();

cy.get('#system-message-container').contains('Field published').should('exist');
cy.checkForSystemMessage('Field published');
});
});

Expand All @@ -42,7 +42,7 @@ describe('Test in backend that the custom fields list', () => {
cy.clickToolbarButton('Action');
cy.contains('Unpublish').click();

cy.get('#system-message-container').contains('Field unpublished').should('exist');
cy.checkForSystemMessage('Field unpublished');
});
});

Expand All @@ -54,7 +54,7 @@ describe('Test in backend that the custom fields list', () => {
cy.clickToolbarButton('Action');
cy.contains('Trash').click();

cy.get('#system-message-container').contains('Field trashed').should('exist');
cy.checkForSystemMessage('Field trashed');
});
});

Expand All @@ -67,7 +67,7 @@ describe('Test in backend that the custom fields list', () => {
cy.clickToolbarButton('empty trash');
cy.clickDialogConfirm(true);

cy.get('#system-message-container').contains('Field deleted').should('exist');
cy.checkForSystemMessage('Field deleted');
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('Test the update retrieval logic', () => {

cy.get('#toolbar joomla-toolbar-button[task="update.purge"] button').click();

cy.get('#system-message-container').contains('Checked for updates.').should('exist');
cy.checkForSystemMessage('Checked for updates.');
});

it('Receives error fetching available updates with invalid metadata', () => {
Expand All @@ -24,6 +24,6 @@ describe('Test the update retrieval logic', () => {

cy.get('#confirmButton').click();

cy.get('#system-message-container').contains('Update not possible because the offered update does not have enough signatures.').should('exist');
cy.checkForSystemMessage('Update not possible because the offered update does not have enough signatures.');
});
});
Loading

0 comments on commit 68be1b3

Please sign in to comment.