|
16 | 16 | DSPACE_REST_PORT: 8080 |
17 | 17 | DSPACE_REST_NAMESPACE: '/server' |
18 | 18 | DSPACE_REST_SSL: false |
19 | | - # When Chrome version is specified, we pin to a specific version of Chrome & ChromeDriver |
20 | | - # Comment this out to use the latest release of both. |
21 | | - CHROME_VERSION: "90.0.4430.212-1" |
| 19 | + # When Chrome version is specified, we pin to a specific version of Chrome |
| 20 | + # Comment this out to use the latest release |
| 21 | + #CHROME_VERSION: "90.0.4430.212-1" |
22 | 22 | strategy: |
23 | 23 | # Create a matrix of Node versions to test against (in parallel) |
24 | 24 | matrix: |
|
66 | 66 | key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
67 | 67 | restore-keys: ${{ runner.os }}-yarn- |
68 | 68 |
|
69 | | - - name: Install latest ChromeDriver compatible with installed Chrome |
70 | | - # needs to be npm, the --detect_chromedriver_version flag doesn't work with yarn global |
71 | | - run: | |
72 | | - npm install -g chromedriver --detect_chromedriver_version |
73 | | - chromedriver -v |
74 | | -
|
75 | 69 | - name: Install Yarn dependencies |
76 | 70 | run: yarn install --frozen-lockfile |
77 | 71 |
|
@@ -99,23 +93,40 @@ jobs: |
99 | 93 | docker-compose -f ./docker/cli.yml -f ./docker/cli.assetstore.yml run --rm dspace-cli |
100 | 94 | docker container ls |
101 | 95 |
|
102 | | - # Wait until the REST API returns a 200 response (or for a max of 30 seconds) |
103 | | - # https://github.com/nev7n/wait_for_response |
104 | | - - name: Wait for DSpace REST Backend to be ready (for e2e tests) |
105 | | - uses: nev7n/wait_for_response@v1 |
106 | | - with: |
107 | | - # We use the 'sites' endpoint to also ensure the database is ready |
108 | | - url: 'http://localhost:8080/server/api/core/sites' |
109 | | - responseCode: 200 |
110 | | - timeout: 30000 |
111 | | - |
112 | | - - name: Get DSpace REST Backend info/properties |
113 | | - run: curl http://localhost:8080/server/api |
114 | | - |
| 96 | + # Run integration tests via Cypress.io |
| 97 | + # https://github.com/cypress-io/github-action |
| 98 | + # (NOTE: to run these e2e tests locally, just use 'ng e2e') |
115 | 99 | - name: Run e2e tests (integration tests) |
116 | | - run: | |
117 | | - chromedriver --url-base='/wd/hub' --port=4444 & |
118 | | - yarn run e2e:ci |
| 100 | + uses: cypress-io/github-action@v2 |
| 101 | + with: |
| 102 | + # Run tests in Chrome, headless mode |
| 103 | + browser: chrome |
| 104 | + headless: true |
| 105 | + # Start app before running tests (will be stopped automatically after tests finish) |
| 106 | + start: yarn run serve:ssr |
| 107 | + # Wait for backend & frontend to be available |
| 108 | + # NOTE: We use the 'sites' REST endpoint to also ensure the database is ready |
| 109 | + wait-on: http://localhost:8080/server/api/core/sites, http://localhost:4000 |
| 110 | + # Wait for 2 mins max for everything to respond |
| 111 | + wait-on-timeout: 120 |
| 112 | + |
| 113 | + # Cypress always creates a video of all e2e tests (whether they succeeded or failed) |
| 114 | + # Save those in an Artifact |
| 115 | + - name: Upload e2e test videos to Artifacts |
| 116 | + uses: actions/upload-artifact@v2 |
| 117 | + if: always() |
| 118 | + with: |
| 119 | + name: e2e-test-videos |
| 120 | + path: cypress/videos |
| 121 | + |
| 122 | + # If e2e tests fail, Cypress creates a screenshot of what happened |
| 123 | + # Save those in an Artifact |
| 124 | + - name: Upload e2e test failure screenshots to Artifacts |
| 125 | + uses: actions/upload-artifact@v2 |
| 126 | + if: failure() |
| 127 | + with: |
| 128 | + name: e2e-test-screenshots |
| 129 | + path: cypress/screenshots |
119 | 130 |
|
120 | 131 | # Start up the app with SSR enabled (run in background) |
121 | 132 | - name: Start app in SSR (server-side rendering) mode |
|
0 commit comments