Skip to content

Commit

Permalink
Merge pull request #3237 from OpenLiberty/revert-3220-changingDefault…
Browse files Browse the repository at this point in the history
…Test

Revert "Changing default test"
  • Loading branch information
amyreit authored Jun 28, 2023
2 parents c6d3a66 + 19b7629 commit 2e5652b
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will run the cypress tests that are unrelated to the downloading and
# testing of the starter zip files

name: General Starter and Redirect Tests
name: Test Feature Versions RedirectURls and Runtime Release Versions
on:
workflow_dispatch:

Expand Down Expand Up @@ -63,23 +63,3 @@ jobs:
name: cypress-videos
path: /__w/start.openliberty.io/start.openliberty.io/cypress/videos/testRedirectURLs.cy.js.mp4

use-cypress-test-StarterDefaults:
runs-on: ubuntu-latest
container: cypress/included:12.5.1
steps:
- uses: actions/[email protected]
- run: cypress run --browser chrome --env JDK_VERSION="${{ inputs.java_version }}" --config-file /__w/start.openliberty.io/start.openliberty.io/src/test/cypressjs/cypress.config.js --spec /__w/openliberty.io/openliberty.io/src/test/cypressjs/cypress/e2e/testOLStarterDefaults.cy.js

- uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: /__w/start.openliberty.io/start.openliberty.io/cypress/screenshots/testOLStarterDefaults.cy.js

- uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-videos
path: /__w/start.openliberty.io/start.openliberty.io/cypress/videos/testOLStarterDefaults.cy.js.mp4


16 changes: 4 additions & 12 deletions src/test/cypressjs/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# How to run [Cypress.io](https://www.cypress.io/) automated UI tests Locallly
# How to run [Cypress.io](https://www.cypress.io/) automated UI tests

## Step 1: First time setting up local environment with Cypress
- Run `npm install` in the directory containing this `README.md`
- `node_modules` is created containing Cypress and its dependencies.

## Step 2: Setup URL you want the to test and the default java (2 options)
Update the value for `default_website_url` in `cypress.config.js` with target URL (usually either
the staging or production site). To execute the testOLStarterAll*.cy.js tests update the default java
and the location of the java levels on your local machine to the version you wish to test.
Update the value for `default_website_url` in `cypress.config.js` with target URL, update
the default_jdk with which java you want to test for tests that only test one, update the
locations of the java levels on your local machine

NOTE - do not check in the cypress.config.js file with any changes for your local environment

Expand All @@ -18,11 +18,3 @@ NOTE - do not check in the cypress.config.js file with any changes for your loca

NOTE - the testOLStarterAllGradle.cy.js and cypress/e2e/testOLMavenAllGradle.cy.js tests use a
lot of system memory and run more reliably headless

# Alternatively - Run Tests with GitHub Actions In Git

## Step 1: Go to https://github.com/OpenLiberty/openliberty.io/actions
Here you will see an action called 'General Starter and Redirect Tests'. This action will execute all of the tests in
the cypressjs/cypress/e2e directory with the exception of the testOLStarterAllMaven and testOLStarterAllGradle. These
two tests can be run from the starter repo - https://github.com/OpenLiberty/start.openliberty.io/actions.

39 changes: 39 additions & 0 deletions src/test/cypressjs/cypress/e2e/testOLStarterGradleDefaults.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

describe('Test Open Liberty Starter - Gradle Default EE and MP', () => {

// Allow users to specify URL via variables found in cypress.env.json
// java home path for jdk17, jdk11, jdk8 can be change via cypress.env.json base on user env var
// this test will only download the starter for the default_jdk in that file

const default_javahome = Cypress.env('jdk_11_home');
const appname = "app-name-g-default";
const downloadsFolder = Cypress.config('downloadsFolder');
const eeDefault = "10.0";
const mpDefault = "6.0"
const javaDefault = Cypress.env('default_jdk');

// tests
it('Default values for Open Liberty Starter', () => {
cy.goToOpenLibertyStarter();
cy.get("#Starter_Base_Package").should("have.value", "com.demo");
cy.get("#Starter_App_Name").should("have.value", "app-name");
cy.get('#build_system_gradle').click();
cy.get("#starter_section input[type=radio]:checked").should("have.value", "gradle");
cy.get("#Starter_Java_Version").should("have.value", javaDefault);
cy.get("#Starter_Jakarta_Version").should("have.value", eeDefault);
cy.get("#Starter_MicroProfile_Version").should("have.value", mpDefault);
});

it('Test zip file is downloaded with default values', () => {
cy.exec(`rm -rf ${downloadsFolder}`, { failOnNonZeroExit: false });
// download zip for the defaults
cy.log('appname ' + appname);
cy.log('javaLevel ' + javaDefault);
cy.goToOpenLibertyStarter();
cy.downloadAndUnzipFile(appname, eeDefault, mpDefault,'g');
cy.runGradlewLibertyDev(appname, default_javahome);
cy.checkLocalSplashPage();
cy.runGradlewLibertyStop(appname, default_javahome);
});

});
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@

describe('Test Open Liberty Starter - Maven Default EE and MP', () => {
// Test the default values for the starter

// Allow users to specify URL via variables found in cypress.env.json
// java home path for jdk17, jdk11, jdk8 can be change via cypress.env.json base on user env var
// this test will only download the starter for the default_jdk in that file

const default_javahome = Cypress.env('jdk_11_home');
const appname = "app-name-m-default";
const downloadsFolder = Cypress.config('downloadsFolder');
Expand All @@ -20,4 +22,15 @@ describe('Test Open Liberty Starter - Maven Default EE and MP', () => {
cy.get("#Starter_MicroProfile_Version").should("have.value", mpDefault);
});

it('Test zip file is downloaded with default values', () => {
cy.exec(`rm -rf ${downloadsFolder}`, { failOnNonZeroExit: false });
// download zip for the defaults
cy.log('appname ' + appname);
cy.log('javaLevel ' + javaDefault);
cy.goToOpenLibertyStarter();
cy.downloadAndUnzipFile(appname, eeDefault, mpDefault,'m');
cy.runMVNWLibertyDev(appname, default_javahome);
cy.checkLocalSplashPage();
cy.runMVNWLibertyStop(appname, default_javahome);
});
});

0 comments on commit 2e5652b

Please sign in to comment.