Skip to content

Commit

Permalink
Merge pull request #37 from multiversx/th/update/e2e
Browse files Browse the repository at this point in the history
action update
  • Loading branch information
tudorgabriel authored Dec 19, 2023
2 parents e2b1818 + ea95263 commit a403988
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 6 deletions.
27 changes: 23 additions & 4 deletions .github/workflows/pre-merge-main-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@ name: Cypress Tests
on:
pull_request:
branches: [main]

jobs:
Slack-Notification:
runs-on: ubuntu-latest
steps:
- name: Slack Notification
uses: rtCamp/action-slack-notify@master
if: always()
env:
SLACK_ICON_EMOJI: ':robot_face:'
SLACK_USERNAME: Cypress Bot
SLACK_MESSAGE: E2E tests are now running. Stay tuned for updates!
SLACK_TITLE: 'Cypress'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

cypress-run:
runs-on: ubuntu-latest
strategy:
fail-fast: false # https://github.com/cypress-io/github-action/issues/48
matrix:
containers: [1]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -38,3 +48,12 @@ jobs:
run: aws s3 cp s3://${{ secrets.AWS_S3_BUCKET_INTEGRATION }}/index.html s3://${{ secrets.AWS_S3_BUCKET_INTEGRATION }}/index.html --metadata-directive REPLACE --cache-control max-age=0,no-cache,no-store,must-revalidate --content-type text/html --acl public-read
- name: Cypress run
uses: cypress-io/github-action@v4
- name: Uploading artifact
uses: actions/upload-artifact@v2
if: always()
with:
name: cypress-execution-report
path: |
/home/runner/work/mx-explorer-dapp/mx-explorer-dapp/mochawesome-report/mochawesome.html
/home/runner/work/mx-explorer-dapp/mx-explorer-dapp/cypress/screenshots
/home/runner/work/mx-explorer-dapp/mx-explorer-dapp/cypress/videos
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,8 @@ dist-ssr
*.njsproj
*.sln
*.sw?

#Cypress
cypress/reports/
cypress/screenshots/
cypress/videos/
12 changes: 12 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
import { defineConfig } from 'cypress';

export default defineConfig({
reporter: 'mochawesome',
reporterOptions: {
charts: true,
reportPageTitle: 'E2E Report',
inlineAssets: true,
saveAllAttempts: true,
mochaFile: 'results/my-test-output-[hash].xml',
overwrite: false,
html: false,
json: true,
embeddedScreenshots: true
},
e2e: {
baseUrl: 'https://integration-explorer.multiversx.com/',

Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@
"prepare-free-icons": "run-script-os",
"prepare-free-icons:nix": "cp ./src/icons/duotone/fontawesomeFree.ts ./src/icons/duotone/index.ts && cp ./src/icons/light/fontawesomeFree.ts ./src/icons/light/index.ts && cp ./src/icons/regular/fontawesomeFree.ts ./src/icons/regular/index.ts && cp ./src/icons/solid/fontawesomeFree.ts ./src/icons/solid/index.ts",
"prepare-free-icons:windows": "copy .\\src\\icons\\duotone\\fontawesomeFree.ts .\\src\\icons\\duotone\\index.ts && copy .\\src\\icons\\light\\fontawesomeFree.ts .\\src\\icons\\light\\index.ts && copy .\\src\\icons\\regular\\fontawesomeFree.ts .\\src\\icons\\regular\\index.ts && copy .\\src\\icons\\solid\\fontawesomeFree.ts .\\src\\icons\\solid\\index.ts",
"prepare-pro-icons": "./prepare-pro-icons.sh"
"prepare-pro-icons": "./prepare-pro-icons.sh",
"cy:run": "node scripts/cypress.ts"
},
"devDependencies": {
"@types/file-saver": "2.0.5",
Expand Down Expand Up @@ -121,7 +122,10 @@
"vite-plugin-mkcert": "1.16.0",
"vite-plugin-node-polyfills": "0.9.0",
"vite-plugin-svgr": "3.2.0",
"vite-tsconfig-paths": "4.2.0"
"vite-tsconfig-paths": "4.2.0",
"cypress-mochawesome-reporter": "3.7.0",
"mochawesome-merge": "4.3.0",
"mochawesome-report-generator": "6.2.0"
},
"peerDependencies": {
"@fortawesome/pro-duotone-svg-icons": "6.4.2",
Expand Down
16 changes: 16 additions & 0 deletions scripts/cypress.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/no-var-requires */
const cypress = require('cypress');
const fse = require('fs-extra');
const { merge } = require('mochawesome-merge');
const generator = require('mochawesome-report-generator');

async function runTests() {
await fse.remove('mochawesome-report');
const { totalFailed } = await cypress.run();
const jsonReport = await merge();
await generator.create(jsonReport);
process.exit(totalFailed);
}

runTests();

0 comments on commit a403988

Please sign in to comment.