Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test with different Spring profiles (using --spec command line argument) #803

Merged
merged 18 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
35 changes: 25 additions & 10 deletions .github/workflows/testing.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,21 @@ on:

jobs:
testing:
strategy:
matrix:
include:
- spring-profile: none
selected-specs: cypress/e2e/no-profile/**
- spring-profile: storage.xml
selected-specs: cypress/e2e/storage-xml/**
name: Unit tests
runs-on: ubuntu-latest

steps:
- name: Echo inputs
run: echo "useRealFrontend=${{ github.event.inputs.useRealFrontend}}, mergeMasterToBranch=${{ github.event.inputs.mergeMasterToBranch}}, frontendCommitToCheckout=${{ github.event.inputs.frontendCommitToCheckout}}, backendCommitToCheckout=${{ github.event.inputs.backendCommitToCheckout }}"
- name: Show chosen Spring profile for backend and chosen specs to run
run: echo "Start backend with Spring profile ${{ matrix.spring-profile }} and run specs ${{ matrix.selected-specs }}"
- name: Checkout repository
uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -88,7 +97,7 @@ jobs:
${{ runner.os }}-cypress-

- name: Set Cypress environment variables
run: cp cypress.env.json.cicd cypress.env.json
run: cp .github/workflows/cypress.env.json.cicd cypress.env.json
working-directory: ladybug-frontend

- name: Run linter
Expand Down Expand Up @@ -118,6 +127,9 @@ jobs:
run: echo "maven.skip.javadoc=true" >> frank-runner/specials/ladybug/build.properties
- name: Set property to skip checking licenses
run: echo "maven.skip.copyright=true" >> frank-runner/specials/ladybug/build.properties
- name: Choose Spring profile for backend if it is not "none"
run: echo "spring.profiles.active=${{ matrix.spring-profile }}" >> frank-runner/specials/ladybug/build.properties
if: ${{ matrix.spring-profile != 'none' }}
- name: Set port where ladybug-test-webapp is served
run: echo "tomcat.connector.port=8090" > frank-runner/build.properties
- name: Prevent Java exception about binding port 443 (for https)
Expand Down Expand Up @@ -190,9 +202,10 @@ jobs:
with:
working-directory: ladybug-frontend
start: |
pnpm ng serve --proxy-config src/proxy.cicd.conf.json --host 0.0.0.0
pnpm ng serve --proxy-config .github/workflows/proxy.cicd.conf.json --host 0.0.0.0
wait-on: "http://0.0.0.0:8090, http://0.0.0.0:4200"
wait-on-timeout: 1000
spec: ${{ matrix.selected-specs }}
browser: chrome
- name: Run cypress with chrome browser (production frontend that is included in backend)
uses: cypress-io/[email protected]
Expand All @@ -201,8 +214,10 @@ jobs:
working-directory: ladybug-frontend
wait-on: "http://0.0.0.0:8090"
wait-on-timeout: 1000
spec: ${{ matrix.selected-specs }}
config: baseUrl=http://localhost:8090/ladybug
browser: chrome

- name: Show files
run: tree -d -L 5 .
if: always()
Expand All @@ -211,47 +226,47 @@ jobs:
uses: actions/upload-artifact@v4
if: always()
with:
name: installFrankRunnerEnv.log
name: installFrankRunnerEnv.log ${{ matrix.spring-profile }}
path: frank-runner/installFrankRunnerEnv.log
- name: Store log of starting the server with the Frank!Runner
uses: actions/upload-artifact@v4
if: always()
with:
name: serverStartLog.log
name: serverStartLog.log ${{ matrix.spring-profile }}
path: frank-runner/specials/ladybug/serverStartLog.log
- name: Store build.properties
uses: actions/upload-artifact@v4
if: always()
with:
name: specials_build.properties
name: specials_build.properties ${{ matrix.spring-profile }}
path: frank-runner/specials/ladybug/build.properties
- name: Store Apache Tomcat log
uses: actions/upload-artifact@v4
if: always()
with:
name: logs
name: logs ${{ matrix.spring-profile }}
path: frank-runner/build/*/logs/*
- name: Store Cypress screenshots
uses: actions/upload-artifact@v4
if: always()
with:
name: screenshots
name: screenshots ${{ matrix.spring-profile }}
path: ladybug-frontend/cypress/screenshots/
- name: Store Cypress videos
uses: actions/upload-artifact@v4
if: always()
with:
name: videos
name: videos ${{ matrix.spring-profile }}
path: ladybug-frontend/cypress/videos/
- name: Store Cypress screenshots for Firefox
uses: actions/upload-artifact@v4
if: always()
with:
name: Firefix screenshots
name: Firefix screenshots ${{ matrix.spring-profile }}
path: ladybug-frontend/cypress/firefox/screenshots/
- name: Store Cypress videos for Firefox
uses: actions/upload-artifact@v4
if: always()
with:
name: Firefox videos
name: Firefox videos ${{ matrix.spring-profile }}
path: ladybug-frontend/cypress/firefox/videos/
20 changes: 20 additions & 0 deletions cypress/e2e/no-profile/1-first.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

// This test should be run as the first. Other tests
// have to delete all reports from the test tab and
// would remove pre-existing reports.
//
// We test here that there are no predefined reports
//
describe('Test that should be done before all other tests', () => {
beforeEach(() => {
cy.initializeApp();
cy.navigateToTestTabAndInterceptApiCall();
})

it('Report in src/test/testtool should not be shown', () => {
// We cannot search for 'Pre existing report' within the
// test rows when there are not table rows at all.
cy.getTestTableRows().should('not.exist')
})
})

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions cypress/e2e/storage-xml/1-pre-existing-report.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// This test should be run as the first. Other tests
// have to delete all reports from the test tab and
// would remove pre-existing reports.
//
describe('Pre existing report', () => {
beforeEach(() => {
cy.initializeApp();
cy.navigateToTestTabAndInterceptApiCall();
})

it('Report present in src/test/testtool should be shown', () => {
cy.getTestTableRows().contains('Pre existing report').should('have.length', 1)
})
})
Loading