diff --git a/src/modules/drawing/components/DrawingToolbox.vue b/src/modules/drawing/components/DrawingToolbox.vue index 2030f8a23..57a44966a 100644 --- a/src/modules/drawing/components/DrawingToolbox.vue +++ b/src/modules/drawing/components/DrawingToolbox.vue @@ -171,6 +171,7 @@ const debounceSaveDrawingName = debounce(async (newName) => { :class="{ 'rounded-bottom-0': isPhoneMode }" >
{ + const mapWidth = $el.width() + const mapHeight = $el.height() + cy.get('[data-cy="ol-map"]').click(mapWidth / 2 + 50, mapHeight / 2) + }) - cy.get('[data-cy="report-problem-email"] [data-cy="email-input"]') - .as('emailInput') - .should('be.visible') - cy.get('@emailInput').type(validEmail) + cy.get('[data-cy="drawing-toolbox-close-button"]').should('be.visible').click() + cy.get('@reportForm').should('be.visible') + cy.get('[data-cy="drawing-header-title"]').should('not.exist') - cy.log('Enter the drawing mode') - cy.viewport('macbook-11') + cy.get('[data-cy="window-close"]').should('be.visible').click() + cy.get('[data-cy="menu-button"]').should('be.visible').click() + + cy.get('[data-cy="menu-tray-drawing-section"] > [data-cy="menu-section-header"]').click() + cy.get('[data-cy="drawing-toolbox-close-button"]').should('be.visible').click() + cy.readStoreValue('state.layers.activeLayers').should((layers) => { + expect(layers).to.have.length(0) + }) + cy.get('[data-cy="menu-help-section"]:visible').click() + cy.get('[data-cy="report-problem-button"]').should('be.visible').click() + cy.get('@reportForm').should('be.visible') cy.get('[data-cy="report-problem-drawing-button"]').as('reportDrawing').should('be.visible') + + cy.log('Redo the drawing in the report problem form') cy.get('@reportDrawing').click() - cy.get('@reportForm').should('not.be.visible') - // we need to increase the timeout here below because, upon opening the drawing mode for the - // first time in e2e tests, the loading of the library can take time - cy.get('[data-cy="drawing-header-title"]', { timeout: 15000 }) - .should('be.visible') - .contains('3. Indicate the appropriate location on the map :') - cy.get('[data-cy="drawing-toolbox-share-button"]').should('not.exist') - cy.get('[data-cy="drawing-toolbox-disclaimer"]').should('not.exist') cy.log('Draw some features') + cy.viewport('macbook-11') cy.clickDrawingTool(EditableFeatureTypes.MARKER) cy.get('[data-cy="ol-map"]').click('center') @@ -290,12 +297,39 @@ describe('Testing the report problem form', () => { const mapHeight = $el.height() cy.get('[data-cy="ol-map"]').click(mapWidth / 2 + 50, mapHeight / 2) }) + // we need to increase the timeout here below because, upon opening the drawing mode for the + // first time in e2e tests, the loading of the library can take time + cy.get('[data-cy="drawing-header-title"]', { timeout: 15000 }) + .should('be.visible') + .contains('3. Indicate the appropriate location on the map :') + cy.get('[data-cy="drawing-toolbox-share-button"]').should('not.exist') + cy.get('[data-cy="drawing-toolbox-disclaimer"]').should('not.exist') + cy.get('[data-cy="drawing-toolbox-file-name-input"]').should('not.exist') cy.log(`Exit drawing mode`) cy.get('[data-cy="drawing-header-close-button"]').should('be.visible').click() - cy.get('[data-cy="drawing-share-admin-close"]').click() - cy.get('@reportForm').should('be.visible') - cy.get('[data-cy="drawing-header-title"]').should('not.exist') + + cy.log('Verify report problem form with drawing attachment') + cy.get('[data-cy="report-problem-form"]').as('reportForm').should('be.visible') + + cy.log('Select category') + cy.get('[data-cy="report-problem-category"] [data-cy="dropdown-main-button"]') + .as('categoryDropdown') + .should('be.visible') + cy.get('@categoryDropdown').click() + cy.get('[data-cy="dropdown-item-other"]:visible').click() + + cy.log('Write description and email') + cy.get('[data-cy="report-problem-text-area"] [data-cy="text-area-input"]') + .as('textArea') + .should('be.visible') + cy.get('@textArea').type(text) + + cy.get('[data-cy="report-problem-email"] [data-cy="email-input"]') + .as('emailInput') + .should('be.visible') + cy.get('@emailInput').type(validEmail) + cy.get('@textArea').should('be.visible').should('have.value', text) cy.get('@emailInput').should('be.visible').should('have.value', validEmail) cy.get('[data-cy="report-problem-drawing-added-feedback"]').scrollIntoView() @@ -341,7 +375,6 @@ describe('Testing the report problem form', () => { }) cy.get('[data-cy="drawing-toolbox-close-button"]').should('be.visible').click() - cy.get('[data-cy="drawing-share-admin-close"]').should('be.visible').click() cy.get('@categoryDropdown').scrollIntoView() cy.get('@reportForm').should('be.visible') cy.get('[data-cy="drawing-header-title"]').should('not.exist')