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

feat(Cypress): Add cypress e2e project #241

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

maipt1
Copy link

@maipt1 maipt1 commented Mar 26, 2024

Pre-condition:

New front-end commit id: f8d8183

How To Test?

1. Requirement software

  • 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

2. Setup project

  • 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

3. Run Testing

3.1. Setup testing

  • 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}

3.2. Prerequisite:

3.3. Run with Cypress UI

  • Open Cypress
    $ npm test
  • Select a specify test file: <file name>.cy.js

3.4. Run in headless mode

  • 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> ...

Limitation

  • Currently, the SW360 rest APIs use Liferay users to authenticate. However, there is no Liferay API to support creating users in Liferay. So to run this test code, we need to create a user manually to log into the system:

runDemoAutoTest

@hoangnt2 hoangnt2 added help wanted Extra attention is needed Do not merge don't merge labels Mar 26, 2024
@maipt1
Copy link
Author

maipt1 commented Mar 26, 2024

We have implemented e2e testing for components and releases. Please take a look at it and if you have any questions, please let me know.
[SW360 New Frontend] Automation Test #212

@hoangnt2 hoangnt2 added the WIP label Mar 26, 2024
@KoukiHama
Copy link
Member

@heliocastro @ag4ums @amritkv @arunazhakesan

Please feel free to comment for this PR!

@amritkv
Copy link
Contributor

amritkv commented Mar 27, 2024

Hey @KoukiHama & @hoangnt2 !

It looks awesome to me, as of now !
And moreover the library Cypress looks lightweight compared to the existing solutions, specifically for our project.

Need to dig deeper to understand it's usages in complex scenarios like tables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Do not merge don't merge help wanted Extra attention is needed WIP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants