|
| 1 | +describe('Test in backend that the contacts list', () => { |
| 2 | + beforeEach(() => { |
| 3 | + cy.doAdministratorLogin(); |
| 4 | + cy.visit('/administrator/index.php?option=com_contact&view=contacts&filter='); |
| 5 | + }); |
| 6 | + |
| 7 | + it('has a title', () => { |
| 8 | + cy.get('h1.page-title').should('contain.text', 'Contacts'); |
| 9 | + }); |
| 10 | + |
| 11 | + it('can display a list of contacts', () => { |
| 12 | + cy.db_createContact({ name: 'Test contact' }).then(() => { |
| 13 | + cy.reload(); |
| 14 | + |
| 15 | + cy.contains('Test contact'); |
| 16 | + }); |
| 17 | + }); |
| 18 | + |
| 19 | + it('can open the contact form', () => { |
| 20 | + cy.clickToolbarButton('New'); |
| 21 | + |
| 22 | + cy.contains('Contacts: New'); |
| 23 | + }); |
| 24 | + |
| 25 | + it('can publish the test contact', () => { |
| 26 | + cy.db_createContact({ name: 'Test contact', published: 0 }).then(() => { |
| 27 | + cy.reload(); |
| 28 | + cy.searchForItem('Test contact'); |
| 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('Contact published.').should('exist'); |
| 35 | + }); |
| 36 | + }); |
| 37 | + |
| 38 | + it('can unpublish the test contact', () => { |
| 39 | + cy.db_createContact({ name: 'Test contact', published: 1 }).then(() => { |
| 40 | + cy.reload(); |
| 41 | + cy.searchForItem('Test contact'); |
| 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('Contact unpublished.').should('exist'); |
| 48 | + }); |
| 49 | + }); |
| 50 | + |
| 51 | + it('can feature the test contact', () => { |
| 52 | + cy.db_createContact({ name: 'Test contact', featured: 0 }).then(() => { |
| 53 | + cy.reload(); |
| 54 | + cy.searchForItem('Test contact'); |
| 55 | + cy.checkAllResults(); |
| 56 | + cy.clickToolbarButton('Action'); |
| 57 | + cy.contains('.button-featured', 'Feature').click(); |
| 58 | + cy.on('window:confirm', () => true); |
| 59 | + |
| 60 | + cy.get('#system-message-container').contains('Contact featured.').should('exist'); |
| 61 | + }); |
| 62 | + }); |
| 63 | + |
| 64 | + it('can unfeature the test contact', () => { |
| 65 | + cy.db_createContact({ name: 'Test contact', featured: 1 }).then(() => { |
| 66 | + cy.reload(); |
| 67 | + cy.searchForItem('Test contact'); |
| 68 | + cy.checkAllResults(); |
| 69 | + cy.clickToolbarButton('Action'); |
| 70 | + cy.contains('Unfeature').click(); |
| 71 | + cy.on('window:confirm', () => true); |
| 72 | + |
| 73 | + cy.get('#system-message-container').contains('Contact unfeatured.').should('exist'); |
| 74 | + }); |
| 75 | + }); |
| 76 | + |
| 77 | + it('can trash the test contact', () => { |
| 78 | + cy.db_createContact({ name: 'Test contact' }).then(() => { |
| 79 | + cy.reload(); |
| 80 | + cy.searchForItem('Test contact'); |
| 81 | + cy.checkAllResults(); |
| 82 | + cy.clickToolbarButton('Action'); |
| 83 | + cy.contains('Trash').click(); |
| 84 | + cy.on('window:confirm', () => true); |
| 85 | + |
| 86 | + cy.get('#system-message-container').contains('Contact trashed.').should('exist'); |
| 87 | + }); |
| 88 | + }); |
| 89 | + |
| 90 | + it('can delete the test contact', () => { |
| 91 | + cy.db_createContact({ name: 'Test contact', published: -2 }).then(() => { |
| 92 | + cy.reload(); |
| 93 | + cy.setFilter('published', 'Trashed'); |
| 94 | + cy.searchForItem('Test contact'); |
| 95 | + cy.checkAllResults(); |
| 96 | + cy.clickToolbarButton('empty trash'); |
| 97 | + cy.on('window:confirm', () => true); |
| 98 | + |
| 99 | + cy.get('#system-message-container').contains('Contact deleted.').should('exist'); |
| 100 | + }); |
| 101 | + }); |
| 102 | +}); |
0 commit comments