|
| 1 | +import projects from '../../../fixtures/projects/projects.json'; |
| 2 | +import file from '../../../fixtures/documents/file.json'; |
| 3 | + |
| 4 | +const currentProject = projects[1]; |
| 5 | + |
| 6 | +describe('I can fill a project survey @critical', () => { |
| 7 | + beforeEach(() => { |
| 8 | + cy.login('collectivité1'); |
| 9 | + cy.visit(`/project/${currentProject.pk}`); |
| 10 | + }); |
| 11 | + |
| 12 | + it('fills up the survey and upload a file', () => { |
| 13 | + cy.visit(`/project/${currentProject.pk}`); |
| 14 | + |
| 15 | + cy.get('[data-test-id="project-navigation-knowledge"]').click({ |
| 16 | + force: true, |
| 17 | + }); |
| 18 | + cy.get('[data-test-id="link-fill-survey"]').first().click({ force: true }); |
| 19 | + |
| 20 | + // cy.url().should('include', '/projects/survey/') |
| 21 | + |
| 22 | + cy.get('#form_answer-1').check({ force: true }); |
| 23 | + |
| 24 | + cy.get('#input-project-comment') |
| 25 | + .type('Fake comment on first survey question', { force: true }) |
| 26 | + .should('have.value', 'Fake comment on first survey question'); |
| 27 | + |
| 28 | + cy.get('[name="attachment"]').selectFile(file.path, { force: true }); |
| 29 | + |
| 30 | + cy.get('[data-test-id="button-submit-survey-questionset"]').click({ |
| 31 | + force: true, |
| 32 | + }); |
| 33 | + |
| 34 | + cy.get('#form_answer-1').check({ force: true }); |
| 35 | + |
| 36 | + cy.get('#input-project-comment') |
| 37 | + .type('Fake comment on first survey question', { force: true }) |
| 38 | + .should('have.value', 'Fake comment on first survey question'); |
| 39 | + |
| 40 | + |
| 41 | + cy.get('[data-test-id="button-submit-survey-questionset"]').click({ |
| 42 | + force: true, |
| 43 | + }); |
| 44 | + |
| 45 | + cy.get('[data-test-id="project-navigation-knowledge"]').click({ |
| 46 | + force: true, |
| 47 | + }); |
| 48 | + cy.url().should('include', '/connaissance'); |
| 49 | + cy.contains('Propriété du site'); |
| 50 | + cy.contains('100%'); |
| 51 | + cy.contains('Fake comment on first survey question'); |
| 52 | + }); |
| 53 | + |
| 54 | + it('can see and download the file', () => { |
| 55 | + cy.visit(`/project/${currentProject.pk}/documents`); |
| 56 | + |
| 57 | + cy.contains('Fichier récupéré de l\'état des lieux'); |
| 58 | + |
| 59 | + // test download with cy verification |
| 60 | + // cy.get('[data-test-id="project-navigation-documents"]').click({ |
| 61 | + // force: true, |
| 62 | + // }); |
| 63 | + // cy.get('[data-test-id="download-attachment"]').click({ force: true }); |
| 64 | + // cy.readFile(`${Cypress.config('downloadsFolder')}/ui-screenshot.png`) |
| 65 | + |
| 66 | + |
| 67 | + }); |
| 68 | +}); |
0 commit comments