|
| 1 | +import editor from '../../../support/tools/editor'; |
| 2 | +import file from '../../../fixtures/documents/file.json'; |
| 3 | +const currentProjectId = 25; |
| 4 | + |
| 5 | +describe('I can access tabs and see notifications', () => { |
| 6 | + before(() => { |
| 7 | + cy.login('collectivité1'); |
| 8 | + cy.visit(`/project/${currentProjectId}/presentation`); |
| 9 | + cy.get('[data-test-id="badge-tab-new-task"]').should('not.exist'); |
| 10 | + cy.get('[data-test-id="badge-tab-new-message"]').should('not.exist'); |
| 11 | + cy.get('[data-test-id="badge-tab-new-file"]').should('not.exist'); |
| 12 | + cy.logout(); |
| 13 | + |
| 14 | + cy.login('conseiller1'); |
| 15 | + // Create a task to have a notification |
| 16 | + cy.visit(`/project/${currentProjectId}/actions`); |
| 17 | + cy.createTask('Tâche notification'); |
| 18 | + |
| 19 | + // Create message to have a notification |
| 20 | + cy.visit(`/project/${currentProjectId}/conversations`); |
| 21 | + const now = new Date(); |
| 22 | + |
| 23 | + cy.get('textarea') |
| 24 | + .type(`test : ${now}`, { force: true }) |
| 25 | + .should('have.value', `test : ${now}`); |
| 26 | + |
| 27 | + editor.writeMessage(`test : ${now}`); |
| 28 | + cy.contains('Envoyer').click({ force: true }); |
| 29 | + cy.contains(`test : ${now}`); |
| 30 | + |
| 31 | + // Post a file to have a notification |
| 32 | + cy.visit(`/project/${currentProjectId}/documents`); |
| 33 | + |
| 34 | + cy.document().then((doc) => { |
| 35 | + var popover = doc.getElementById('popover'); |
| 36 | + popover.style = 'display:block !important;'; |
| 37 | + |
| 38 | + cy.get('[name="the_file"]').selectFile(file.path, { force: true }); |
| 39 | + cy.get('#document-description') |
| 40 | + .type(file.description, { force: true, delay: 0 }) |
| 41 | + .should('have.value', file.description); |
| 42 | + cy.get('#document-submit-button').click({ force: true }); |
| 43 | + }); |
| 44 | + |
| 45 | + cy.contains('Le document a bien été enregistré'); |
| 46 | + cy.logout(); |
| 47 | + }); |
| 48 | + |
| 49 | + it('goes to the action page of my project', () => { |
| 50 | + cy.login('collectivité1'); |
| 51 | + cy.visit(`/project/25/presentation`); |
| 52 | + cy.get('[data-test-id="badge-tab-new-task"]').should('exist'); |
| 53 | + cy.get('[data-test-id="badge-tab-new-message"]').should('exist'); |
| 54 | + cy.get('[data-test-id="badge-tab-new-file"]').should('exist'); |
| 55 | + }); |
| 56 | +}); |
0 commit comments