|
| 1 | +describe('Test in backend that the banners list', () => { |
| 2 | + beforeEach(() => { |
| 3 | + cy.doAdministratorLogin(); |
| 4 | + cy.visit('/administrator/index.php?option=com_banners&view=banners&filter='); |
| 5 | + }); |
| 6 | + |
| 7 | + it('has a title', () => { |
| 8 | + cy.get('h1.page-title').should('contain.text', 'Banners'); |
| 9 | + }); |
| 10 | + |
| 11 | + it('can display a list of banners', () => { |
| 12 | + cy.db_createBanner({ name: 'Test banner' }).then(() => { |
| 13 | + cy.reload(); |
| 14 | + |
| 15 | + cy.contains('Test banner'); |
| 16 | + }); |
| 17 | + }); |
| 18 | + |
| 19 | + it('can open the banner form', () => { |
| 20 | + cy.clickToolbarButton('New'); |
| 21 | + |
| 22 | + cy.contains('Banners: New'); |
| 23 | + }); |
| 24 | + |
| 25 | + it('can publish the test banner', () => { |
| 26 | + cy.db_createBanner({ name: 'Test banner', state: 0 }).then(() => { |
| 27 | + cy.reload(); |
| 28 | + cy.searchForItem('Test banner'); |
| 29 | + cy.checkAllResults(); |
| 30 | + cy.clickToolbarButton('Action'); |
| 31 | + cy.contains('Publish').click(); |
| 32 | + cy.on('window:confirm', () => true); |
| 33 | + |
| 34 | + cy.get('#system-message-container').contains('Banner published.').should('exist'); |
| 35 | + }); |
| 36 | + }); |
| 37 | + |
| 38 | + it('can unpublish the test banner', () => { |
| 39 | + cy.db_createBanner({ name: 'Test banner', state: 1 }).then(() => { |
| 40 | + cy.reload(); |
| 41 | + cy.searchForItem('Test banner'); |
| 42 | + cy.checkAllResults(); |
| 43 | + cy.clickToolbarButton('Action'); |
| 44 | + cy.contains('Unpublish').click(); |
| 45 | + cy.on('window:confirm', () => true); |
| 46 | + |
| 47 | + cy.get('#system-message-container').contains('Banner unpublished.').should('exist'); |
| 48 | + }); |
| 49 | + }); |
| 50 | + |
| 51 | + it('can trash the test banner', () => { |
| 52 | + cy.db_createBanner({ name: 'Test banner' }).then(() => { |
| 53 | + cy.reload(); |
| 54 | + cy.searchForItem('Test banner'); |
| 55 | + cy.checkAllResults(); |
| 56 | + cy.clickToolbarButton('Action'); |
| 57 | + cy.contains('Trash').click(); |
| 58 | + cy.on('window:confirm', () => true); |
| 59 | + |
| 60 | + cy.get('#system-message-container').contains('Banner trashed.').should('exist'); |
| 61 | + }); |
| 62 | + }); |
| 63 | + |
| 64 | + it('can delete the test banner', () => { |
| 65 | + cy.db_createBanner({ name: 'Test banner', state: -2 }).then(() => { |
| 66 | + cy.reload(); |
| 67 | + cy.setFilter('published', 'Trashed'); |
| 68 | + cy.searchForItem('Test banner'); |
| 69 | + cy.checkAllResults(); |
| 70 | + cy.clickToolbarButton('empty trash'); |
| 71 | + cy.on('window:confirm', () => true); |
| 72 | + |
| 73 | + cy.get('#system-message-container').contains('Banner deleted.').should('exist'); |
| 74 | + }); |
| 75 | + }); |
| 76 | +}); |
0 commit comments