diff --git a/cypress/integration/control_markdown_editor.js b/cypress/integration/control_markdown_editor.js new file mode 100644 index 0000000000..b527d854d4 --- /dev/null +++ b/cypress/integration/control_markdown_editor.js @@ -0,0 +1,22 @@ +context("Control Markdown Editor", () => { + before(() => { + cy.login(); + cy.visit("/app"); + }); + + it("should allow inserting images by drag and drop", () => { + cy.visit("/app/web-page/new"); + cy.fill_field("content_type", "Markdown", "Select"); + cy.get_field("main_section_md", "Markdown Editor").attachFile( + "sample_image.jpg", + { + subjectType: "drag-n-drop" + } + ); + cy.click_modal_primary_button("Upload"); + cy.get_field("main_section_md", "Markdown Editor").should( + "contain", + "![](/files/sample_image.jpg)" + ); + }); +}); diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 37134f0cbc..636312376d 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -174,6 +174,9 @@ Cypress.Commands.add('get_field', (fieldname, fieldtype = 'Data') => { if (fieldtype === 'Code') { selector = `[data-fieldname="${fieldname}"] .ace_text-input`; } + if (fieldtype === 'Markdown Editor') { + selector = `[data-fieldname="${fieldname}"] .ace-editor-target`; + } return cy.get(selector).first(); });