Skip to content

Commit

Permalink
Switch TPv2 E2E tests to Cypress (#7925)
Browse files Browse the repository at this point in the history
* Port the login e2e test to cypress

* Add initial mock data loading for Cypress

* Remove unnecessary example file

* Extract login to a custom command for reuse

* Convert CG tests to Cypress

* Simplify mock data structure

* Add missing enablement check

* Convert Divisions tests to Cypress

* Convert Regions tests to Cypress

* Convert Coordinates tests to Cypress

* Convert ASN tests to Cypress

* Convert CDN tests to Cypress

* Convert DS tests to Cypress

* Convert Parameter tests to Cypress

* Convert Profile tests to Cypress

* Convert server tests to Cypress

* Convert server Capability tests to Cypress

* Convert Physical Location tests to Cypress

* Fix weird name in fixture data

* Convert Status tests to Cypress

* Convert Type tests to Cypress

* Add a model for the login data

* Convert User tests to Cypress

* Convert Change Log tests to Cypress

* Convert Role tests to Cypress

* Convert Tenant tests to Cypress

* Remove testing initial stup for nightwatch

* Move documentation to the cypress directory

* Remove lingering nightwatch files

* Add headless run NPM script

* Remove Angular architect runner for nightwatch

* Add screenshots to .gitignore

* Remove lingering Nightwatch references

Also ran npm audit fix

* Remove now-unnecessary step in TPv2 workflow

* Fix waiting for a server that won't ever start

* (Re-?)Install @angular-devkit/architect

* Fix TO API port

* Fix GHA artifact paths

* Remove running TPv2 server and collecting logs

* Remove tpv2 build from default pkg targets

* Remove experimental component from CiaB test suite

* Add RPM build task to TPv2 testing suite

* Fix Cypress unable to create cache when building RPMs

* Fix RPM build failure in CI

* Remove experimental services from CiaB Makefile's default target

* Move tpv2 ciab things to optional services
  • Loading branch information
ocket8888 authored Jan 23, 2024
1 parent 4b6af89 commit 0b802b5
Show file tree
Hide file tree
Showing 142 changed files with 17,900 additions and 33,696 deletions.
4 changes: 4 additions & 0 deletions .github/actions/build-rpms/build-rpms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ trap 'echo "Error on line ${LINENO} of ${0}"; exit 1' ERR
export DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1

pkg_command=(./pkg -v)
if [[ "$ATC_COMPONENT" == "traffic_portal_v2" ]]; then
pkg_command=(./pkg -v -o)
fi

# If the Action is being run on a Pull Request
if [[ "$GITHUB_REF" == refs/pull/*/merge ]]; then
sudo apt-get install jq
Expand Down
8 changes: 0 additions & 8 deletions .github/actions/tpv2-integration-tests/config.json

This file was deleted.

8 changes: 2 additions & 6 deletions .github/actions/tpv2-integration-tests/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,9 @@ envsubst <../../.github/actions/tpv2-integration-tests/cdn.json >./cdn.conf

./traffic_ops_golang --cfg ./cdn.conf --dbcfg ../../.github/actions/tpv2-integration-tests/database.json > out.log 2>&1 &

cd "${GITHUB_WORKSPACE}/experimental/traffic-portal/dist/traffic-portal"
envsubst <${GITHUB_WORKSPACE}/.github/actions/tpv2-integration-tests/config.json >./config.json
node ./server/main.js -C config.json > "${GITHUB_WORKSPACE}/tp.log" 2>&1 &

timeout 3m bash <<TMOUT
while ! curl -k "http://localhost:4200/api/4.0/ping" >/dev/null 2>&1; do
echo "waiting for TP dev server to proxy TO API"
while ! curl -k "https://localhost:6443/api/4.0/ping" >/dev/null 2>&1; do
echo "waiting for TO API"
sleep 5
done
TMOUT
Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/ciab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -166,29 +166,6 @@ jobs:
name: ${{ github.job }}
path: ${{ github.workspace }}/dist/${{ github.job }}-*.rpm

traffic_portal_v2:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
with:
fetch-depth: 5
- name: Cache node modules
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/.npm
key: ${{ runner.os }}-node-modules-${{ hashFiles('experimental/traffic-portal/**/package*.json') }}-
- name: Build RPM
uses: ./.github/actions/build-rpms
env:
ATC_COMPONENT: ${{ github.job }}
- name: Upload RPM
uses: actions/upload-artifact@v2
with:
name: ${{ github.job }}
path: ${{ github.workspace }}/dist/${{ github.job }}-*.rpm

traffic_router:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
Expand Down Expand Up @@ -329,7 +306,6 @@ jobs:
- traffic_monitor
- traffic_ops
- traffic_portal
- traffic_portal_v2
- traffic_router
- traffic_stats
- trafficserver
Expand Down
28 changes: 23 additions & 5 deletions .github/workflows/tpv2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ jobs:
run: |
cd experimental/traffic-portal
npx ng build
npx ng run traffic-portal:server
- name: Run everything and test
uses: ./.github/actions/tpv2-integration-tests
- name: Upload Report
Expand All @@ -267,10 +266,29 @@ jobs:
path: |
traffic_ops/traffic_ops_golang/out.log
experimental/traffic-portal/logs
experimental/traffic-portal/nightwatch/junit
experimental/traffic-portal/nightwatch/screens
experimental/traffic-portal/tests_output
tp.log
experimental/traffic-portal/cypress/screenshots
- name: Save Alpine Docker image
run: .github/actions/save-alpine-tar/entrypoint.sh save ${{ env.ALPINE_VERSION }}
pkg-build:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
with:
fetch-depth: 5
- name: Cache node modules
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/.npm
key: ${{ runner.os }}-node-modules-${{ hashFiles('experimental/traffic-portal/**/package*.json') }}-
- name: Build RPM
uses: ./.github/actions/build-rpms
env:
ATC_COMPONENT: traffic_portal_v2
- name: Upload RPM
uses: actions/upload-artifact@v2
with:
name: ${{ github.job }}
path: ${{ github.workspace }}/dist/${{ github.job }}-*.rpm
2 changes: 0 additions & 2 deletions experimental/traffic-portal/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
/dist
/.angular
/.npm
/nightwatch/tests_output
/nightwatch/screens
/tests_output
/logs
# Only exists if Bazel was run
Expand Down
7 changes: 4 additions & 3 deletions experimental/traffic-portal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Optional arguments:
-p PORT, --port PORT Specify the port on which Traffic Portal will listen
(Default: 4200)
-d DIST_PATH, --browser-folder DIST_PATH
Specifiy locaiton for the folder that holds the
Specifiy locaiton for the folder that holds the
browser files
-c CERT_PATH, --cert-path CERT_PATH
Specify a location for an SSL certificate to be used
Expand Down Expand Up @@ -164,8 +164,9 @@ use the command `ng test` (dependencies must first be installed). This will
attempt to open Chrome, Firefox and Opera, so ideally you would have those
installed prior to running the tests.

End-to-end testing uses NightwatchJS and can be run by using `ng e2e`. More
detailed instructions can be found in the `nightwatch/` folder
End-to-end testing uses [Cypress](https://www.cypress.io/) and can be run by
using `ng e2e`. More detailed instructions can be found in the README in the
`cypress/` directory.

## Extending Traffic Portal
Traffic Portal supports extending functionality through the use of Angular modules.
Expand Down
Loading

0 comments on commit 0b802b5

Please sign in to comment.