Skip to content

Commit

Permalink
chore: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
slavastartsev committed Nov 21, 2024
1 parent a2d1216 commit 803674b
Show file tree
Hide file tree
Showing 7 changed files with 685 additions and 242 deletions.
27 changes: 22 additions & 5 deletions apps/e2e/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
node_modules/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
.cache-synpress

### Playwright

test-results
playwright-report
playwright/.cache

### Cypress
**/downloads

### Synpress

.cache-synpress

### Vercel

.vercel

### Cypress

**/ethereum-wallet-mock/cypress
**/metamask/cypress
18 changes: 9 additions & 9 deletions apps/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"synpress:run": "synpress run",
"build:cache": "synpress",
"build:cache:force": "synpress --force",
"build:cache:headless": "synpress --headless",
"build:cache:headless": "synpress --headless --force",
"serve:test-dapp": "serve node_modules/@metamask/test-dapp/dist -p 9999",
"test:playwright:headful": "playwright test",
"test:playwright:headless": "HEADLESS=true playwright test",
Expand All @@ -42,15 +42,15 @@
"lint:fix": "eslint . --ext ts,tsx --fix"
},
"dependencies": {
"@playwright/test": "^1.44.0",
"@synthetixio/synpress": "^4.0.0",
"@synthetixio/synpress-cache": "^0.0.4",
"dotenv": "^16.4.5"
"@playwright/test": "1.48.2",
"@synthetixio/synpress": "4.0.3",
"@synthetixio/synpress-cache": "0.0.4",
"dotenv": "16.4.5"
},
"devDependencies": {
"@metamask/test-dapp": "^8.13.0",
"@synthetixio/synpress-tsconfig": "^0.0.4",
"@types/node": "^22.9.0",
"serve": "^14.2.4"
"@metamask/test-dapp": "8.1.0",
"@synthetixio/synpress-tsconfig": "0.0.4",
"@types/node": "20.11.17",
"serve": "14.2.1"
}
}
27 changes: 27 additions & 0 deletions apps/e2e/src/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// ***********************************************************
// This example support/e2e.ts is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

import { synpressCommandsForMetaMask } from '@synthetixio/synpress/cypress/support';

Cypress.on('uncaught:exception', () => {
// failing the test
return false;
});

synpressCommandsForMetaMask();

before(() => {
cy.visit('/');
});
4 changes: 2 additions & 2 deletions apps/e2e/test/playwright/02_simple.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test('should confirm contract deployment', async ({ page, metamask, connectToAnv
await expect(page.locator('#tokenAddresses')).toHaveText('0x5FbDB2315678afecb367f032d93F642f64180aa3');
});

test('should confirm legacy transaction', async ({ page, metamask, connectToAnvil }) => {
test.skip('should confirm legacy transaction', async ({ page, metamask, connectToAnvil }) => {
// Connect to Anvil network
await connectToAnvil();

Expand All @@ -32,7 +32,7 @@ test('should confirm legacy transaction', async ({ page, metamask, connectToAnvi
await metamask.confirmTransaction();
});

test('should confirm EIP-1559 transaction', async ({ page, metamask, connectToAnvil }) => {
test.skip('should confirm EIP-1559 transaction', async ({ page, metamask, connectToAnvil }) => {
// Connect to Anvil network
await connectToAnvil();

Expand Down
10 changes: 5 additions & 5 deletions apps/e2e/test/playwright/add-network.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ const test = testWithSynpress(metaMaskFixtures(basicSetup));

const { expect } = test;

test('should add a custom network to MetaMask', async ({ metamask, page }) => {
test('should add BOB network to MetaMask', async ({ metamask, page }) => {
// Define the custom network parameters
const customNetwork = {
name: 'Optimism',
rpcUrl: 'https://mainnet.optimism.io',
name: 'BOB Mainnet',
rpcUrl: 'https://rpc.gobob.xyz/',
chainId: 10,
symbol: 'ETH'
};
Expand All @@ -20,6 +20,6 @@ test('should add a custom network to MetaMask', async ({ metamask, page }) => {
await metamask.addNetwork(customNetwork);

// Verify that the chain ID has been updated correctly
// Note: '0xa' is the hexadecimal representation of 10
await expect(page.locator('#chainId')).toHaveText('0xa');
// Note: '0xed88' is the hexadecimal representation of 60808
await expect(page.locator('#chainId')).toHaveText('0xed88');
});
2 changes: 1 addition & 1 deletion apps/e2e/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"types": ["cypress"],
"sourceMap": false
},
"include": ["test", "src"],
"include": ["playwright.config.ts", "test", "src"],
"files": ["environment.d.ts"]
}
Loading

0 comments on commit 803674b

Please sign in to comment.