Use file upload instead of typing large text (#2228)

This commit is contained in:
Erik Jan de Wit 2022-03-15 10:45:15 +01:00 committed by GitHub
parent 3a1cd3e5b3
commit 6b993ea93a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 15 deletions

View file

@ -39,7 +39,7 @@ describe("Partial import test", () => {
modal.importButton().should("not.exist");
});
it.skip("Import button only enabled if JSON has something to import", () => {
it("Import button only enabled if JSON has something to import", () => {
modal.open();
cy.get(".pf-c-code-editor__code textarea").type("{}");
modal.importButton().should("be.disabled");
@ -85,7 +85,7 @@ describe("Partial import test", () => {
modal.closeButton().click();
});
it.skip("Displays user options after realmless import and does the import", () => {
it("Displays user options after realmless import and does the import", () => {
modal.open();
modal.typeResourceFile("client-only.json");

View file

@ -25,3 +25,4 @@
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
import "@testing-library/cypress/add-commands";
import "cypress-file-upload";

View file

@ -7,18 +7,9 @@ export default class GroupModal {
}
typeResourceFile = (filename: string) => {
cy.readFile("cypress/fixtures/partial-import-test-data/" + filename).then(
(myJSON) => {
const text = JSON.stringify(myJSON);
cy.get(".pf-c-code-editor__code textarea")
.type(text, {
delay: 0,
parseSpecialCharSequences: false,
})
.type("{shift}{end}")
.type("{del}");
}
cy.get("#partial-import-file-filename").attachFile(
"./partial-import-test-data/" + filename,
{ subjectType: "drag-n-drop" }
);
};

View file

@ -2,7 +2,7 @@
"extends": "../tsconfig.json",
"include": ["**/*"],
"compilerOptions": {
"types": ["node", "cypress", "@testing-library/cypress"],
"types": ["node", "cypress", "@testing-library/cypress", "cypress-file-upload"],
"module": "ES2015",
"target": "ES2015",
}

20
package-lock.json generated
View file

@ -53,6 +53,7 @@
"@typescript-eslint/parser": "^5.14.0",
"cli-progress": "^3.10.0",
"cypress": "^9.5.1",
"cypress-file-upload": "^5.0.8",
"decompress": "^4.2.1",
"eslint": "^8.11.0",
"eslint-config-prettier": "^8.5.0",
@ -8145,6 +8146,18 @@
"node": ">=12.0.0"
}
},
"node_modules/cypress-file-upload": {
"version": "5.0.8",
"resolved": "https://registry.npmjs.org/cypress-file-upload/-/cypress-file-upload-5.0.8.tgz",
"integrity": "sha512-+8VzNabRk3zG6x8f8BWArF/xA/W0VK4IZNx3MV0jFWrJS/qKn8eHfa5nU73P9fOQAgwHFJx7zjg4lwOnljMO8g==",
"dev": true,
"engines": {
"node": ">=8.2.1"
},
"peerDependencies": {
"cypress": ">3.0.0"
}
},
"node_modules/cypress/node_modules/@types/node": {
"version": "14.17.21",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.21.tgz",
@ -28328,6 +28341,13 @@
}
}
},
"cypress-file-upload": {
"version": "5.0.8",
"resolved": "https://registry.npmjs.org/cypress-file-upload/-/cypress-file-upload-5.0.8.tgz",
"integrity": "sha512-+8VzNabRk3zG6x8f8BWArF/xA/W0VK4IZNx3MV0jFWrJS/qKn8eHfa5nU73P9fOQAgwHFJx7zjg4lwOnljMO8g==",
"dev": true,
"requires": {}
},
"d3-color": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.0.1.tgz",

View file

@ -69,6 +69,7 @@
"@typescript-eslint/parser": "^5.14.0",
"cli-progress": "^3.10.0",
"cypress": "^9.5.1",
"cypress-file-upload": "^5.0.8",
"decompress": "^4.2.1",
"eslint": "^8.11.0",
"eslint-config-prettier": "^8.5.0",