This file contains hidden or 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
| import random | |
| import string | |
| import aws_cdk as cdk | |
| import aws_cdk.aws_ec2 as ec2 | |
| import aws_cdk.aws_iam as iam | |
| import aws_cdk.aws_kinesis as kinesis | |
| import aws_cdk.aws_kinesisfirehose as firehose | |
| import aws_cdk.aws_logs as logs | |
| import aws_cdk.aws_redshift as redshift |
This file contains hidden or 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
| Cypress.Commands.add("disconnectAllAccountsFromAllDapps", () => { | |
| cy.visit(`/`); | |
| cy.get("[data-cy=metamaskButton]").then(($btn) => { | |
| if ($btn.text() !== "Connect Wallet") { | |
| cy.switchToAccount(1); | |
| cy.disconnectMetamaskWalletFromDapp().should("be.true"); | |
| cy.switchMetamaskAccount(2).should("be.true"); | |
| cy.disconnectMetamaskWalletFromDapp().should("be.true"); | |
| cy.switchMetamaskAccount(3).should("be.true"); | |
| cy.disconnectMetamaskWalletFromDapp().should("be.true"); |
This file contains hidden or 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
| const publicKeys = { | |
| // admin | |
| [1]: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", | |
| // user | |
| [2]: "0x70997970C51812dc3A010C7d01b50e0d17dc79C8", | |
| [3]: "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC", | |
| }; | |
| Cypress.Commands.add( | |
| "switchToAccount", |
This file contains hidden or 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
| import "@testing-library/cypress/add-commands"; | |
| Cypress.Commands.add("login", () => { | |
| cy.visit(`/`); | |
| cy.findByRole("button", { | |
| name: "Connect Wallet", | |
| }) | |
| .click() | |
| .then(() => { | |
| cy.acceptMetamaskAccess().should("be.true"); |
This file contains hidden or 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
| /** | |
| * Confirm metamask request for public encryption key | |
| * @example | |
| * cy.confirmMetamaskEncryptionPublicKeyRequest() | |
| */ | |
| confirmMetamaskEncryptionPublicKeyRequest(): Chainable<Subject>; | |
| /** | |
| * Reject metamask request for public encryption key | |
| * @example | |
| * cy.rejectMetamaskEncryptionPublicKeyRequest() |
This file contains hidden or 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
| confirmMetamaskEncryptionPublicKeyRequest: async () => { | |
| const confirmed = await metamask.confirmEncryptionPublicKeyRequest(); | |
| return confirmed; | |
| }, | |
| rejectMetamaskEncryptionPublicKeyRequest: async () => { | |
| const rejected = await metamask.rejectEncryptionPublicKeyRequest(); | |
| return rejected; | |
| }, |
This file contains hidden or 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
| Cypress.Commands.add('confirmMetamaskEncryptionPublicKeyRequest', () => { | |
| return cy.task('confirmMetamaskEncryptionPublicKeyRequest'); | |
| }); | |
| Cypress.Commands.add('rejectMetamaskEncryptionPublicKeyRequest', () => { | |
| return cy.task('rejectMetamaskEncryptionPublicKeyRequest'); | |
| }); |
This file contains hidden or 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
| const { | |
| encryptionPublicKeyPageElements, | |
| } = require('../pages/metamask/notification-page'); | |
| confirmEncryptionPublicKeyRequest: async () => { | |
| const notificationPage = await puppeteer.switchToMetamaskNotification(); | |
| await puppeteer.waitAndClick( | |
| encryptionPublicKeyPageElements.confirmEncryptionPublicKeyButton, | |
| notificationPage, | |
| ); |
This file contains hidden or 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
| const confirmEncryptionPublicKeyButton = `${notificationPage} .request-encryption-public-key__footer__sign-button`; | |
| const rejectEncryptionPublicKeyButton = `${notificationPage} .request-encryption-public-key__footer__cancel-button`; | |
| module.exports.encryptionPublicKeyPageElements = { | |
| confirmEncryptionPublicKeyButton, | |
| rejectEncryptionPublicKeyButton, | |
| }; |
This file contains hidden or 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
| describe("Decrypt message", () => { | |
| before(() => { | |
| cy.login(); | |
| cy.switchToAccountOne(); | |
| cy.visit(`${Cypress.config().baseUrl}/redeem/12`); | |
| }); | |
| it("Should decrypt public key", () => { | |
| cy.findByRole("button", { name: /redeem via metamask/i }).click(); | |
| cy.confirmMetamaskDecryptionRequest().then((accepted) => { | |
| expect(accepted).to.be.true; |
NewerOlder