Skip to content

Commit

Permalink
[RFR] Remove Drag n Drop dependency (konveyor#1209)
Browse files Browse the repository at this point in the history
* Remove Drag n Drop dependency

* Remove Drag n Drop dependency

* Remove Drag n Drop dependency
  • Loading branch information
sshveta authored Aug 29, 2024
1 parent b69f307 commit 49b5dbd
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,13 @@ export class AssessmentQuestionnaire {
public static import(fileName: string) {
AssessmentQuestionnaire.open();
click(importQuestionnaire);
cy.get(questionnaireUpload, { timeout: 2 * SEC }).attachFile(fileName, {
subjectType: "drag-n-drop",
});
cy.get('input[type="file"]', { timeout: 2 * SEC }).selectFile(
`cypress/fixtures/${fileName}`,
{
timeout: 120 * SEC,
force: true,
}
);
cy.get(commonView.controlsForm, { timeout: 5 * SEC })
.find("button")
.contains("Import")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ export class CustomMigrationTarget {
}

public static uploadImage(imagePath: string, input = false) {
cy.get(CustomMigrationTargetView.imageInput).attachFile(
{ filePath: imagePath },
{ subjectType: input ? "input" : "drag-n-drop" }
);
cy.get(CustomMigrationTargetView.imageInput).selectFile(`cypress/fixtures/${imagePath}`, {
timeout: 120 * SEC,
force: true,
});
}

private static fillForm(values: Partial<CustomMigrationTarget>) {
Expand Down
1 change: 0 additions & 1 deletion cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,3 @@

require("cy-verify-downloads").addCustomCommand();
require("cypress-downloadfile/lib/downloadFileCommand");
require("@4tw/cypress-drag-drop");
19 changes: 10 additions & 9 deletions cypress/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -690,8 +690,9 @@ export function notExistsWithinRow(
export function importApplication(fileName: string, disableAutoCreation?: boolean): void {
// Performs application import via csv file upload
application_inventory_kebab_menu("Import");
cy.get("#file-filename", { timeout: 2 * SEC }).attachFile(fileName, {
subjectType: "drag-n-drop",
cy.get('input[type="file"]', { timeout: 2 * SEC }).selectFile(`cypress/fixtures/${fileName}`, {
timeout: 120 * SEC,
force: true,
});
//Uncheck createEntitiesCheckbox if auto creation of entities is disabled
if (disableAutoCreation)
Expand All @@ -707,24 +708,24 @@ export function importApplication(fileName: string, disableAutoCreation?: boolea
}

export function uploadXml(fileName: string, selector = 'input[type="file"]'): void {
cy.get(selector, { timeout: 5 * SEC }).attachFile(
{ filePath: fileName, mimeType: "text/xml", encoding: "utf-8" },
{ subjectType: "drag-n-drop" }
);
cy.get(selector, { timeout: 5 * SEC }).selectFile(`cypress/fixtures/${fileName}`, {
timeout: 120 * SEC,
force: true,
});
cy.wait(2000);
}

export function uploadApplications(fileName: string): void {
cy.get('input[type="file"]', { timeout: 5 * SEC }).selectFile(`cypress/fixtures/${fileName}`, {
action: "drag-drop",
timeout: 120 * SEC,
force: true,
});
}

export function uploadFile(fileName: string): void {
cy.get('input[type="file"]', { timeout: 5 * SEC }).attachFile(fileName, {
subjectType: "drag-n-drop",
cy.get('input[type="file"]', { timeout: 5 * SEC }).selectFile(`cypress/fixtures/${fileName}`, {
timeout: 120 * SEC,
force: true,
});
cy.wait(2000);
}
Expand Down
17 changes: 0 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"main": "index.js",
"repository": "https://github.com/konveyor/tackle-ui-tests.git",
"dependencies": {
"cypress-drag-drop": "^1.1.1",
"cypress-file-upload": "^5.0.8",
"cypress-grep": "^2.5.3",
"cypress-log-filter": "^1.0.4",
Expand All @@ -29,7 +28,6 @@
"mergereports": "npx jrm ./cypress/reports/junitreport.xml ./cypress/reports/junit/*.xml"
},
"devDependencies": {
"@4tw/cypress-drag-drop": "^2.2.3",
"@testing-library/cypress": "^10.0.1",
"@types/node": "^20.1.0",
"cy-verify-downloads": "^0.1.13",
Expand Down

0 comments on commit 49b5dbd

Please sign in to comment.