Skip to content

Commit

Permalink
#251: run skills-service backward compat tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sudo-may committed Oct 4, 2024
1 parent 6ebb19b commit db3b51f
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 9 deletions.
64 changes: 56 additions & 8 deletions .github/workflows/skills-service-backward-compat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ jobs:
# The type of runner that the job will run on
runs-on: ubuntu-latest

strategy:
matrix:
skillsJsVersion: [ '3.3.0', '3.3.1', '3.4.0']

services:
postgres:
# Docker Hub image
Expand Down Expand Up @@ -103,12 +107,30 @@ jobs:
ls ./
cd ..
- name: run backwards compat tests
- name: build integration test apps
env:
MAVEN_OPTS: -Xmx2048m
run: |
cd ./skills-client-integration/skills-int-client-js
npm install @skilltree/skills-client-js@${{ matrix.skillsJsVersion }} --save-exact
cd ..
mvn --batch-mode clean install
cd ../
- name: start services for cypress tests
run: |
cd skills-client-integration/skills-int-e2e-test
npm install
npm run cyServices:start:skills-service:ci
npm run cyServices:start:integration-apps
cd ../../
- name: Run Cypress tests
run: |
cd skills-client-integration/skills-int-e2e-test
mvn --batch-mode clean package
export NO_COLOR=1
java -jar target/skills-int-e2e-test-*.jar
npm run cy:run
cd ../../
- name: upload result artifacts
Expand All @@ -117,9 +139,35 @@ jobs:
with:
name: result artifacts
path: |
./skills-client-integration/skills-int-e2e-test/target/logs/*
./skills-client-integration/skills-int-e2e-test/target/skills-client/skills-client-integration/skills-int-e2e-test/cypress/videos/*.mp4
./skills-client-integration/skills-int-e2e-test/target/skills-client/skills-client-integration/skills-int-e2e-test/cypress/screenshots/**/*.png
./skills-service/*.jar
./skills-client-integration/skills-int-service/target/*.jar
./skills-client-integration/skills-int-e2e-test/target/logs/*.out
./skills-client-integration/skills-int-e2e-test/cypress/videos/*.mp4
./skills-client-integration/skills-int-e2e-test/cypress/screenshots/**/*.png
/home/runner/.npm/_logs/*
./skills-client-integration/skills-int-e2e-test/logs
./skills-client-integration/skills-int-e2e-test/cypress/videos
./skills-client-integration/skills-int-e2e-test/cypress/screenshots
./skills-client-integration/skills-int-e2e-test/cypress/snapshots/**/**/__diff_output__/*.png
./skills-client-integration/skills-int-e2e-test/cypress/snapshots/**/__diff_output__/*.png
# - name: run backwards compat tests
# run: |
# cd skills-client-integration/skills-int-e2e-test
# mvn --batch-mode clean package
# export NO_COLOR=1
# java -jar target/skills-int-e2e-test-*.jar
# cd ../../
#
# - name: upload result artifacts
# if: ${{ always() }}
# uses: actions/upload-artifact@v4
# with:
# name: result artifacts
# path: |
# ./skills-client-integration/skills-int-e2e-test/target/logs/*
# ./skills-client-integration/skills-int-e2e-test/target/skills-client/skills-client-integration/skills-int-e2e-test/cypress/videos/*.mp4
# ./skills-client-integration/skills-int-e2e-test/target/skills-client/skills-client-integration/skills-int-e2e-test/cypress/screenshots/**/*.png
# ./skills-client-integration/skills-int-e2e-test/cypress/videos/*.mp4
# ./skills-client-integration/skills-int-e2e-test/cypress/screenshots/**/*.png
# /home/runner/.npm/_logs/*
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export default {
const versionToCompare = Cypress.env(lib);
return this.laterThanMinVersion(minVersion, versionToCompare);
},
skillsClientJSVersionLaterThan(minVersion) {
const versionToCompare = Cypress.env('skills-client-js-version')
return this.laterThanMinVersion(minVersion, versionToCompare);
},
skillsServiceVersionLaterThan(minVersion) {
const versionToCompare = Cypress.env('skills-service.minVersion');
return this.laterThanMinVersion(minVersion, versionToCompare);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ context("Navigation Tests", () => {

if (Utils.skillsServiceVersionLaterThan('1.6.0')) {
it('navigate skills-display programmatically', () => {
cy.onlyOn(Utils.skillsClientJSVersionLaterThan('3.3.1'))
cy.createDefaultTinyProject()
cy.backendPost('/api/projects/proj1/skills/Thor', {userId: Cypress.env('proxyUser'), timestamp: Date.now()})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ const backend = 'http://localhost:8080';
const baseUrl = Cypress.config().baseUrl;
const skillsDisplayHomePage = '/native/clientDisplay.html'


Cypress.Commands.add('onlyOn', (enabled) => {
if (enabled !== true) {
cy.state('runnable').ctx.skip()
}
})

Cypress.Commands.add("visitSkillsDisplay", (url = '') => {
cy.visit(`${skillsDisplayHomePage}${url}`);
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,21 @@ import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')

before(() => {
cy.readFile('../skills-int-client-js/package.json').then((packageJson) => {
const skillsClientJsVersion = packageJson['dependencies']['@skilltree/skills-client-js']
Cypress.env('skills-client-js-version', skillsClientJsVersion)
cy.log(`Running with skills-client-js version [${skillsClientJsVersion}]`)
})
})

beforeEach(() => {
// first call to npm fails, looks like this may be the bug: https://github.com/cypress-io/cypress/issues/6081
cy.exec('npm version', { failOnNonZeroExit: false })
cy.exec('npm run backend:resetDb')

cy.log(`Running with skills-client-js version [${Cypress.env('skills-client-js-version')}]`)

cy.fixture('vars.json').then((vars) => {
cy.request('api/config').then(resp => {
cy.backendRegister(vars.rootUser, vars.defaultPass, true);
Expand Down

0 comments on commit db3b51f

Please sign in to comment.