2020-03-05 10:37:50 +00:00
|
|
|
/// <reference types="cypress" />
|
|
|
|
|
|
|
|
context("Skynet", () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
cy.visit("");
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should render key website elements", () => {
|
|
|
|
cy.contains("Build a Free Internet");
|
|
|
|
cy.contains("Upload your Files");
|
|
|
|
cy.contains("Have a Skylink?");
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should be able to upload a file", () => {
|
2021-01-27 12:01:20 +00:00
|
|
|
cy.intercept("POST", "/skynet/skyfile").as("upload");
|
2020-03-11 09:47:25 +00:00
|
|
|
|
2020-03-05 10:37:50 +00:00
|
|
|
const fileName = "check.json";
|
|
|
|
|
2021-01-27 12:01:20 +00:00
|
|
|
cy.wait(1000); // delay for drag-and-drop to work properly every time
|
2021-01-27 12:10:27 +00:00
|
|
|
cy.get('.home-upload input[type="file"]').attachFile(fileName, { subjectType: "drag-n-drop" });
|
2020-03-05 10:37:50 +00:00
|
|
|
|
2020-09-14 09:40:59 +00:00
|
|
|
cy.get(".home-upload").scrollIntoView();
|
|
|
|
cy.get(".home-uploaded-files").children().should("have.length", 1);
|
2020-03-11 09:47:25 +00:00
|
|
|
|
2020-04-23 15:36:34 +00:00
|
|
|
// wait max 2 minutes, the portal might be slow at times
|
|
|
|
cy.wait("@upload", { responseTimeout: 2 * 60 * 1000 });
|
2020-03-11 09:47:25 +00:00
|
|
|
|
2020-03-05 10:37:50 +00:00
|
|
|
cy.contains(".upload-file", fileName).within(() => {
|
|
|
|
cy.get(".url")
|
|
|
|
.invoke("text")
|
|
|
|
.should("match", /\/[a-zA-Z0-9-_]{46}/);
|
|
|
|
|
|
|
|
cy.contains("Copy Link").click();
|
|
|
|
cy.contains("Copied!").should("be.visible");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|