From 4e5bb2d445e29ed236a38cc2bde38b5bbfe6b793 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Fri, 4 Feb 2022 15:14:37 +0100 Subject: [PATCH] reenable end to end uploader test --- .../cypress/integration/intergration.spec.js | 33 +++++++++---------- .../src/components/Uploader/Uploader.js | 8 +++-- .../components/Uploader/UploaderElement.js | 2 +- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/packages/website/cypress/integration/intergration.spec.js b/packages/website/cypress/integration/intergration.spec.js index bc739cd4..2699c853 100644 --- a/packages/website/cypress/integration/intergration.spec.js +++ b/packages/website/cypress/integration/intergration.spec.js @@ -9,27 +9,26 @@ context("Skynet website", () => { cy.contains("Decentralized Internet"); }); - // it("should be able to upload a file", () => { - // cy.intercept("POST", "/skynet/skyfile").as("upload"); + it("should be able to upload a file", () => { + cy.intercept("POST", "/skynet/skyfile").as("upload"); - // const fileName = "check.json"; + const fileName = "example.json"; - // cy.wait(1000); // delay for drag-and-drop to work properly every time - // cy.get('.home-upload input[type="file"]').attachFile(fileName, { subjectType: "drag-n-drop" }); + cy.wait(1000); // delay for drag-and-drop to work properly every time + cy.get('.home-upload-dropzone input[type="file"]').attachFile(fileName, { force: true }); - // cy.get(".home-upload").scrollIntoView(); - // cy.get(".home-uploaded-files").children().should("have.length", 1); + cy.get(".home-uploaded-files").children().should("have.length", 1); - // // wait max 2 minutes, the portal might be slow at times - // cy.wait("@upload", { responseTimeout: 2 * 60 * 1000 }); + // wait max 2 minutes, the portal might be slow at times + cy.wait("@upload", { responseTimeout: 2 * 60 * 1000 }); - // cy.contains(".upload-file", fileName).within(() => { - // cy.get(".url") - // .invoke("text") - // .should("match", /\/[a-zA-Z0-9-_]{46}/); + cy.contains(".upload-file", fileName).within(() => { + cy.get("a") + .invoke("text") + .should("match", /\/[a-zA-Z0-9-_]{46}/); - // cy.contains("Copy Link").click(); - // cy.contains("Copied!").should("be.visible"); - // }); - // }); + cy.contains("Copy").click(); + cy.contains("Copied").should("be.visible"); + }); + }); }); diff --git a/packages/website/src/components/Uploader/Uploader.js b/packages/website/src/components/Uploader/Uploader.js index 5772bca9..1ddd021f 100644 --- a/packages/website/src/components/Uploader/Uploader.js +++ b/packages/website/src/components/Uploader/Uploader.js @@ -164,9 +164,11 @@ const Uploader = () => { {uploads.length > 0 && (
- {uploads.map((upload) => ( - - ))} +
+ {uploads.map((upload) => ( + + ))} +
{showAccountFeatures && (
diff --git a/packages/website/src/components/Uploader/UploaderElement.js b/packages/website/src/components/Uploader/UploaderElement.js index e52b4028..0591d369 100644 --- a/packages/website/src/components/Uploader/UploaderElement.js +++ b/packages/website/src/components/Uploader/UploaderElement.js @@ -110,7 +110,7 @@ export default function UploaderElement({ onUploadStateChange, upload }) { }, [onUploadStateChange, upload, retryTimeout]); return ( -
+
{upload.status === "enqueued" && } {upload.status === "retrying" && }