Skip to content

Commit

Permalink
Merge pull request #220 from Synthetixio/dev
Browse files Browse the repository at this point in the history
promote dev to master
  • Loading branch information
drptbl authored Sep 19, 2021
2 parents 1125bf8 + e4d7d76 commit 992edd4
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/audit_and_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
- name: Upload lint results
# run if lint failed and only on master/dev branch and pull requests
if: always() && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || github.event_name == 'pull_request')
uses: github/codeql-action/upload-sarif@89d78ba4572c7854683ec144d212bf0b52cd2a2a # pin@codeql-bundle-20210517
uses: github/codeql-action/upload-sarif@4854dd23d5f2aada3f026670784d5109e7702ea9 # pin@codeql-bundle-20210517
with:
sarif_file: lint-results.sarif
continue-on-error: true
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # pin@v2

- name: Initialize CodeQL
uses: github/codeql-action/init@89d78ba4572c7854683ec144d212bf0b52cd2a2a
uses: github/codeql-action/init@4854dd23d5f2aada3f026670784d5109e7702ea9
with:
queries: security-and-quality
languages: javascript

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@89d78ba4572c7854683ec144d212bf0b52cd2a2a
uses: github/codeql-action/analyze@4854dd23d5f2aada3f026670784d5109e7702ea9
19 changes: 19 additions & 0 deletions commands/metamask.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const {
notificationPageElements,
permissionsPageElements,
confirmPageElements,
signaturePageElements,
} = require('../pages/metamask/notification-page');
const {
settingsPageElements,
Expand Down Expand Up @@ -290,6 +291,24 @@ module.exports = {
await puppeteer.waitFor(mainPageElements.walletOverview);
return true;
},
confirmSignatureRequest: async () => {
const notificationPage = await puppeteer.switchToMetamaskNotification();
await puppeteer.waitAndClick(
signaturePageElements.confirmSignatureRequestButton,
notificationPage,
);
await puppeteer.metamaskWindow().waitForTimeout(3000);
return true;
},
rejectSignatureRequest: async () => {
const notificationPage = await puppeteer.switchToMetamaskNotification();
await puppeteer.waitAndClick(
signaturePageElements.rejectSignatureRequestButton,
notificationPage,
);
await puppeteer.metamaskWindow().waitForTimeout(3000);
return true;
},
confirmPermissionToSpend: async () => {
const notificationPage = await puppeteer.switchToMetamaskNotification();
await puppeteer.waitAndClick(
Expand Down
87 changes: 37 additions & 50 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"bytes32": "0.0.3",
"commander": "8.1.0",
"cross-zip": "4.0.0",
"cypress": "8.3.1",
"cypress": "8.4.0",
"cypress-wait-until": "1.7.1",
"eslint": "7.32.0",
"eslint-config-prettier": "8.3.0",
Expand All @@ -79,7 +79,7 @@
"puppeteer-core": "10.2.0",
"serve": "12.0.0",
"start-server-and-test": "1.13.1",
"synthetix-js": "2.46.0"
"synthetix-js": "2.48.0"
},
"devDependencies": {
"@microsoft/eslint-formatter-sarif": "2.1.5",
Expand Down
7 changes: 7 additions & 0 deletions pages/metamask/notification-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ module.exports.notificationPageElements = {
rejectToSpendButton,
};

const confirmSignatureRequestButton = `${notificationPage} .request-signature__footer__sign-button`;
const rejectSignatureRequestButton = `${notificationPage} .request-signature__footer__cancel-button`;
module.exports.signaturePageElements = {
confirmSignatureRequestButton,
rejectSignatureRequestButton,
};

const permissionsPage = '.permissions-connect';
const connectButton = `${permissionsPage} .permission-approval-container__footers button:nth-child(2)`;
module.exports.permissionsPageElements = {
Expand Down
8 changes: 8 additions & 0 deletions plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ module.exports = (on, config) => {
const disconnected = await metamask.disconnectWalletFromAllDapps();
return disconnected;
},
confirmMetamaskSignatureRequest: async () => {
const confirmed = await metamask.confirmSignatureRequest();
return confirmed;
},
rejectMetamaskSignatureRequest: async () => {
const rejected = await metamask.rejectSignatureRequest();
return rejected;
},
confirmMetamaskPermissionToSpend: async () => {
const confirmed = await metamask.confirmPermissionToSpend();
return confirmed;
Expand Down
8 changes: 8 additions & 0 deletions support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ Cypress.Commands.add('disconnectMetamaskWalletFromAllDapps', () => {
return cy.task('disconnectMetamaskWalletFromAllDapps');
});

Cypress.Commands.add('confirmMetamaskSignatureRequest', () => {
return cy.task('confirmMetamaskSignatureRequest');
});

Cypress.Commands.add('rejectMetamaskSignatureRequest', () => {
return cy.task('rejectMetamaskSignatureRequest');
});

Cypress.Commands.add('confirmMetamaskPermissionToSpend', () => {
return cy.task('confirmMetamaskPermissionToSpend');
});
Expand Down
12 changes: 12 additions & 0 deletions support/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,18 @@ declare namespace Cypress {
* cy.disconnectMetamaskWalletFromAllDapps()
*/
disconnectMetamaskWalletFromAllDapps(): Chainable<Subject>;
/**
* Confirm metamask permission to sign message
* @example
* cy.confirmMetamaskSignatureRequest()
*/
confirmMetamaskSignatureRequest(): Chainable<Subject>;
/**
* Reject metamask permission to sign message
* @example
* cy.rejectMetamaskSignatureRequest()
*/
rejectMetamaskSignatureRequest(): Chainable<Subject>;
/**
* Confirm metamask permission to spend asset
* @example
Expand Down

0 comments on commit 992edd4

Please sign in to comment.