test: ui test for inserting image in markdown
This commit is contained in:
parent
5740dbb447
commit
168bf6d3e4
2 changed files with 25 additions and 0 deletions
22
cypress/integration/control_markdown_editor.js
Normal file
22
cypress/integration/control_markdown_editor.js
Normal file
|
|
@ -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",
|
||||
""
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
@ -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();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue