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

Support E2E tests in Neuron's repo by github action #132

Open
Keith-CY opened this issue Apr 19, 2023 · 9 comments
Open

Support E2E tests in Neuron's repo by github action #132

Keith-CY opened this issue Apr 19, 2023 · 9 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@Keith-CY
Copy link
Member

Keith-CY commented Apr 19, 2023

This feature requires introducing E2E test code into Neuron's Repo and synchronizing it with Github Action runs.

Neuron currently has an automated test service at https://github.com/nervosnetwork/neuron-automation, but it is a timed service that is not triggered by every commit. It is also not able to keep up with the updates to https://github.com/nervosnetwork/neuron, which puts a burden on maintenance.

If we can maintain E2E tests in Neuron's Repo, we can improve efficiency and reduce maintenance costs.

Following are the test frameworks suggested in community:

@Keith-CY Keith-CY added the documentation Improvements or additions to documentation label Apr 19, 2023
@Keith-CY Keith-CY added this to Neuron Apr 19, 2023
@Keith-CY Keith-CY moved this to 🆕 New in Neuron Apr 19, 2023
@FrederLu
Copy link

Cypress and Playwright have some commonalities and differences in the e2e test scenario:

common ground:

  1. Both support various user operations and custom scripts, which can be used to test various aspects of web applications, such as UI, functionality, performance, etc.
  2. Both provide easy-to-use API and documentation.
  3. Both support headless browser mode and visual mode to run tests.
  4. Both provide rich test reports and logs.

difference:

  1. The supported browsers are different: Cypress only supports Chrome, while Playwright supports Chrome, Firefox and WebKit.
  2. Different restrictions on test scripts: Cypress can only run test scripts in the same browser window, and Playwright can run test scripts in multiple browsers and pages.
  3. Assertions and test reports are different: Cypress has a built-in assertion library and a visual test runner, and the test report is more intuitive and easy to understand. Playwright requires the use of third-party libraries to implement assertions and test reports.
  4. Cypress is free and open source, while Playwright is a paid tool.

In general, Cypress is more suitable for use in single-browser e2e test scenarios, and can provide more intuitive and easy-to-understand test reports and a visual test runner. Playwright is more suitable for use in e2e test scenarios of multiple browsers and pages, and can provide more flexible test script writing and execution.

@Keith-CY
Copy link
Member Author

Cypress and Playwright have some commonalities and differences in the e2e test scenario:

common ground:

  1. Both support various user operations and custom scripts, which can be used to test various aspects of web applications, such as UI, functionality, performance, etc.
  2. Both provide easy-to-use API and documentation.
  3. Both support headless browser mode and visual mode to run tests.
  4. Both provide rich test reports and logs.

difference:

  1. The supported browsers are different: Cypress only supports Chrome, while Playwright supports Chrome, Firefox and WebKit.
  2. Different restrictions on test scripts: Cypress can only run test scripts in the same browser window, and Playwright can run test scripts in multiple browsers and pages.
  3. Assertions and test reports are different: Cypress has a built-in assertion library and a visual test runner, and the test report is more intuitive and easy to understand. Playwright requires the use of third-party libraries to implement assertions and test reports.
  4. Cypress is free and open source, while Playwright is a paid tool.

In general, Cypress is more suitable for use in single-browser e2e test scenarios, and can provide more intuitive and easy-to-understand test reports and a visual test runner. Playwright is more suitable for use in e2e test scenarios of multiple browsers and pages, and can provide more flexible test script writing and execution.

Only chrome/chromium is used in Neuron because it's the built-in webview of electron so the difference in browsers can be ignored.

Ref:

@silySuper
Copy link

1.In consideration of a great advantage between Cypress and PlayWright is PlayWright can test multiple browsers in parallel,but Cypress can not.If the difference in browsers can be ignored,Cypress may be the better choice.
2.I have tried to run some easy UI examples successfully through Cypress and PlayWright on my local computer,Cypress is easier for me to understand and use,beacause its documents is more detailed
3.I have found some good videos talking about Cypress Vs PlayWright ,introduce differences in detail
https://www.youtube.com/watch?v=fncL63KRA-0
https://www.youtube.com/watch?v=cixkQHNkoZ4

@Keith-CY
Copy link
Member Author

Keith-CY commented May 6, 2023

Let's make a decision. From the consideration above and the that we only care about chromium in practice, cypress should be a better choice.

@Keith-CY
Copy link
Member Author

Keith-CY commented May 6, 2023

@FrederLu
Copy link

Now we can schedule how and when to move e2e tests from https://github.com/nervosnetwork/neuron-automation to https://github.com/nervosnetwork/neuron/

Later, Neuron's E2E will be developed by using cypress.
First of all, familiarize yourself with and sort out the use cases in the https://github.com/nervosnetwork/neuron-automation warehouse. In theory, these use cases will be extended as long as the original functions of Neuron are not adjusted.
After sorting out the cases above, combine the characteristics of Cypress to sort out and output the automation cases.
https://github.com/nervosnetwork/neuron/ is Neuron's existing warehouse. It is more reasonable to open a new warehouse for the automation project later.

@littleLip520
Copy link

After reading the project, I think we need to consider the following points when writing a new project with cypress:

  1. The original project was written in JAVA and needs to be converted to JS, which requires some learning costs.
  2. Confirm whether the original page elements are available.
    --The latest submission code of the original project is more than half a year old, which is relatively long.
  3. Whether to start scripting at this stage.
    --neuron wallet will have a new UI soon, and the elements can be expected to change a lot. At this stage, starting automatic writing can predict that there will be a large amount of debugging work in the future (re-acquire elements)
  4. It is better to upgrade the structure of the project, such as doing a layering (page object layer, case layer, tool layer, etc).

@silySuper
Copy link

My suggestion is that we can split the task into several parts similar to test plan firstly ,then assign in QA team.

@Keith-CY
Copy link
Member Author

I prefer to add e2e inside https://github.com/nervosnetwork/neuron/ so each commit of developers will be tested by e2e.

test each commit can be achieved by github action between two repositories too, so it's OK to keep them separate.

The difference is that e2e inside neuron repo prevents merging if tests fail, while e2e triggered by neuron repo will not prevent it, only an alert will be reported.

@Danie0918 Danie0918 moved this from 🆕 New to 📋 Backlog in Neuron Nov 26, 2023
@Danie0918 Danie0918 moved this from 📋 Backlog to 📫Hold On in Neuron Nov 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
Status: 📫Hold On
Development

No branches or pull requests

4 participants