Skip to content

Commit

Permalink
add clipboard permission
Browse files Browse the repository at this point in the history
  • Loading branch information
mazmassa committed Oct 20, 2023
1 parent a328808 commit 53b5411
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 25 deletions.
6 changes: 5 additions & 1 deletion web-frontend/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ export default defineConfig({
return compareSnapshotsPlugin;
},
},

env: {
browserPermissions: {
clipboard: 'allow',
},
},
e2e: {
// macbook-15 default
viewportWidth: 1440,
Expand Down
37 changes: 13 additions & 24 deletions web-frontend/cypress/e2e/acceptance/home/send.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,29 +84,18 @@ describe('E2E | Acceptance | Home', () => {
cy.get('[data-testid="receive-coins"]').should('be.visible');
});

// it('should copy wallet address when clipboard field is clicked', () => {
// // we are adding the permission to chrome on the fly
// cy.wrap(
// Cypress.automation('remote:debugger:protocol', {
// command: 'Browser.grantPermissions',
// params: {
// permissions: ['clipboardReadWrite', 'clipboardSanitizedWrite'],
// origin: window.location.origin,
// },
// }),
// );

// const account = mockedAccounts.at(2);

// cy.visit('/');

// cy.get('[data-testid="account-2"]').click();
// cy.url().should('eq', `${baseUrl}/Mario/home`);

// compareSnapshot(cy, 'wallet-home');

// cy.get('[data-testid="clipboard-field"]').click();
// cy.assertValueCopiedFromClipboard(account.address);
// });
it('should copy wallet address when clipboard field is clicked', () => {
const account = mockedAccounts.at(2);

cy.visit('/');

cy.get('[data-testid="account-2"]').click();
cy.url().should('eq', `${baseUrl}/Mario/home`);

compareSnapshot(cy, 'wallet-home');

cy.get('[data-testid="clipboard-field"]').click();
cy.assertValueCopiedFromClipboard(account.address);
});
});
});
13 changes: 13 additions & 0 deletions web-frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions web-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"autoprefixer": "^10.4.14",
"babel-jest": "^29.5.0",
"cypress": "^13.3.1",
"cypress-browser-permissions": "^1.1.0",
"cypress-image-diff-js": "^1.31.0",
"eslint": "^8.38.0",
"eslint-plugin-html": "^7.1.0",
Expand Down

0 comments on commit 53b5411

Please sign in to comment.