-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Storage] Add and delete a storage api key test (#2240)
* add and delete a storage api key test * fix navigate to api keys page in mobile context * Update packages/storage-ui/cypress/support/page-objects/apiKeysPage.ts Co-authored-by: Andrew Snaith <[email protected]> * Update packages/storage-ui/src/Components/Modules/ApiKeys.tsx Co-authored-by: Andrew Snaith <[email protected]> * fix sort bucket test Co-authored-by: Michael Yankelev <[email protected]> Co-authored-by: Andrew Snaith <[email protected]>
- Loading branch information
1 parent
3a13489
commit dbb3031
Showing
10 changed files
with
129 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/storage-ui/cypress/support/page-objects/apiKeysPage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Only add things here that could be applicable to the api keys page | ||
|
||
import { basePage } from "./basePage" | ||
|
||
export const apiKeysPage = { | ||
...basePage, | ||
|
||
// main api keys elements | ||
apiKeysHeaderLabel: () => cy.get("[data-cy=header-api-keys]", { timeout: 20000 }), | ||
addApiKeyButton: () => cy.get("[data-cy=button-add-api-key]"), | ||
addS3KeyButton: () => cy.get("[data-cy=button-add-s3-key]"), | ||
|
||
// api keys table row elements | ||
apiKeyIdCell: () => cy.get("[data-cy=cell-api-keys-id]"), | ||
apiKeyTypeCell: () => cy.get("[data-cy=cell-api-keys-type]"), | ||
apiKeyStatusCell: () => cy.get("[data-cy=cell-api-keys-status]"), | ||
apiKeyRowKebabButton: () => cy.get("[data-testid=dropdown-title-api-keys-kebab]"), | ||
|
||
// kebab menu elements | ||
deleteMenuOption: () => cy.get("[data-cy=menu-delete]") | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/storage-ui/cypress/support/page-objects/modals/newKeyModal.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const newKeyModal = { | ||
keyIdLabel: () => cy.get("[data-cy=label-new-key-modal-key-id]"), | ||
secretLabel: () => cy.get("[data-cy=label-new-key-modal-secret]"), | ||
closeButton: () => cy.get("[data-cy=button-new-key-modal-close]") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
packages/storage-ui/cypress/tests/api-keys-management.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { navigationMenu } from "../support/page-objects/navigationMenu" | ||
import { apiKeysPage } from "../support/page-objects/apiKeysPage" | ||
import { newKeyModal } from "../support/page-objects/modals/newKeyModal" | ||
|
||
describe("Main Navigation", () => { | ||
|
||
context("desktop", () => { | ||
beforeEach(() => { | ||
cy.web3Login({ deleteApiKeys: true }) | ||
}) | ||
|
||
it("can add and delete a storage api key", () => { | ||
// go to api keys section | ||
navigationMenu.apiKeysNavButton().click() | ||
|
||
// add new storage api key | ||
apiKeysPage.addApiKeyButton().click() | ||
newKeyModal.secretLabel().should("be.visible") | ||
newKeyModal.keyIdLabel().invoke("text").as("keyId") | ||
newKeyModal.closeButton().click() | ||
|
||
// ensure new key modal is closed and api key button is not enabled | ||
newKeyModal.secretLabel().should("not.exist") | ||
apiKeysPage.addApiKeyButton().should("not.be.enabled") | ||
|
||
// ensure key id and status are correct in the table | ||
cy.get<string>("@keyId").then((keyId) => { | ||
apiKeysPage.apiKeyIdCell().should("have.text", keyId) | ||
}) | ||
apiKeysPage.apiKeyTypeCell().should("have.text", "storage") | ||
|
||
// delete api key | ||
apiKeysPage.apiKeyRowKebabButton().click() | ||
apiKeysPage.deleteMenuOption().click() | ||
apiKeysPage.apiKeyIdCell().should("not.exist") | ||
}) | ||
}) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters