Skip to content

Commit

Permalink
Merge pull request #14 from DEFRA/a-few-more-fixes
Browse files Browse the repository at this point in the history
A few more fixes
  • Loading branch information
feedmypixel authored Dec 17, 2024
2 parents c4c1851 + 469fde6 commit 5c7ac2a
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/journey-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ jobs:
run: |
npm run test:github
npm run report
- name: upload artifact
if: failure()
uses: actions/upload-artifact@v4
with:
name: allure-report
path: ./allure-report
- name: debug
if: failure()
run: |
Expand Down
4 changes: 3 additions & 1 deletion compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ services:
# Headless browser, used by the test suite to actually run the tests against the
# containers.
selenium-chrome:

# Run locally on a mac
# image: selenium/standalone-chrome:119.0
image: selenium/standalone-chrome:latest
ports:
- 4444:4444
Expand Down Expand Up @@ -87,7 +90,6 @@ services:
- ./docker/config/cdp-portal-frontend.env
environment:
- PORT=3000
- NODE_ENV=development # This is required for the login cooke it work
depends_on:
cdp-portal-backend:
condition: service_started
Expand Down
29 changes: 27 additions & 2 deletions wdio.github.conf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
const allure = require('allure-commandline')

const debug = process.env.DEBUG
const oneHour = 60 * 60 * 1000
const oneMinute = 60 * 1000

export const config = {
//
Expand All @@ -16,7 +19,7 @@ export const config = {
baseUrl: `http://cdp-portal-frontend:3000`,

// Connection to remote chromedriver
hostname: process.env.CHROMEDRIVER_URL || '127.0.0.1',
hostname: process.env.CHROMEDRIVER_URL || 'localhost',
port: process.env.CHROMEDRIVER_PORT || 4444,

// Tests to run
Expand Down Expand Up @@ -218,7 +221,29 @@ export const config = {
* @param {Array.<Object>} capabilities list of capabilities details
* @param {<Object>} results object containing test results
*/
onComplete: function (exitCode, config, capabilities, results) {}
onComplete: function (exitCode, config, capabilities, results) {
if (results?.failed && results.failed > 0) {
const reportError = new Error('Could not generate Allure report')
const generation = allure(['generate', 'allure-results', '--clean'])

return new Promise((resolve, reject) => {
const generationTimeout = setTimeout(
() => reject(reportError),
oneMinute
)

generation.on('exit', function (exitCode) {
clearTimeout(generationTimeout)

if (exitCode !== 0) {
return reject(reportError)
}

resolve()
})
})
}
}
/**
* Gets executed when a refresh happens.
* @param {string} oldSessionId session ID of the old session
Expand Down

0 comments on commit 5c7ac2a

Please sign in to comment.