From 933f1d7a965dd361c76e0197b44da5b159e8a6da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Jean?= Date: Mon, 21 Dec 2020 09:51:52 -0500 Subject: [PATCH 1/2] fix --- cypress/integration/udt-test.spec.js | 6 +----- .../test/create-and-visit-collaborative-session.spec.js | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/cypress/integration/udt-test.spec.js b/cypress/integration/udt-test.spec.js index 8d1938f4..992f8ea9 100644 --- a/cypress/integration/udt-test.spec.js +++ b/cypress/integration/udt-test.spec.js @@ -9,7 +9,7 @@ import pasteImageUrls from "../utils/test/paste-image-urls.spec" import textEntityClassification from "../utils/test/text-entity-classification.spec" Cypress.config("defaultCommandTimeout", 3000) describe("Udt test", () => { - before("Prepare test", () => { + beforeEach("Prepare test", () => { cy.visit(`http://localhost:6001`) cy.get('input[id="react-select-2-input"]') .focus() @@ -25,8 +25,4 @@ describe("Udt test", () => { pasteImageUrlsWithCSV() pasteImageUrls() textEntityClassification() - - afterEach("Return home page", () => { - cy.get("button[title='Exit to Welcome Page']").click() - }) }) diff --git a/cypress/utils/test/create-and-visit-collaborative-session.spec.js b/cypress/utils/test/create-and-visit-collaborative-session.spec.js index 1add0412..7c58324b 100644 --- a/cypress/utils/test/create-and-visit-collaborative-session.spec.js +++ b/cypress/utils/test/create-and-visit-collaborative-session.spec.js @@ -9,7 +9,7 @@ const createAndVisitCollaborativeSession = () => { cy.log("should be able to create new session") cy.get("div[title='collaborate-icon']").click() - cy.contains("Create New Session").click() + cy.contains("Create New Session", { timeout: 5000 }).click() cy.contains("Leave Session", { timeout: 10000 }) cy.get("div[title='collaborate-icon']").trigger("mouseleave") From c8bb196ee795b70e8bd5eaae0a7263f3eb6fb43f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Jean?= Date: Fri, 4 Dec 2020 16:31:50 -0500 Subject: [PATCH 2/2] import assets --- .../integration/collaborative-session.spec.js | 4 +- .../integration/function-verification.spec.js | 4 + cypress/integration/udt-test.spec.js | 19 +- .../function-test/get-data-url-type.spec.js | 28 ++ ...samples-in-a-collaborative-session.spec.js | 0 ...te-and-visit-collaborative-session.spec.js | 0 .../create-new-file.spec.js | 0 .../image-classification.spec.js | 0 .../image-segmentation.spec.js | 0 .../keyboard-shortcuts.spec.js | 0 .../label-help.spec.js | 0 .../named-entity-recognition.spec.js | 0 .../paste-image-urls-with-csv.spec.js | 0 .../paste-image-urls.spec.js | 0 .../text-entity-classification.spec.js | 0 package.json | 1 + public/legal.html | 12 +- .../check-interface-and-sample-type.js | 21 +- .../ImportFromCognitoS3Dialog/index.js | 298 ++++++++++++++++-- .../init-config-import.js | 32 +- .../set-type-of-file-to-load-and-disable.js | 34 +- .../ImportFromCognitoS3Dialog/set-url.js | 43 +++ src/components/ImportPage/index.js | 137 ++++---- src/utils/RecognizeFileExtension.js | 24 -- .../dataset-helper/get-files-differences.js | 107 +++---- src/utils/get-data-url-type.js | 17 + yarn.lock | 6 +- 27 files changed, 561 insertions(+), 226 deletions(-) create mode 100644 cypress/integration/function-verification.spec.js create mode 100644 cypress/utils/function-test/get-data-url-type.spec.js rename cypress/utils/{test => interface-test}/click-on-100-samples-in-a-collaborative-session.spec.js (100%) rename cypress/utils/{test => interface-test}/create-and-visit-collaborative-session.spec.js (100%) rename cypress/utils/{test => interface-test}/create-new-file.spec.js (100%) rename cypress/utils/{test => interface-test}/image-classification.spec.js (100%) rename cypress/utils/{test => interface-test}/image-segmentation.spec.js (100%) rename cypress/utils/{test => interface-test}/keyboard-shortcuts.spec.js (100%) rename cypress/utils/{test => interface-test}/label-help.spec.js (100%) rename cypress/utils/{test => interface-test}/named-entity-recognition.spec.js (100%) rename cypress/utils/{test => interface-test}/paste-image-urls-with-csv.spec.js (100%) rename cypress/utils/{test => interface-test}/paste-image-urls.spec.js (100%) rename cypress/utils/{test => interface-test}/text-entity-classification.spec.js (100%) create mode 100644 src/components/ImportFromCognitoS3Dialog/set-url.js delete mode 100644 src/utils/RecognizeFileExtension.js create mode 100644 src/utils/get-data-url-type.js diff --git a/cypress/integration/collaborative-session.spec.js b/cypress/integration/collaborative-session.spec.js index 3543e5b6..f098b6cb 100644 --- a/cypress/integration/collaborative-session.spec.js +++ b/cypress/integration/collaborative-session.spec.js @@ -1,5 +1,5 @@ -import clickOn100SamplesInACollaborativeSession from "../utils/test/click-on-100-samples-in-a-collaborative-session.spec" -import createAndVisitCollaborativeSession from "../utils/test/create-and-visit-collaborative-session.spec" +import clickOn100SamplesInACollaborativeSession from "../utils/interface-test/click-on-100-samples-in-a-collaborative-session.spec" +import createAndVisitCollaborativeSession from "../utils/interface-test/create-and-visit-collaborative-session.spec" Cypress.config("defaultCommandTimeout", 3000) describe("Create and Visit Collaborative Session", () => { beforeEach("Prepare test", () => { diff --git a/cypress/integration/function-verification.spec.js b/cypress/integration/function-verification.spec.js new file mode 100644 index 00000000..e12e88ba --- /dev/null +++ b/cypress/integration/function-verification.spec.js @@ -0,0 +1,4 @@ +import getDataUrlTypeTest from "../utils/function-test/get-data-url-type.spec" +describe("Function verification", () => { + getDataUrlTypeTest() +}) diff --git a/cypress/integration/udt-test.spec.js b/cypress/integration/udt-test.spec.js index 992f8ea9..1e0e8394 100644 --- a/cypress/integration/udt-test.spec.js +++ b/cypress/integration/udt-test.spec.js @@ -1,12 +1,13 @@ -import createNewFile from "../utils/test/create-new-file.spec" -import imageClassification from "../utils/test/image-classification.spec" -import imageSegmentation from "../utils/test/image-segmentation.spec" -import keyboardShortcuts from "../utils/test/keyboard-shortcuts.spec" -import labelHelp from "../utils/test/label-help.spec" -import namedEntityRecognition from "../utils/test/named-entity-recognition.spec" -import pasteImageUrlsWithCSV from "../utils/test/paste-image-urls-with-csv.spec" -import pasteImageUrls from "../utils/test/paste-image-urls.spec" -import textEntityClassification from "../utils/test/text-entity-classification.spec" +import createNewFile from "../utils/interface-test/create-new-file.spec" +import imageClassification from "../utils/interface-test/image-classification.spec" +import imageSegmentation from "../utils/interface-test/image-segmentation.spec" +import keyboardShortcuts from "../utils/interface-test/keyboard-shortcuts.spec" +import labelHelp from "../utils/interface-test/label-help.spec" +import namedEntityRecognition from "../utils/interface-test/named-entity-recognition.spec" +import pasteImageUrlsWithCSV from "../utils/interface-test/paste-image-urls-with-csv.spec" +import pasteImageUrls from "../utils/interface-test/paste-image-urls.spec" +import textEntityClassification from "../utils/interface-test/text-entity-classification.spec" + Cypress.config("defaultCommandTimeout", 3000) describe("Udt test", () => { beforeEach("Prepare test", () => { diff --git a/cypress/utils/function-test/get-data-url-type.spec.js b/cypress/utils/function-test/get-data-url-type.spec.js new file mode 100644 index 00000000..8569dfeb --- /dev/null +++ b/cypress/utils/function-test/get-data-url-type.spec.js @@ -0,0 +1,28 @@ +import getDataUrlType from "../../../src/utils/get-data-url-type" +const getDataUrlTypeTest = () => { + it("Check getDataUrlType", () => { + expect( + getDataUrlType( + "https://s3.amazonaws.com/asset.workaround.online/example-jobs/sticky-notes/image2.jpg" + ) + ).to.equal("Image") + expect( + getDataUrlType( + "https://s3.amazonaws.com/asset.workaround.online/SampleVideo_1280x720_1mb.mp4" + ) + ).to.equal("Video") + expect( + getDataUrlType("https://html5tutorial.info/media/vincent.mp3") + ).to.equal("Audio") + expect(getDataUrlType("https://arxiv.org/pdf/1908.07069.pdf")).to.equal( + "PDF" + ) + expect(getDataUrlType("https://arxiv.org/pdf/1908.07069.txt")).to.equal( + "Texte" + ) + expect(getDataUrlType("https://arxiv.org/pdf/1908.07069.js")).to.equal( + "File" + ) + }) +} +export default getDataUrlTypeTest diff --git a/cypress/utils/test/click-on-100-samples-in-a-collaborative-session.spec.js b/cypress/utils/interface-test/click-on-100-samples-in-a-collaborative-session.spec.js similarity index 100% rename from cypress/utils/test/click-on-100-samples-in-a-collaborative-session.spec.js rename to cypress/utils/interface-test/click-on-100-samples-in-a-collaborative-session.spec.js diff --git a/cypress/utils/test/create-and-visit-collaborative-session.spec.js b/cypress/utils/interface-test/create-and-visit-collaborative-session.spec.js similarity index 100% rename from cypress/utils/test/create-and-visit-collaborative-session.spec.js rename to cypress/utils/interface-test/create-and-visit-collaborative-session.spec.js diff --git a/cypress/utils/test/create-new-file.spec.js b/cypress/utils/interface-test/create-new-file.spec.js similarity index 100% rename from cypress/utils/test/create-new-file.spec.js rename to cypress/utils/interface-test/create-new-file.spec.js diff --git a/cypress/utils/test/image-classification.spec.js b/cypress/utils/interface-test/image-classification.spec.js similarity index 100% rename from cypress/utils/test/image-classification.spec.js rename to cypress/utils/interface-test/image-classification.spec.js diff --git a/cypress/utils/test/image-segmentation.spec.js b/cypress/utils/interface-test/image-segmentation.spec.js similarity index 100% rename from cypress/utils/test/image-segmentation.spec.js rename to cypress/utils/interface-test/image-segmentation.spec.js diff --git a/cypress/utils/test/keyboard-shortcuts.spec.js b/cypress/utils/interface-test/keyboard-shortcuts.spec.js similarity index 100% rename from cypress/utils/test/keyboard-shortcuts.spec.js rename to cypress/utils/interface-test/keyboard-shortcuts.spec.js diff --git a/cypress/utils/test/label-help.spec.js b/cypress/utils/interface-test/label-help.spec.js similarity index 100% rename from cypress/utils/test/label-help.spec.js rename to cypress/utils/interface-test/label-help.spec.js diff --git a/cypress/utils/test/named-entity-recognition.spec.js b/cypress/utils/interface-test/named-entity-recognition.spec.js similarity index 100% rename from cypress/utils/test/named-entity-recognition.spec.js rename to cypress/utils/interface-test/named-entity-recognition.spec.js diff --git a/cypress/utils/test/paste-image-urls-with-csv.spec.js b/cypress/utils/interface-test/paste-image-urls-with-csv.spec.js similarity index 100% rename from cypress/utils/test/paste-image-urls-with-csv.spec.js rename to cypress/utils/interface-test/paste-image-urls-with-csv.spec.js diff --git a/cypress/utils/test/paste-image-urls.spec.js b/cypress/utils/interface-test/paste-image-urls.spec.js similarity index 100% rename from cypress/utils/test/paste-image-urls.spec.js rename to cypress/utils/interface-test/paste-image-urls.spec.js diff --git a/cypress/utils/test/text-entity-classification.spec.js b/cypress/utils/interface-test/text-entity-classification.spec.js similarity index 100% rename from cypress/utils/test/text-entity-classification.spec.js rename to cypress/utils/interface-test/text-entity-classification.spec.js diff --git a/package.json b/package.json index 399460a6..e4272612 100644 --- a/package.json +++ b/package.json @@ -102,6 +102,7 @@ "in-browser-download": "^2.0.0", "jac-format": "^1.1.3", "js-md5": "^0.7.3", + "mime-types": "^2.1.27", "moment": "^2.24.0", "nan": "^2.14.1", "posthog-js": "^1.0.4", diff --git a/public/legal.html b/public/legal.html index e4837981..4ba47044 100644 --- a/public/legal.html +++ b/public/legal.html @@ -10,19 +10,19 @@