SW360 auto E2E testing is a system by using Cypress that is a next generation front end testing tool built for the modern web.
- Nodejs
$ sudo apt-get update $ curl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash - $ sudo apt install nodejs -y // Check nodejs version $ nodejs -v - NPM
$ sudo apt-get install npm // Check npm version $ npm -v - Google Chrome latest version
Note: Recommended environment is Ubuntu 22.04 LTS, Nodejs v20.5.0, NPM 10.2.5
- Since the new front-end is still in development, this test code will work in the new front-end code with commit id: 6c8bb397adefa84703557fd11507a660c59b8ba7
- Clone source code for testing
$ git clone https://github.com/eclipse-sw360/sw360-frontend.git $ cd sw360-frontend - Install dependencies
$ sudo apt-get install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 xauth xvfb $ npm i $ sudo apt-get install jq
Reference: https://docs.cypress.io/guides/getting-started/installing-cypress#System-requirements
-
Change cypress configuration
$ vim cypress.env.json
-
Change these configs, keep others:
- "sw360_base_url": ${sw360 frontend url}
- "sw360_api_server": ${sw360 rest api url}
- "couchdb_ip": ${couchdb url}
- "couchdb_port": ${couchdb port}
- "couchdb_username" ${couchdb username}
- "couchdb_password" ${couchdb password}
- There is an user in sw360 liferay with:
- username: admin@sw360.org
- password: 12345
- Open Cypress
$ npm test - Select a specify test file: <file name>.cy.js
-
Run all tests:
$ npx cypress run --browser chrome
-
Run a specify test:
$ npx cypress run --browser chrome --spec <file.cy.js> <file1.cy.js> <file2.cy.js> ...