-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(e2e): Update e2e tests for work with web-core (#614)
- Loading branch information
Showing
16 changed files
with
298 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,56 +5,91 @@ on: | |
branches: | ||
- development | ||
- main | ||
schedule: | ||
# At 9:00 on every day-of-week from Monday through Friday | ||
- cron: '0 9 * * 1-5' | ||
|
||
jobs: | ||
safe-apps-e2e: | ||
runs-on: ubuntu-20.04 | ||
# let's make sure our tests pass on Chrome browser | ||
name: E2E on Chrome | ||
e2e: | ||
runs-on: ubuntu-latest | ||
name: Execute E2E tests | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Cancel previous runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
- name: Checkout web-core | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: safe-global/web-core | ||
ref: main | ||
path: web-core | ||
|
||
- name: Yarn install web-core | ||
working-directory: web-core | ||
run: yarn install | ||
|
||
- name: Yarn cache web-core modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: 'web-core/**/node_modules' | ||
key: web-core-modules-${{ hashFiles('**/yarn.lock') }} | ||
|
||
- name: Build web-core | ||
working-directory: web-core | ||
run: yarn build && yarn export | ||
env: | ||
NEXT_PUBLIC_INFURA_TOKEN: ${{ secrets.CYPRESS_INFURA_TOKEN }} | ||
NEXT_PUBLIC_SAFE_APPS_INFURA_TOKEN: ${{ secrets.CYPRESS_INFURA_TOKEN }} | ||
NEXT_PUBLIC_TENDERLY_ORG_NAME: ${{ secrets.REACT_APP_TENDERLY_ORG_NAME }} | ||
NEXT_PUBLIC_TENDERLY_PROJECT_NAME: ${{ secrets.REACT_APP_TENDERLY_PROJECT_NAME }} | ||
NEXT_PUBLIC_TENDERLY_SIMULATE_ENDPOINT_URL: ${{ secrets.REACT_APP_TENDERLY_SIMULATE_ENDPOINT_URL }} | ||
NEXT_PUBLIC_CYPRESS_MNEMONIC: ${{ secrets.CYPRESS_MNEMONIC }} | ||
|
||
- name: Serve web-core | ||
working-directory: web-core | ||
run: | | ||
yarn serve & | ||
- name: Set PR Safe Apps base URL | ||
run: | | ||
echo "SAFE_APPS_BASE_URL=https://pr${{ github.event.number }}--safereactapps.review-react-hr.5afe.dev" >> $GITHUB_ENV | ||
echo "BASE_URL=https://safe-web.dev.5afe.dev/app" >> $GITHUB_ENV | ||
if: github.ref != 'refs/heads/development' | ||
|
||
- name: Set development Safe Apps base URL | ||
run: | | ||
echo "SAFE_APPS_BASE_URL=https://safe-apps.dev.5afe.dev" >> $GITHUB_ENV | ||
echo "BASE_URL=https://safe-web.dev.5afe.dev/app" >> $GITHUB_ENV | ||
if: github.ref == 'refs/heads/development' | ||
|
||
- name: Set main Safe Apps base URL | ||
run: | | ||
echo "SAFE_APPS_BASE_URL=https://apps.gnosis-safe.io" >> $GITHUB_ENV | ||
echo "BASE_URL=https://gnosis-safe.io/app" >> $GITHUB_ENV | ||
if: ${{ github.ref == 'refs/heads/main' || github.event.schedule == '0 9 * * 1-5' }} | ||
- uses: cypress-io/github-action@v2 | ||
|
||
- name: Checkout safe-react-apps | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: safe-global/safe-react-apps | ||
path: apps | ||
|
||
- name: Execute E2E tests | ||
uses: cypress-io/github-action@v5 | ||
with: | ||
browser: chrome | ||
record: true | ||
spec: cypress/integration/drain-account/drain.spec.js,cypress/integration/tx-builder/tx-builder.spec.js | ||
spec: cypress/e2e/drain-account/drain.spec.cy.js,cypress/e2e/tx-builder/tx-builder.spec.cy.js | ||
wait-on: 'http://localhost:8080' | ||
working-directory: apps | ||
env: | ||
CI: 'true' | ||
CYPRESS_WEB_BASE_URL: 'http://localhost:8080' | ||
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | ||
CYPRESS_BASE_URL: ${{env.BASE_URL}} | ||
CYPRESS_SAFE_APPS_BASE_URL: ${{env.SAFE_APPS_BASE_URL}} | ||
CYPRESS_CHAIN_ID: '4' | ||
CYPRESS_NETWORK_PREFIX: 'rin' | ||
CYPRESS_TESTING_SAFE_ADDRESS: '0x3bc83f41490BfD25bBB44eBCAc3761DFF4Ae50DA' | ||
CYPRESS_CHAIN_ID: '5' | ||
CYPRESS_NETWORK_PREFIX: 'gor' | ||
CYPRESS_TESTING_SAFE_ADDRESS: '0x168ca275d1103cb0a30980813140053c7566932F' | ||
CYPRESS_CLIENT_GATEWAY_BASE_URL: 'https://safe-client.safe.global' | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
continue-on-error: true | ||
- uses: actions/upload-artifact@v2 | ||
if: always() | ||
with: | ||
name: cypress-screenshots | ||
path: cypress/screenshots | ||
- uses: actions/upload-artifact@v2 | ||
if: always() | ||
with: | ||
name: cypress-videos | ||
path: cypress/videos | ||
CYPRESS_DRAIN_SAFE_URL: ${{ env.SAFE_APPS_BASE_URL }}/drain-safe | ||
CYPRESS_TX_BUILDER_URL: ${{ env.SAFE_APPS_BASE_URL }}/tx-builder | ||
continue-on-error: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { defineConfig } from 'cypress' | ||
|
||
const axios = require('axios') | ||
const { sendSlackMessage } = require('./cypress/lib/slack') | ||
|
||
require('dotenv').config() | ||
|
||
export default defineConfig({ | ||
projectId: 'okn21k', | ||
chromeWebSecurity: false, | ||
modifyObstructiveCode: false, | ||
video: true, | ||
retries: { | ||
runMode: 2, | ||
openMode: 0, | ||
}, | ||
env: { | ||
SAFE_APPS_BASE_URL: process.env.CYPRESS_SAFE_APPS_BASE_URL, | ||
CHAIN_ID: process.env.CYPRESS_CHAIN_ID, | ||
NETWORK_PREFIX: process.env.CYPRESS_NETWORK_PREFIX, | ||
TESTING_SAFE_ADDRESS: process.env.CYPRESS_TESTING_SAFE_ADDRESS, | ||
DRAIN_SAFE_URL: process.env.CYPRESS_DRAIN_SAFE_URL, | ||
TX_BUILDER_URL: process.env.CYPRESS_TX_BUILDER_URL, | ||
}, | ||
e2e: { | ||
baseUrl: process.env.CYPRESS_WEB_BASE_URL, | ||
async setupNodeEvents(on, config) { | ||
on('after:run', sendSlackMessage) | ||
on('task', { | ||
log(message) { | ||
console.log(message) | ||
return null | ||
}, | ||
}) | ||
|
||
let safeAppsList | ||
|
||
try { | ||
safeAppsList = await axios.get( | ||
`${process.env.CYPRESS_CLIENT_GATEWAY_BASE_URL}/v1/chains/${ | ||
process.env.CYPRESS_CHAIN_ID | ||
}/safe-apps?client_url=${encodeURIComponent(process.env.CYPRESS_WEB_BASE_URL)}`, | ||
) | ||
} catch (e) { | ||
console.log('Unable to fetch the default list: ', e) | ||
} | ||
|
||
config.env.SAFE_APPS_LIST = safeAppsList.data | ||
|
||
return config | ||
}, | ||
}, | ||
}) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.