Skip to content

Commit

Permalink
Add sorry-cypress config + improvment
Browse files Browse the repository at this point in the history
  • Loading branch information
hamza-lem committed Aug 9, 2024
1 parent e22c4f4 commit b269eae
Show file tree
Hide file tree
Showing 11 changed files with 94 additions and 12 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ name: Tests
on:
# Triggers the workflow manually from the GitHub Actions tab
workflow_dispatch:
inputs:
sorry_cypress:
description: 'Choose whether to send results to Sorry-Cypress'
required: true
default: 'false'

# Runs the workflow on every push to the repository
push:
# Runs the workflow on every push to the repository
Expand All @@ -16,6 +22,7 @@ on:

env:
NODE_VERSION: 20.10.0
SORRY_CYPRESS_DIRECTOR_URL: ${{ secrets.SORRY_CYPRESS_DIRECTOR_URL}}

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
Expand Down Expand Up @@ -66,14 +73,18 @@ jobs:
npx cypress cache list
npx cypress cache path
- uses: cypress-io/github-action@v6
continue-on-error: true
with:
install: false
build: npm run cy:info
wait-on-timeout: 180
browser: ${{ matrix.browser }}
config-file: cypress.config.js
spec: cypress/e2e/1-getting-started/todo.cy.js
command: |
npx cypress-cloud run --browser ${{ matrix.browser }} --parallel --record --key ${{ secrets.SORRY_CYPRESS_RECORD_KEY }} --ci-build-id ${{ github.run_id }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEBUG: 'cypress:server:args'
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,7 @@ dist
runner-results
cypress/screenshots
cypress/videos
cypress/reports
cypress/reports
data
docker-compose.minio.yml
.$sorry-cypress-arch.drawio.bkp
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This project integrates Cypress with Sorry-Cypress an open-source, on-premise, s
$ npm install
```

## Running Tests
## Running Cypress Tests

```bash
# Run Tests with Cypress Runner
Expand All @@ -20,6 +20,13 @@ $ npm run cypress:open
$ npm run cypress:run
```

## Cypress Test Report

- [Cypress Report Home Page](https://hamza-lem.github.io/cy-sorry-cypress-dashboard/)
- [Cypress Chrome Report](https://hamza-lem.github.io/cy-sorry-cypress-dashboard/chrome/chrome-report/html/index.html)
- [Cypress Electron Report](https://hamza-lem.github.io/cy-sorry-cypress-dashboard/electron/electron-report/html/index.html)
- [Cypress Edge Report](https://hamza-lem.github.io/cy-sorry-cypress-dashboard/edge/edge-report/html/index.html)

## Documentation

- [Cypress docs](https://docs.cypress.io/guides/overview)
Expand Down
9 changes: 6 additions & 3 deletions currents.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// currents.config.js
module.exports = {
projectId: 'yyy', // the projectId, can be any values for sorry-cypress users
recordKey: 'xxx', // the record key, can be any value for sorry-cypress users
cloudServiceUrl: 'http://localhost:1234', // Sorry Cypress users - set the director service URL
// projectId should match the projectId value used in Sorry-Cypress.
projectId: 'cy-sorry-cypress-dashboard',
// Record key, can be any value.
recordKey: 'cy-key',
// Director service URL
cloudServiceUrl: process.env.SORRY_CYPRESS_DIRECTOR_URL,
};
7 changes: 4 additions & 3 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
const { defineConfig } = require("cypress");
const { cloudPlugin } = require("cypress-cloud/plugin");
const { defineConfig } = require('cypress');
const { cloudPlugin } = require('cypress-cloud/plugin');

module.exports = defineConfig ({
module.exports = defineConfig({
video: true,
videoUploadOnPasses: false,
retries: 1,
reporter: 'cypress-mochawesome-reporter',
reporterOptions: {
Expand Down
5 changes: 4 additions & 1 deletion cypress/e2e/1-getting-started/todo.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ describe(`example to-do app - ${Cypress.browser.name}`, () => {
.should('not.have.text', 'Pay electric bill');

// Finally, make sure that the clear button no longer exists.
cy.contains('Clear completed').should('not.exist');
let result = ['not.exist', 'exist'];
cy.contains('Clear completed').should(
result[Math.floor(Math.random() * 2)],
);
});
});
});
2 changes: 1 addition & 1 deletion cypress/fixtures/profile.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"id": 8739,
"name": "Jane",
"email": "jane@example.com"
}
}
2 changes: 1 addition & 1 deletion cypress/fixtures/users.json
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,4 @@
"bs": "target end-to-end models"
}
}
]
]
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
"cy:run:chrome": "cypress run --browser chrome",
"cy:run:edge": "cypress run --browser edge",
"cy:run:electron": "cypress run --browser electron",
"cy:run:sorry-cypress": "cypress-cloud run --parallel --key cy-key --ci-build-id Run#01",
"cy:run:sorry-cypress:chrome": "cypress-cloud run --browser chrome --parallel",
"cy:run:sorry-cypress:edge": "cypress-cloud run --browser edge --parallel",
"cy:run:sorry-cypress:electron": "cypress-cloud run --browser electron --parallel",
"cy:run:parallel": "cypress-parallel -s cypress run -t 2 -d 'cypress/e2e/**/*.cy.js' -o 'cypressParallel=true'",
"cy:open-report": "open cypress/reports/html/index.html"
},
Expand Down
50 changes: 50 additions & 0 deletions sorry-cypress-arch.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<mxfile host="Electron" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/24.7.5 Chrome/126.0.6478.183 Electron/31.3.0 Safari/537.36" version="24.7.5">
<diagram id="prtHgNgQTEPvFCAcTncT" name="Page-1">
<mxGraphModel dx="1207" dy="802" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="LmnraRK7fbczGcJAW316-13" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="BswZ_c2iV8BSaqOJSDTe-27">
<mxGeometry relative="1" as="geometry">
<mxPoint x="414" y="230" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="BswZ_c2iV8BSaqOJSDTe-27" value="" style="strokeColor=#000000;shadow=0;strokeWidth=1;rounded=1;absoluteArcSize=1;arcSize=2;" parent="1" vertex="1">
<mxGeometry x="334" y="280" width="160" height="60" as="geometry" />
</mxCell>
<mxCell id="BswZ_c2iV8BSaqOJSDTe-28" value="&lt;font color=&quot;#000000&quot;&gt;cypress-cloud&lt;br&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;Plugin&lt;/span&gt;&lt;/div&gt;&lt;/font&gt;" style="editableCssRules=.*;html=1;fontColor=#999999;shape=image;verticalLabelPosition=middle;verticalAlign=middle;labelPosition=right;align=left;spacingLeft=20;part=1;points=[];imageAspect=0;image=data:image/svg+xml,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnY9Imh0dHBzOi8vdmVjdGEuaW8vbmFubyIgd2lkdGg9IjQyNCIgaGVpZ2h0PSI0MjQiIHZpZXdCb3g9IjAgMCA0MjQgNDI0Ij4mI3hhOwk8c3R5bGUgdHlwZT0idGV4dC9jc3MiPi5zdDAgeyBmaWxsOiByZ2IoMCwgMCwgMCk7IH0gPC9zdHlsZT4mI3hhOwk8cGF0aCBjbGFzcz0ic3QwIiBkPSJNNDI0IDB2NDI0SDBWMHpNMjEyIDk3Ljg0NmMtMzcuODg0IDAtNzAuMTY0IDIzLjk5LTgyLjQ3OCA1Ny42MDhoMGwtMy40MDMuMDAxYy00Mi42MzQgMC03Ny4xOTYgMzQuNTYyLTc3LjE5NiA3Ny4xOTZzMzQuNTYyIDc3LjE5NiA3Ny4xOTYgNzcuMTk2aDAgMTcxLjc2M2M0Mi42MzQgMCA3Ny4xOTYtMzQuNTYyIDc3LjE5Ni03Ny4xOTZzLTM0LjU2Mi03Ny4xOTYtNzcuMTk2LTc3LjE5NmgwbC0zLjQwMy0uMDAxQzI4Mi4xNjQgMTIxLjgzNyAyNDkuODg0IDk3Ljg0NiAyMTIgOTcuODQ2eiIgZmlsbC1ydWxlPSJldmVub2RkIi8+JiN4YTs8L3N2Zz4=;" parent="BswZ_c2iV8BSaqOJSDTe-27" vertex="1">
<mxGeometry width="30" height="30" relative="1" as="geometry">
<mxPoint x="15" y="15" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="BswZ_c2iV8BSaqOJSDTe-37" value="Sorry-Cypress" style="swimlane;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="60" y="50" width="700" height="180" as="geometry" />
</mxCell>
<mxCell id="LmnraRK7fbczGcJAW316-9" value="API (GraphQL)" style="swimlane;whiteSpace=wrap;html=1;" vertex="1" parent="BswZ_c2iV8BSaqOJSDTe-37">
<mxGeometry x="185" y="40" width="160" height="110" as="geometry" />
</mxCell>
<mxCell id="LmnraRK7fbczGcJAW316-18" value="A backend API that interacts with MongoDB and MinIO&amp;nbsp;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="LmnraRK7fbczGcJAW316-9">
<mxGeometry x="7.5" y="30" width="145" height="70" as="geometry" />
</mxCell>
<mxCell id="LmnraRK7fbczGcJAW316-10" value="Dashboard" style="swimlane;whiteSpace=wrap;html=1;" vertex="1" parent="BswZ_c2iV8BSaqOJSDTe-37">
<mxGeometry x="10" y="40" width="160" height="110" as="geometry" />
</mxCell>
<mxCell id="LmnraRK7fbczGcJAW316-17" value="A web interface for visualizing test results for each cypress test run" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="LmnraRK7fbczGcJAW316-10">
<mxGeometry x="10" y="30" width="140" height="70" as="geometry" />
</mxCell>
<mxCell id="LmnraRK7fbczGcJAW316-11" value="Director (MongoDB)" style="swimlane;whiteSpace=wrap;html=1;" vertex="1" parent="BswZ_c2iV8BSaqOJSDTe-37">
<mxGeometry x="360" y="40" width="160" height="110" as="geometry" />
</mxCell>
<mxCell id="LmnraRK7fbczGcJAW316-19" value="A Service that use MongoDB to store test runs details&amp;nbsp;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="LmnraRK7fbczGcJAW316-11">
<mxGeometry x="10" y="30" width="140" height="70" as="geometry" />
</mxCell>
<mxCell id="LmnraRK7fbczGcJAW316-12" value="MinIo" style="swimlane;whiteSpace=wrap;html=1;" vertex="1" parent="BswZ_c2iV8BSaqOJSDTe-37">
<mxGeometry x="530" y="40" width="160" height="110" as="geometry" />
</mxCell>
<mxCell id="LmnraRK7fbczGcJAW316-20" value="A storage object system used to store test result screenshots/videos" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="LmnraRK7fbczGcJAW316-12">
<mxGeometry x="10" y="30" width="140" height="70" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
Binary file added sorry-cypress-arch.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b269eae

Please sign in to comment.