From e5cfb6054b021ac602ccfc3aba8d7c86caddaec3 Mon Sep 17 00:00:00 2001 From: Juan Manuel Spoleti Date: Tue, 28 Jun 2022 14:22:32 -0300 Subject: [PATCH 1/4] sort Buckets table test --- .../support/page-objects/bucketsPage.ts | 14 ++++++-- .../cypress/support/utils/TestConstants.ts | 4 +++ .../cypress/tests/bucket-management.cy.ts | 35 +++++++++++++++++++ 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 packages/storage-ui/cypress/support/utils/TestConstants.ts diff --git a/packages/storage-ui/cypress/support/page-objects/bucketsPage.ts b/packages/storage-ui/cypress/support/page-objects/bucketsPage.ts index 472f221c58..048f9a4357 100644 --- a/packages/storage-ui/cypress/support/page-objects/bucketsPage.ts +++ b/packages/storage-ui/cypress/support/page-objects/bucketsPage.ts @@ -1,5 +1,6 @@ // Only add things here that could be applicable to the bucket page +import { FILE_SYSTEM_TYPES } from "../utils/TestConstants" import { basePage } from "./basePage" import { createBucketModal } from "./modals/createBucketModal" @@ -13,6 +14,7 @@ export const bucketsPage = { // bucket browser row elements bucketItemRow: () => cy.get("[data-cy=row-bucket-item]"), nameTableHeader: () => cy.get("[data-cy=table-header-name]"), + fileSystemTableHeader: () => cy.get("[data-cy=table-header-file-system]"), sizeTableHeader: () => cy.get("[data-cy=table-header-size]"), bucketItemName: () => cy.get("[data-cy=cell-bucket-name]"), bucketFileSystemType: () => cy.get("[data-cy=cell-file-system-type]"), @@ -22,11 +24,19 @@ export const bucketsPage = { deleteBucketMenuOption: () => cy.get("[data-cy=menu-delete-bucket]"), // helpers and convenience functions - createBucket(bucketName: string) { + createBucket(bucketName: string, bucketType: FILE_SYSTEM_TYPES) { this.createBucketButton().click() createBucketModal.body().should("be.visible") createBucketModal.bucketNameInput().type(bucketName) - createBucketModal.submitButton().safeClick() + switch (bucketType) { + case FILE_SYSTEM_TYPES.IPFS: + createBucketModal.ipfsRadioInput().click() + break + case FILE_SYSTEM_TYPES.CHAINSAFE: + createBucketModal.chainsafeRadioInput().click() + break + } + createBucketModal.submitButton().click() createBucketModal.body().should("not.exist") } } diff --git a/packages/storage-ui/cypress/support/utils/TestConstants.ts b/packages/storage-ui/cypress/support/utils/TestConstants.ts new file mode 100644 index 0000000000..00f55cfab3 --- /dev/null +++ b/packages/storage-ui/cypress/support/utils/TestConstants.ts @@ -0,0 +1,4 @@ +export enum FILE_SYSTEM_TYPES { + CHAINSAFE, + IPFS +} \ No newline at end of file diff --git a/packages/storage-ui/cypress/tests/bucket-management.cy.ts b/packages/storage-ui/cypress/tests/bucket-management.cy.ts index 8db8c31b34..4710d59ab7 100644 --- a/packages/storage-ui/cypress/tests/bucket-management.cy.ts +++ b/packages/storage-ui/cypress/tests/bucket-management.cy.ts @@ -6,6 +6,7 @@ import { navigationMenu } from "../support/page-objects/navigationMenu" import { fileUploadModal } from "../support/page-objects/modals/fileUploadModal" import { deleteBucketModal } from "../support/page-objects/modals/deleteBucketModal" import { uploadCompleteToast } from "../support/page-objects/toasts/uploadCompleteToast" +import { FILE_SYSTEM_TYPES } from "../support/utils/TestConstants" describe("Bucket management", () => { @@ -103,5 +104,39 @@ describe("Bucket management", () => { bucketsPage.bucketItemRow().should("not.exist") bucketsPage.bucketItemName().should("not.exist") }) + + it("can sort by name or file system in buckets table", () => { + cy.web3Login({ deleteFpsBuckets: true }) + navigationMenu.bucketsNavButton().click() + + bucketsPage.createBucket(chainSafeBucketName, FILE_SYSTEM_TYPES.CHAINSAFE) + bucketsPage.bucketItemRow().should("have.length", 1) + bucketsPage.createBucket(ipfsBucketName, FILE_SYSTEM_TYPES.IPFS) + bucketsPage.bucketItemRow().should("have.length", 2) + + // by default should be sort by date uploading in ascending order (oldest first) + bucketsPage.bucketItemName().eq(0).should("have.text", chainSafeBucketName) + bucketsPage.bucketItemName().eq(1).should("have.text", ipfsBucketName) + + // ensure that sort by name in descending order (Z-A) + bucketsPage.nameTableHeader().click() + bucketsPage.bucketItemName().eq(0).should("have.text", ipfsBucketName) + bucketsPage.bucketItemName().eq(1).should("have.text", chainSafeBucketName) + + // ensure that sort by name in ascending order (A-Z) + bucketsPage.nameTableHeader().click() + bucketsPage.bucketItemName().eq(0).should("have.text", chainSafeBucketName) + bucketsPage.bucketItemName().eq(1).should("have.text", ipfsBucketName) + + // ensure that sort by file system in descending order (Z-A) + bucketsPage.fileSystemTableHeader().click() + bucketsPage.bucketItemName().eq(0).should("have.text", ipfsBucketName) + bucketsPage.bucketItemName().eq(1).should("have.text", chainSafeBucketName) + + // ensure that sort by file system in ascending order (A-Z) + bucketsPage.fileSystemTableHeader().click() + bucketsPage.bucketItemName().eq(0).should("have.text", chainSafeBucketName) + bucketsPage.bucketItemName().eq(1).should("have.text", ipfsBucketName) + }) }) }) From 4e145b03442a3fc69514e37029d7fe314a72f9ed Mon Sep 17 00:00:00 2001 From: Juan Manuel Spoleti Date: Wed, 29 Jun 2022 10:05:39 -0300 Subject: [PATCH 2/4] sort in cids table test --- .../cypress/support/page-objects/cidsPage.ts | 1 + .../cypress/tests/cid-management.cy.ts | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/packages/storage-ui/cypress/support/page-objects/cidsPage.ts b/packages/storage-ui/cypress/support/page-objects/cidsPage.ts index 3d17b8143b..040a26907f 100644 --- a/packages/storage-ui/cypress/support/page-objects/cidsPage.ts +++ b/packages/storage-ui/cypress/support/page-objects/cidsPage.ts @@ -13,6 +13,7 @@ export const cidsPage = { // cid browser row elements searchCidInput: () => cy.get("[data-testid=input-search-cid]"), + nameTableHeader: () => cy.get("[data-cy=table-header-name]"), cidTableHeader: () => cy.get("[data-cy=table-header-cid]"), createdTableHeader: () => cy.get("[data-cy=table-header-created]"), sizeTableHeader: () => cy.get("[data-cy=table-header-size]"), diff --git a/packages/storage-ui/cypress/tests/cid-management.cy.ts b/packages/storage-ui/cypress/tests/cid-management.cy.ts index 794f36c0cf..f121608dee 100644 --- a/packages/storage-ui/cypress/tests/cid-management.cy.ts +++ b/packages/storage-ui/cypress/tests/cid-management.cy.ts @@ -103,5 +103,35 @@ describe("CID management", () => { cidsPage.searchCidInput().clear() cidsPage.cidItemRow().should("have.length", 2) }) + + it("can sort by name or created at in cids table", () => { + cy.web3Login({ withNewSession: true }) + navigationMenu.cidsNavButton().click() + + const pin1 = "Pin 1" + const pin2 = "Pin 2" + cidsPage.addPinnedCid({ name: pin1 }) + cidsPage.addPinnedCid({ name: pin2, cid: testCidAlternative }) + cidsPage.cidItemRow().should("have.length", 2) + + // by default should be sort by date uploading in descending order (newest first) + cidsPage.cidNameCell().eq(0).should("have.text", pin2) + cidsPage.cidNameCell().eq(1).should("have.text", pin1) + + // ensure sort by created in descending order (oldest first) + cidsPage.createdTableHeader().click() + cidsPage.cidNameCell().eq(0).should("have.text", pin1) + cidsPage.cidNameCell().eq(1).should("have.text", pin2) + + // ensure sort by name in descending order (Z-A) + cidsPage.nameTableHeader().click() + cidsPage.cidNameCell().eq(0).should("have.text", pin2) + cidsPage.cidNameCell().eq(1).should("have.text", pin1) + + // ensure sort by name in ascending order (A-Z) + cidsPage.nameTableHeader().click() + cidsPage.cidNameCell().eq(0).should("have.text", pin1) + cidsPage.cidNameCell().eq(1).should("have.text", pin2) + }) }) }) \ No newline at end of file From b9c91057d7bdaf0800941a7e011e4b3566317fcd Mon Sep 17 00:00:00 2001 From: Juan Manuel Spoleti Date: Wed, 29 Jun 2022 10:06:11 -0300 Subject: [PATCH 3/4] Revert "sort Buckets table test" This reverts commit e5cfb6054b021ac602ccfc3aba8d7c86caddaec3. --- .../support/page-objects/bucketsPage.ts | 14 ++------ .../cypress/support/utils/TestConstants.ts | 4 --- .../cypress/tests/bucket-management.cy.ts | 35 ------------------- 3 files changed, 2 insertions(+), 51 deletions(-) delete mode 100644 packages/storage-ui/cypress/support/utils/TestConstants.ts diff --git a/packages/storage-ui/cypress/support/page-objects/bucketsPage.ts b/packages/storage-ui/cypress/support/page-objects/bucketsPage.ts index 048f9a4357..472f221c58 100644 --- a/packages/storage-ui/cypress/support/page-objects/bucketsPage.ts +++ b/packages/storage-ui/cypress/support/page-objects/bucketsPage.ts @@ -1,6 +1,5 @@ // Only add things here that could be applicable to the bucket page -import { FILE_SYSTEM_TYPES } from "../utils/TestConstants" import { basePage } from "./basePage" import { createBucketModal } from "./modals/createBucketModal" @@ -14,7 +13,6 @@ export const bucketsPage = { // bucket browser row elements bucketItemRow: () => cy.get("[data-cy=row-bucket-item]"), nameTableHeader: () => cy.get("[data-cy=table-header-name]"), - fileSystemTableHeader: () => cy.get("[data-cy=table-header-file-system]"), sizeTableHeader: () => cy.get("[data-cy=table-header-size]"), bucketItemName: () => cy.get("[data-cy=cell-bucket-name]"), bucketFileSystemType: () => cy.get("[data-cy=cell-file-system-type]"), @@ -24,19 +22,11 @@ export const bucketsPage = { deleteBucketMenuOption: () => cy.get("[data-cy=menu-delete-bucket]"), // helpers and convenience functions - createBucket(bucketName: string, bucketType: FILE_SYSTEM_TYPES) { + createBucket(bucketName: string) { this.createBucketButton().click() createBucketModal.body().should("be.visible") createBucketModal.bucketNameInput().type(bucketName) - switch (bucketType) { - case FILE_SYSTEM_TYPES.IPFS: - createBucketModal.ipfsRadioInput().click() - break - case FILE_SYSTEM_TYPES.CHAINSAFE: - createBucketModal.chainsafeRadioInput().click() - break - } - createBucketModal.submitButton().click() + createBucketModal.submitButton().safeClick() createBucketModal.body().should("not.exist") } } diff --git a/packages/storage-ui/cypress/support/utils/TestConstants.ts b/packages/storage-ui/cypress/support/utils/TestConstants.ts deleted file mode 100644 index 00f55cfab3..0000000000 --- a/packages/storage-ui/cypress/support/utils/TestConstants.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum FILE_SYSTEM_TYPES { - CHAINSAFE, - IPFS -} \ No newline at end of file diff --git a/packages/storage-ui/cypress/tests/bucket-management.cy.ts b/packages/storage-ui/cypress/tests/bucket-management.cy.ts index 4710d59ab7..8db8c31b34 100644 --- a/packages/storage-ui/cypress/tests/bucket-management.cy.ts +++ b/packages/storage-ui/cypress/tests/bucket-management.cy.ts @@ -6,7 +6,6 @@ import { navigationMenu } from "../support/page-objects/navigationMenu" import { fileUploadModal } from "../support/page-objects/modals/fileUploadModal" import { deleteBucketModal } from "../support/page-objects/modals/deleteBucketModal" import { uploadCompleteToast } from "../support/page-objects/toasts/uploadCompleteToast" -import { FILE_SYSTEM_TYPES } from "../support/utils/TestConstants" describe("Bucket management", () => { @@ -104,39 +103,5 @@ describe("Bucket management", () => { bucketsPage.bucketItemRow().should("not.exist") bucketsPage.bucketItemName().should("not.exist") }) - - it("can sort by name or file system in buckets table", () => { - cy.web3Login({ deleteFpsBuckets: true }) - navigationMenu.bucketsNavButton().click() - - bucketsPage.createBucket(chainSafeBucketName, FILE_SYSTEM_TYPES.CHAINSAFE) - bucketsPage.bucketItemRow().should("have.length", 1) - bucketsPage.createBucket(ipfsBucketName, FILE_SYSTEM_TYPES.IPFS) - bucketsPage.bucketItemRow().should("have.length", 2) - - // by default should be sort by date uploading in ascending order (oldest first) - bucketsPage.bucketItemName().eq(0).should("have.text", chainSafeBucketName) - bucketsPage.bucketItemName().eq(1).should("have.text", ipfsBucketName) - - // ensure that sort by name in descending order (Z-A) - bucketsPage.nameTableHeader().click() - bucketsPage.bucketItemName().eq(0).should("have.text", ipfsBucketName) - bucketsPage.bucketItemName().eq(1).should("have.text", chainSafeBucketName) - - // ensure that sort by name in ascending order (A-Z) - bucketsPage.nameTableHeader().click() - bucketsPage.bucketItemName().eq(0).should("have.text", chainSafeBucketName) - bucketsPage.bucketItemName().eq(1).should("have.text", ipfsBucketName) - - // ensure that sort by file system in descending order (Z-A) - bucketsPage.fileSystemTableHeader().click() - bucketsPage.bucketItemName().eq(0).should("have.text", ipfsBucketName) - bucketsPage.bucketItemName().eq(1).should("have.text", chainSafeBucketName) - - // ensure that sort by file system in ascending order (A-Z) - bucketsPage.fileSystemTableHeader().click() - bucketsPage.bucketItemName().eq(0).should("have.text", chainSafeBucketName) - bucketsPage.bucketItemName().eq(1).should("have.text", ipfsBucketName) - }) }) }) From 6f5a29b37f4a96e2423c21f7c9fac82ce6afc118 Mon Sep 17 00:00:00 2001 From: Juan Manuel Spoleti Date: Wed, 29 Jun 2022 13:42:25 -0300 Subject: [PATCH 4/4] variables and cy names improved in cids --- .../cypress/support/page-objects/cidsPage.ts | 10 +++++----- packages/storage-ui/cypress/tests/cid-management.cy.ts | 6 +++--- packages/storage-ui/src/Components/Pages/CidsPage.tsx | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/storage-ui/cypress/support/page-objects/cidsPage.ts b/packages/storage-ui/cypress/support/page-objects/cidsPage.ts index 040a26907f..b921632b54 100644 --- a/packages/storage-ui/cypress/support/page-objects/cidsPage.ts +++ b/packages/storage-ui/cypress/support/page-objects/cidsPage.ts @@ -13,11 +13,11 @@ export const cidsPage = { // cid browser row elements searchCidInput: () => cy.get("[data-testid=input-search-cid]"), - nameTableHeader: () => cy.get("[data-cy=table-header-name]"), - cidTableHeader: () => cy.get("[data-cy=table-header-cid]"), - createdTableHeader: () => cy.get("[data-cy=table-header-created]"), - sizeTableHeader: () => cy.get("[data-cy=table-header-size]"), - statusTableHeader: () => cy.get("[data-cy=table-header-status]"), + cidsTableHeaderName: () => cy.get("[data-cy=cids-table-header-name]"), + cidsTableHeaderCid: () => cy.get("[data-cy=cids-table-header-cid]"), + cidsTableHeaderCreated: () => cy.get("[data-cy=cids-table-header-created]"), + cidsTableHeaderSize: () => cy.get("[data-cy=cids-table-header-size]"), + cidsTableHeaderStatus: () => cy.get("[data-cy=cids-table-header-status]"), cidItemRow: () => cy.get("[data-cy=row-cid-item]", { timeout: 20000 }), cidNameCell: () => cy.get("[data-cy=cell-pin-name]"), cidCell: () => cy.get("[data-cy=cell-pin-cid]"), diff --git a/packages/storage-ui/cypress/tests/cid-management.cy.ts b/packages/storage-ui/cypress/tests/cid-management.cy.ts index f121608dee..c7080ff414 100644 --- a/packages/storage-ui/cypress/tests/cid-management.cy.ts +++ b/packages/storage-ui/cypress/tests/cid-management.cy.ts @@ -119,17 +119,17 @@ describe("CID management", () => { cidsPage.cidNameCell().eq(1).should("have.text", pin1) // ensure sort by created in descending order (oldest first) - cidsPage.createdTableHeader().click() + cidsPage.cidsTableHeaderCreated().click() cidsPage.cidNameCell().eq(0).should("have.text", pin1) cidsPage.cidNameCell().eq(1).should("have.text", pin2) // ensure sort by name in descending order (Z-A) - cidsPage.nameTableHeader().click() + cidsPage.cidsTableHeaderName().click() cidsPage.cidNameCell().eq(0).should("have.text", pin2) cidsPage.cidNameCell().eq(1).should("have.text", pin1) // ensure sort by name in ascending order (A-Z) - cidsPage.nameTableHeader().click() + cidsPage.cidsTableHeaderName().click() cidsPage.cidNameCell().eq(0).should("have.text", pin1) cidsPage.cidNameCell().eq(1).should("have.text", pin2) }) diff --git a/packages/storage-ui/src/Components/Pages/CidsPage.tsx b/packages/storage-ui/src/Components/Pages/CidsPage.tsx index e41df0ebe3..bd6ba5c990 100644 --- a/packages/storage-ui/src/Components/Pages/CidsPage.tsx +++ b/packages/storage-ui/src/Components/Pages/CidsPage.tsx @@ -216,7 +216,7 @@ const CidsPage = () => { className={classes.tableRow} > handleSortToggle("name")} @@ -226,7 +226,7 @@ const CidsPage = () => { Name @@ -234,7 +234,7 @@ const CidsPage = () => { {desktop && <> handleSortToggle("date_uploaded")} sortDirection={sortColumn === "date_uploaded" ? sortDirection : undefined} @@ -244,7 +244,7 @@ const CidsPage = () => { Created handleSortToggle("size")} sortDirection={sortColumn === "size" ? sortDirection : undefined} @@ -254,7 +254,7 @@ const CidsPage = () => { Size