Skip to content

Commit

Permalink
add synpress config
Browse files Browse the repository at this point in the history
  • Loading branch information
pivilartisant committed Nov 3, 2023
1 parent c27bc6c commit e348e6a
Show file tree
Hide file tree
Showing 11 changed files with 6,724 additions and 1,034 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dist
dist-ssr
*.local

cypress/videos
# Editor directories and files
.vscode/*
!.vscode/extensions.json
Expand Down
1 change: 1 addition & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { defineConfig } from 'cypress';
import getCompareSnapshotsPlugin from 'cypress-image-diff-js/dist/plugin';

export default defineConfig({
video: false,
env: {
browserPermissions: {
clipboard: 'allow',
Expand Down
28 changes: 28 additions & 0 deletions cypress/e2e/login.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
describe('Bridge | Connect | MestaMask', () => {
beforeEach(() => {
cy.visit('http://localhost:8080');
cy.changeMetamaskNetwork('sepolia');
});

it('should change connect to MM on sepolia network', () => {
cy.get('[data-testid="connect-wallet-button"]')
.contains('Connect wallets')
.click();
cy.get('[ data-testid="connect-metamask-button"]').click();
cy.get('div').contains('MetaMask').click();
cy.acceptMetamaskAccess().should('be.true');
cy.get('[data-testid="tag"]').contains('Connected');
});

// it('Connects with Metamask and switches the network automatically', () => {
// cy.visit('http://localhost:8080');
// cy.switchToCypressWindow();
// cy.get('[data-testid="connect-wallet-button"]')
// .contains('Connect wallets')
// .click();
// cy.get('[ data-testid="connect-metamask-button"]').click();
// cy.get('div').contains('MetaMask').click();
// cy.acceptMetamaskAccess().should('be.true');
// cy.allowMetamaskToSwitchNetwork().should('be.true');
// });
});
11 changes: 11 additions & 0 deletions cypress/plugins/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-disable import/no-extraneous-dependencies */
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import synpressPlugins from '@synthetixio/synpress/plugins';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const pluginsConfig = (on, config) => {
synpressPlugins(on, config);
};

export default pluginsConfig;
1 change: 1 addition & 0 deletions cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

// Import commands.js using ES2015 syntax:
import './commands';
import '@synthetixio/synpress/support';

// Alternatively you can use CommonJS syntax:
// require('./commands')
7,679 changes: 6,647 additions & 1,032 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,22 @@
"postcy:e2e-ci": "mv -n cypress-visual-report/cypress-visual-report.html cypress-visual-report/cypress-visual-report-e2e.html",
"cy:component": "cypress run --component --browser chrome",
"cy:component-ci": "export VITE_CI_TEST=true && cypress run --component --browser chrome",
"postcy:component-ci": "mv -n cypress-visual-report/cypress-visual-report.html cypress-visual-report/cypress-visual-report-component.html"
"postcy:component-ci": "mv -n cypress-visual-report/cypress-visual-report.html cypress-visual-report/cypress-visual-report-component.html",
"synpress": "env-cmd -f .env npx synpress run -cf synpress.config.ts supportFile='cypress/support/e2e.ts'"
},
"dependencies": {
"@massalabs/massa-web3": "^1.24.3-dev",
"@massalabs/react-ui-kit": "^0.0.4-dev",
"@massalabs/wallet-provider": "^1.4.1",
"@rainbow-me/rainbowkit": "^1.0.7",
"@synthetixio/synpress": "^3.7.2-beta.8",
"@tanstack/react-query": "^4.29.5",
"axios": "^1.4.0",
"big.js": "^6.2.1",
"currency.js": "^2.0.4",
"delay": "^6.0.0",
"dot-object": "^2.1.4",
"env-cmd": "^10.1.0",
"esbuild": "0.17.19",
"localforage": "^1.10.0",
"lottie-react": "^2.4.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export function CustomConnectButton(): JSX.Element {
if (!connected) {
return (
<Button
data-testid="connect-metamask-button"
variant="secondary"
customClass="h-14 pt-4"
onClick={openConnectModal}
Expand Down
1 change: 1 addition & 0 deletions src/layouts/LayoutBridge/LayoutBridge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export function LayoutBridge({ ...props }) {
disabled={isFetching}
customClass="h-[54px] relative"
onClick={() => setOpen(true)}
data-testid="connect-wallet-button"
>
{Intl.t('connect-wallet.title')}
{showPingAnimation && <PingAnimation />}
Expand Down
28 changes: 28 additions & 0 deletions synpress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import { defineConfig } from 'cypress';

import setupNodeEvents from './cypress/plugins';

export default defineConfig({
video: false,
userAgent: 'synpress',
retries: {
openMode: 0,
runMode: 0,
},
fixturesFolder: './cypress/fixtures',
screenshotsFolder: './cypress/screenshots',
chromeWebSecurity: true,
viewportWidth: 1920,
viewportHeight: 1080,
defaultCommandTimeout: 30000,
pageLoadTimeout: 30000,
requestTimeout: 30000,
projectId: 'massaBridge',
e2e: {
setupNodeEvents,
supportFile: './cypress/support/e2e.ts',
specPattern: './cypress/e2e/**/*.spec.ts',
},
});
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"@/*": ["./src/*"]
}
},
"include": ["src", "cypress"],
"include": ["src", "cypress", "synpress"],
"references": [{ "path": "./tsconfig.node.json" }]
}

0 comments on commit e348e6a

Please sign in to comment.