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

Prepare testing with profiles #789

Closed
wants to merge 22 commits into from
Closed
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
37 changes: 26 additions & 11 deletions .github/workflows/testing.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ on:

jobs:
testing:
strategy:
# Each job needs its own backend. Running backends in parallel requires using differnt ports.
matrix:
selection: [
'default',
'xml-storage'
]
name: Unit tests
runs-on: ubuntu-latest

Expand Down Expand Up @@ -86,8 +93,8 @@ jobs:
restore-keys: |
${{ runner.os }}-cypress-

- name: Set Cypress environment variables
run: cp cypress.env.json.cicd cypress.env.json
- name: Choose tests to run - choice is ${{ matrix.selection }}
run: sed "s|SELECTION|\"selection\":\"${{ matrix.selection }}\",|g" cypress.env.json.cicd.template > cypress.env.json
working-directory: ladybug-frontend

- name: Run linter
Expand Down Expand Up @@ -117,6 +124,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 storage.xml if matrix.selection is 'xml-storage'
run: echo "spring.profiles.active=storage.xml" >> frank-runner/specials/ladybug/build.properties
if: ${{ matrix.selection == 'xml-storage' }}
- 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 @@ -205,52 +215,57 @@ jobs:
- name: Show files
run: tree -d -L 5 .
if: always()

- name: Store cypress.env.json
uses: actions/upload-artifact@v4
if: always()
with:
name: cypress.env.json ${{ matrix.selection }}
path: ladybug-frontend/cypress.env.json
- name: Store log of Frank!Runner downloads
uses: actions/upload-artifact@v4
if: always()
with:
name: installFrankRunnerEnv.log
name: installFrankRunnerEnv.log ${{ matrix.selection }}
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.selection }}
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.selection }}
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.selection }}
path: frank-runner/build/*/logs/*
- name: Store Cypress screenshots
uses: actions/upload-artifact@v4
if: always()
with:
name: screenshots
name: screenshots ${{ matrix.selection }}
path: ladybug-frontend/cypress/screenshots/
- name: Store Cypress videos
uses: actions/upload-artifact@v4
if: always()
with:
name: videos
name: videos ${{ matrix.selection }}
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.selection }}
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.selection }}
path: ladybug-frontend/cypress/firefox/videos/
4 changes: 0 additions & 4 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ import { defineConfig } from 'cypress';

export default defineConfig({
trashAssetsBeforeRuns: false,
env: {
backendServer: 'http://localhost:80',
FILESEP: '\\',
},
e2e: {
baseUrl: 'http://localhost:4200',
excludeSpecPattern: ['**/cypress/e2e/1-getting-started/**', '**/cypress/e2e/2-advanced-examples/**'],
Expand Down
5 changes: 5 additions & 0 deletions cypress.env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"backendServer": "http://localhost:80",
"FILESEP": "\\",
"selection":"default"
}
1 change: 1 addition & 0 deletions cypress.env.json.cicd → cypress.env.json.cicd.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
SELECTION
"backendServer": "http://localhost:8090",
"FILESEP": "/"
}
25 changes: 25 additions & 0 deletions cypress/e2e/1 about-xml-storage.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// 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.
//
// Furthermore, we need an empty test tab in case
// there are no predefined reports.
//
describe('Compare with and without profile xml.storage', () => {
beforeEach(() => {
cy.initializeApp();
cy.navigateToTestTabAndInterceptApiCall();
})

if(Cypress.env('selection') === "xml-storage") {
it('Report present in src/test/testtool should be shown', () => {
cy.getTestTableRows().contains('Pre existing report').should('have.length', 1)
})
} else {
it('Report present 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')
})
}
})
4 changes: 4 additions & 0 deletions cypress/e2e/checks.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
describe('Checks of the test environment', () => {
it('Environment \'selection\' is: ' + Cypress.env('selection'), () => {
})
})
7 changes: 7 additions & 0 deletions cypress/e2e/copying.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { showSkipped } from "cypress/support/commands";

describe('Tests about copying', () => {
if(Cypress.env('selection') !== "default") {
showSkipped()
return
}

before(() => {
cy.resetApp();
});
Expand Down
7 changes: 7 additions & 0 deletions cypress/e2e/debug/aboutOpenedReports.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { showSkipped } from "cypress/support/commands";

describe('About opened reports', () => {
if(Cypress.env('selection') !== "default") {
showSkipped()
return
}

before(() => cy.resetApp());

beforeEach(() => {
Expand Down
7 changes: 7 additions & 0 deletions cypress/e2e/debug/clickingInTableOpensReport.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { showSkipped } from "cypress/support/commands";

describe('Clicking a report', () => {
if(Cypress.env('selection') !== "default") {
showSkipped()
return
}

before(() => {
cy.resetApp();
});
Expand Down
7 changes: 7 additions & 0 deletions cypress/e2e/debug/custom-editor.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { showSkipped } from "cypress/support/commands";

describe('Tests for custom editor in debug tab', () => {
if(Cypress.env('selection') !== "default") {
showSkipped()
return
}

before(() => cy.resetApp());

beforeEach(() => {
Expand Down
7 changes: 7 additions & 0 deletions cypress/e2e/debug/deleteReports.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { showSkipped } from "cypress/support/commands";

describe('About deleting reports', () => {
if(Cypress.env('selection') !== "default") {
showSkipped()
return
}

beforeEach(() => {
cy.resetApp()
});
Expand Down
7 changes: 7 additions & 0 deletions cypress/e2e/debug/fileupload.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { showSkipped } from "cypress/support/commands";

describe('Debug file upload', () => {
if(Cypress.env('selection') !== "default") {
showSkipped()
return
}

before(() => cy.resetApp());

beforeEach(() => {
Expand Down
7 changes: 7 additions & 0 deletions cypress/e2e/debug/filterTable.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { showSkipped } from "cypress/support/commands";

describe('Tests for table filter', () => {
if(Cypress.env('selection') !== "default") {
showSkipped()
return
}

before(() => cy.resetApp());

beforeEach(() => {
Expand Down
7 changes: 7 additions & 0 deletions cypress/e2e/debug/labels.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { showSkipped } from "cypress/support/commands";

describe('Test labels', () => {
if(Cypress.env('selection') !== "default") {
showSkipped()
return
}

before(() => cy.resetApp());

afterEach(() => {
Expand Down
7 changes: 7 additions & 0 deletions cypress/e2e/debug/refresh.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { showSkipped } from "cypress/support/commands";

describe('Refresh', () => {
if(Cypress.env('selection') !== "default") {
showSkipped()
return
}

before(() => {
cy.resetApp();
});
Expand Down
7 changes: 7 additions & 0 deletions cypress/e2e/debug/reportGenerator.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { showSkipped } from "cypress/support/commands";

describe('Report generator', () => {
if(Cypress.env('selection') !== "default") {
showSkipped()
return
}

before(() => cy.resetApp());

beforeEach(() => {
Expand Down
17 changes: 17 additions & 0 deletions cypress/e2e/debug/runningReports.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { showSkipped } from "cypress/support/commands";

describe('Test running reports', () => {
if(Cypress.env('selection') !== "default") {
showSkipped()
return
}

before(() => cy.resetApp());

afterEach(() => cy.resetApp());
Expand All @@ -10,6 +17,11 @@ describe('Test running reports', () => {
});

describe('With running reports', () => {
if(Cypress.env('selection') !== "default") {
showSkipped()
return
}

before(() => {
cy.resetApp();
cy.createRunningReport();
Expand Down Expand Up @@ -42,6 +54,11 @@ describe('With running reports', () => {
});

describe('Test Reports in progress warning', () => {
if(Cypress.env('selection') !== "default") {
showSkipped()
return
}

beforeEach(() => {
cy.createRunningReport();
cy.request(Cypress.env('backendServer') + '/index.jsp?setReportInProgressThreshold=1').then((resp) => {
Expand Down
7 changes: 7 additions & 0 deletions cypress/e2e/debug/settings-component.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { showSkipped } from "cypress/support/commands";

describe('Tests for settings component', () => {
if(Cypress.env('selection') !== "default") {
showSkipped()
return
}

before(() => cy.resetApp());

beforeEach(() => {
Expand Down
7 changes: 7 additions & 0 deletions cypress/e2e/debug/show-warnings-and-errors.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { showSkipped } from "cypress/support/commands";

describe('Tests for showing errors and warnings', () => {
if(Cypress.env('selection') !== "default") {
showSkipped()
return
}

it('should show errors that occur for the storage of the current view', () => {
cy.initializeApp();
const apiCallAlias: string = 'warningsAndErrors';
Expand Down
7 changes: 7 additions & 0 deletions cypress/e2e/debug/table.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { showSkipped } from "cypress/support/commands";

describe('Tests for Debug tab table', () => {
if(Cypress.env('selection') !== "default") {
showSkipped()
return
}

before(() => cy.resetApp());

beforeEach(() => {
Expand Down
7 changes: 7 additions & 0 deletions cypress/e2e/debug/toast.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { showSkipped } from "cypress/support/commands";

describe('Test toast window', () => {
if(Cypress.env('selection') !== "default") {
showSkipped()
return
}

before(() => cy.resetApp());

beforeEach(() => cy.initializeApp());
Expand Down
7 changes: 7 additions & 0 deletions cypress/e2e/debug/transformation.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { showSkipped } from "cypress/support/commands";

describe('Tests for report transformation', () => {
if(Cypress.env('selection') !== "default") {
showSkipped()
return
}

before(() => cy.resetApp());

afterEach(() => cy.resetApp());
Expand Down
6 changes: 6 additions & 0 deletions cypress/e2e/keep_state.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { showSkipped } from "cypress/support/commands";

describe('Tests for keeping state in tabs when switching tabs', () => {
if(Cypress.env('selection') !== "default") {
showSkipped()
return
}

beforeEach(() => {
cy.createReport();
Expand Down
7 changes: 7 additions & 0 deletions cypress/e2e/test/testtab.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { showSkipped } from "cypress/support/commands";

describe('Test the Test tab', () => {
if(Cypress.env('selection') !== "default") {
showSkipped()
return
}

before(() => {
cy.resetApp();
});
Expand Down
Loading
Loading