Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

promote dev to master #839

Merged
merged 24 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
14c8e66
Bump github/codeql-action from 2.21.2 to 2.21.4
dependabot[bot] Aug 14, 2023
8e39d22
Bump actions/setup-node from 3.7.0 to 3.8.0
dependabot[bot] Aug 14, 2023
9e661e1
Bump cypress-io/github-action from 5.8.3 to 5.8.4
dependabot[bot] Aug 16, 2023
f506616
Add `.idea` to `.gitignore`
duckception Aug 16, 2023
b5485f3
Unskip tests for `*MetamaskToAddNetwork` and `*MetamaskToSwitchNetwork`
duckception Aug 16, 2023
17e49cf
Update container names
duckception Aug 16, 2023
04b1336
Add nginx for localhost redirections
duckception Aug 16, 2023
a923544
Remove conditional rpc url in test
duckception Aug 17, 2023
774ce54
Merge pull request #835 from Synthetixio/duckception/unskip-metamask-…
drptbl Aug 17, 2023
174f9fb
Merge pull request #833 from Synthetixio/dependabot/github_actions/cy…
drptbl Aug 17, 2023
d0af16e
Merge pull request #830 from Synthetixio/dependabot/github_actions/ac…
drptbl Aug 17, 2023
6a4979f
Merge pull request #829 from Synthetixio/dependabot/github_actions/gi…
drptbl Aug 17, 2023
54c5bd2
fix: failures on uncaught exception (should use Cypress.env, not proc…
YakovL Aug 17, 2023
ba98f3b
Merge branch 'dev' into uncaught-exceptions-handling
YakovL Aug 17, 2023
3d695f8
Merge pull request #837 from YakovL/uncaught-exceptions-handling
r3kt-eth Aug 17, 2023
92e465b
add resetstate to playwright
r3kt-eth Aug 17, 2023
cf745d9
add resetstate to helpers
r3kt-eth Aug 17, 2023
a6417c3
add resetstate to metamask
r3kt-eth Aug 17, 2023
13ae8ae
expose general resetstate to synpress
r3kt-eth Aug 17, 2023
983b806
Merge pull request #838 from Synthetixio/add-reset-state
r3kt-eth Aug 17, 2023
c647744
deps update
r3kt-eth Aug 17, 2023
6b9a9bc
Merge branch 'master' into dev
r3kt-eth Aug 17, 2023
ea14705
fix lint
r3kt-eth Aug 17, 2023
fe02c5d
fix lint
r3kt-eth Aug 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # pin@v2

- name: Initialize CodeQL
uses: github/codeql-action/init@0ba4244466797eb048eb91a6cd43d5c03ca8bd05
uses: github/codeql-action/init@a09933a12a80f87b87005513f0abb1494c27a716
with:
queries: security-and-quality
languages: javascript

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@0ba4244466797eb048eb91a6cd43d5c03ca8bd05
uses: github/codeql-action/analyze@a09933a12a80f87b87005513f0abb1494c27a716
4 changes: 2 additions & 2 deletions .github/workflows/e2e_cypress-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # pin@v2.4.0

- name: Setup node
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # pin@v3.7.0
uses: actions/setup-node@bea5baf987ba7aa777a8a0b4ace377a21c45c381 # pin@v3.8.0
with:
node-version: 18.16

Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
DISPLAY: :0.0

- name: Run e2e tests (cypress-action)
uses: cypress-io/github-action@d69252d52b9a31bad4f418f05ba2bc83687a02eb # pin@v5.8.3
uses: cypress-io/github-action@248bde77443c376edc45906ede03a1aba9da0462 # pin@v5.8.4
with:
start: pnpm start:server
command: pnpm test:e2e:ci:cypress-action
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e_debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # pin@v2.4.0

- name: Setup node
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # pin@v3.7.0
uses: actions/setup-node@bea5baf987ba7aa777a8a0b4ace377a21c45c381 # pin@v3.8.0
with:
node-version: 18.16

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e_headful.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # pin@v2.4.0

- name: Setup node
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # pin@v3.7.0
uses: actions/setup-node@bea5baf987ba7aa777a8a0b4ace377a21c45c381 # pin@v3.8.0
with:
node-version: 18.16

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ node_modules
.turbo
.pnpm-store
.DS_Store
.idea

downloads
lint-results.sarif
Expand Down
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ FROM --platform=linux/amd64 synthetixio/docker-e2e:18.16-ubuntu as base
RUN mkdir /app
WORKDIR /app

RUN apt update && apt install -y nginx

COPY nginx.conf /etc/nginx/sites-available/default

COPY package.json ./
COPY pnpm-lock.yaml ./

Expand Down
15 changes: 15 additions & 0 deletions commands/metamask.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,21 @@ let walletAddress;
let switchBackToCypressWindow;

const metamask = {
async resetState() {
log('Resetting state of metamask');
extensionId = undefined;
extensionVersion = undefined;
extensionHomeUrl = undefined;
extensionSettingsUrl = undefined;
extensionAdvancedSettingsUrl = undefined;
extensionExperimentalSettingsUrl = undefined;
extensionAddNetworkUrl = undefined;
extensionNewAccountUrl = undefined;
extensionImportAccountUrl = undefined;
extensionImportTokenUrl = undefined;
walletAddress = undefined;
switchBackToCypressWindow = undefined;
},
extensionId: () => {
return extensionId;
},
Expand Down
12 changes: 12 additions & 0 deletions commands/playwright.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ let retries = 0;
let extensionsData = {};

module.exports = {
async resetState() {
log('Resetting state of playwright');
expectInstance = undefined;
browser = undefined;
mainWindow = undefined;
metamaskWindow = undefined;
metamaskNotificationWindow = undefined;
metamaskPopupWindow = undefined;
activeTabName = undefined;
retries = 0;
extensionsData = {};
},
getExpectInstance() {
return expectInstance;
},
Expand Down
13 changes: 13 additions & 0 deletions commands/synpress.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const log = require('debug')('synpress:synpress');
const playwright = require('./playwright');
const metamask = require('./metamask');
const helpers = require('../helpers');

module.exports = {
async resetState() {
log('Resetting state of synpress');
await playwright.resetState();
await metamask.resetState();
await helpers.resetState();
},
};
16 changes: 15 additions & 1 deletion docker-compose.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ services:
- ./docker/videos:/app/tests/e2e/videos
- ./docker/screenshots:/app/tests/e2e/screenshots
command: >
bash -c 'echo -n "======> local noVNC URL: http://localhost:8080/vnc.html?autoconnect=true " && pnpm wait-on http://display:8080 && echo -n "======> remote noVNC URL: " && curl -s ngrok:4040/api/tunnels | jq -r .tunnels[0].public_url && pnpm test:e2e:ci:anvil'
bash -c 'echo -n "======> local noVNC URL: http://localhost:8080/vnc.html?autoconnect=true " && pnpm wait-on http://display:8080 && echo -n "======> remote noVNC URL: " && curl -s ngrok:4040/api/tunnels | jq -r .tunnels[0].public_url && nginx && pnpm test:e2e:ci:anvil'
networks:
- x11

Expand Down Expand Up @@ -113,5 +113,19 @@ services:
networks:
- x11

foundry-metamask-test-dapp:
profiles:
- foundry
container_name: foundry-metamask-test-dapp
image: synthetixio/foundry:457bb48776c3b14de232d9dda620ba9188dc40ac-base
# Port and chain id as required by the MetaMask Test Dapp
command: [ 'anvil --no-cors --port 8546 --chain-id 1338' ]
environment:
- ANVIL_IP_ADDR=0.0.0.0
ports:
- '8546:8546'
networks:
- x11

networks:
x11:
16 changes: 15 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
- ./docker/videos:/app/tests/e2e/videos
- ./docker/screenshots:/app/tests/e2e/screenshots
command: >
bash -c 'echo -n "======> local noVNC URL: http://localhost:8080/vnc.html?autoconnect=true " && pnpm wait-on http://display:8080 && echo -n "======> remote noVNC URL: " && curl -s ngrok:4040/api/tunnels | jq -r .tunnels[0].public_url && pnpm test:e2e:anvil'
bash -c 'echo -n "======> local noVNC URL: http://localhost:8080/vnc.html?autoconnect=true " && pnpm wait-on http://display:8080 && echo -n "======> remote noVNC URL: " && curl -s ngrok:4040/api/tunnels | jq -r .tunnels[0].public_url && nginx && pnpm test:e2e:anvil'
networks:
- x11

Expand Down Expand Up @@ -84,5 +84,19 @@ services:
networks:
- x11

foundry-metamask-test-dapp:
profiles:
- foundry
container_name: foundry-metamask-test-dapp
image: synthetixio/foundry:457bb48776c3b14de232d9dda620ba9188dc40ac-base
# Port and chain id as required by the MetaMask Test Dapp
command: [ 'anvil --no-cors --port 8546 --chain-id 1338' ]
environment:
- ANVIL_IP_ADDR=0.0.0.0
ports:
- '8546:8546'
networks:
- x11

networks:
x11:
10 changes: 7 additions & 3 deletions helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ let currentNetwork = chains.mainnet;
let addedNetworks = [chains.mainnet, chains.goerli, chains.sepolia];

module.exports = {
async resetState() {
log('Resetting state of helpers');
currentNetwork = chains.mainnet;
addedNetworks = [chains.mainnet, chains.goerli, chains.sepolia];
},
// set currently active network
async setNetwork(network) {
log(`Setting network to ${JSON.stringify(network)}`);
Expand Down Expand Up @@ -233,9 +238,8 @@ module.exports = {

await module.exports.createDirIfNotExist(downloadsDirectory);
const metamaskDirectory = path.join(downloadsDirectory, release.tagName);
const metamaskDirectoryExists = await module.exports.checkDirOrFileExist(
metamaskDirectory,
);
const metamaskDirectoryExists =
await module.exports.checkDirOrFileExist(metamaskDirectory);
const metamaskManifestFilePath = path.join(
downloadsDirectory,
release.tagName,
Expand Down
25 changes: 25 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
server {
listen 8545;
server_name localhost;

location / {
proxy_pass http://foundry:8545;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}

server {
listen 8546;
server_name localhost;

location / {
proxy_pass http://foundry-metamask-test-dapp:8546;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@
},
"dependencies": {
"@cypress/code-coverage": "^3.11.0",
"@cypress/webpack-dev-server": "^3.5.1",
"@cypress/webpack-dev-server": "^3.5.2",
"@drptbl/gremlins.js": "^2.2.1",
"@foundry-rs/easy-foundryup": "^0.1.3",
"@playwright/test": "^1.36.2",
"@playwright/test": "^1.37.0",
"@testing-library/cypress": "^9.0.0",
"@testing-library/react": "^14.0.0",
"@types/testing-library__cypress": "^5.0.9",
Expand All @@ -69,41 +69,41 @@
"babel-plugin-transform-react-styled-components-qa": "^2.1.0",
"bytes32": "^0.0.3",
"commander": "^11.0.0",
"cypress": "^12.17.3",
"cypress-wait-until": "^2.0.0",
"cypress": "^12.17.4",
"cypress-wait-until": "^2.0.1",
"debug": "^4.3.4",
"dotenv": "^16.3.1",
"dotenv-parse-variables": "^2.0.0",
"download": "^8.0.0",
"ethers": "^6.6.7",
"ethers": "^6.7.1",
"etherscan-api": "^10.3.0",
"find-config": "^1.0.0",
"get-port": "^7.0.0",
"node-fetch": "^2.6.1",
"underscore": "^1.13.6",
"viem": "^1.5.0",
"viem": "^1.6.0",
"wait-on": "^7.0.1"
},
"devDependencies": {
"@metamask/test-dapp": "^7.0.1",
"@microsoft/eslint-formatter-sarif": "^3.0.0",
"eslint": "^8.46.0",
"eslint-config-prettier": "^8.9.0",
"eslint": "^8.47.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-standard": "^17.1.0",
"eslint-config-turbo": "^1.10.12",
"eslint-plugin-chai-friendly": "^0.7.2",
"eslint-plugin-cypress": "^2.13.3",
"eslint-plugin-cypress": "^2.14.0",
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-standard": "^4.1.0",
"eslint-plugin-testing-library": "^5.11.0",
"eslint-plugin-testing-library": "^6.0.0",
"eslint-plugin-ui-testing": "^2.0.1",
"eslint-plugin-unicorn": "^48.0.1",
"npm-check-updates": "^16.10.17",
"prettier": "^3.0.0",
"release-it": "^16.1.3",
"npm-check-updates": "^16.12.2",
"prettier": "^3.0.2",
"release-it": "^16.1.5",
"serve": "^14.2.0",
"start-server-and-test": "^2.0.0",
"turbo": "^1.10.12"
Expand Down
5 changes: 2 additions & 3 deletions plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,8 @@ module.exports = (on, config) => {
return activated;
},
activateImprovedTokenAllowanceInMetamask: async skipSetup => {
const activated = await metamask.activateImprovedTokenAllowance(
skipSetup,
);
const activated =
await metamask.activateImprovedTokenAllowance(skipSetup);
return activated;
},
resetMetamaskAccount: async () => {
Expand Down
Loading