Skip to content

Commit

Permalink
test case for drag and drop added
Browse files Browse the repository at this point in the history
  • Loading branch information
rajatkhurana-adobe committed Oct 20, 2023
1 parent 7d54e52 commit c571244
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions ui.tests/test-module/specs/fileinput/fileinput.runtime.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,36 @@ describe("Form with File Input - Prefill & Submit tests", () => {
submitTest();
})

it.only(`${fileInput.type} - attach files using drag and drop, check model, view, preview attachment and submit the form`, () => {
cy.previewForm(pagePath, {
onBeforeLoad : (win) => {
cy.stub(win, 'open'); // creating a stub to check file preview
}
});

// attach the file
cy.get(fileInput.selector).attachFile(fileInput.fileNames, { subjectType: 'drag-n-drop', events: ['dragover', 'drop'] });
if(fileInput.multiple)
cy.get(fileInput.selector).attachFile('sample2.txt');

// check for successful attachment of file in the view
checkFileNamesInFileAttachmentView(fileInput.selector, fileInput.fileNames);
if(fileInput.multiple)
checkFileNamesInFileAttachmentView(fileInput.selector, ['sample2.txt']);

// check preview of the file
checkFilePreviewInFileAttachment(fileInput.selector);

if(fileInput.multiple)
deleteSelectedFiles(fileInput.selector, ['sample2.txt']);

// submit the form
cy.get(".cmp-adaptiveform-button__widget").click();

// check for successful submission
submitTest();
})

it(`${fileInput.type} - view prefill of submitted form, make changes to attachments and submit`, () => {
cy.get("@prefillId").then(id => {
cy.previewForm(pagePath, {
Expand Down

0 comments on commit c571244

Please sign in to comment.