Hi All, I've been testing the playwright testing framework as suggested, and here are my observations:
1. The underlying principle for playwright is very different from what we have in Phantomjs. 2. Community support for integrating playwright with karma is not at all available. 3. If we choose playwright as the replacement of Phantomjs, we will have to make a lot of changes and there is a possibility of rewriting all the test cases. I analyzed the code further to see if we can avoid rewriting the test cases. As I can see in the code, the UI is using karma and Phantomjs. Karma is a test runner that allows you to run JavaScript unit and end-to-end tests in a headless browser. Phantomjs is a headless browser that can be used to automate web applications. We need to replace Phantomjs with a library that can perform the same functionality as phantom. Recently, Google launched ChromeHeadless which can act as a great substitute for phantom-js-launcher like behavior. I suggest using karma to open up ChromeHeadless instance and utilizing its full potential, completely eliminating the use of phantomjs. Here are the benefits of using ChromeHeadless: It is a headless version of Chrome, so it can be used to automate web applications without the need for a graphical user interface. It is very fast, so it can be used to run tests quickly. It is supported by the karma test runner, so we can use it to run our existing test cases without having to rewrite them. I believe that this is the best way to move forward with our testing framework. It will allow us to keep our existing test cases, while also taking advantage of the benefits of ChromeHeadless. Please let me know if you have any suggestions regarding the suggested approach. Thanks Vanshu Hassija On 17/07/23, 5:04 PM, "Sharma, Vivek" <vivsh...@visa.com.inva <mailto:vivsh...@visa.com.inva>LID> wrote: Hi Vanshu, Thanks for starting this thread! I would also like to bring Playwright into the discussion - https://playwright.dev/ <https://playwright.dev/> and https://github.com/microsoft/playwright <https://github.com/microsoft/playwright> * Playwright has gained a lot of traction over the last few years and is a modern tool for UI automation of web apps. It is backed by Microsoft and has a fairly regular release cadence * Supports APIs in Node.js, Java, Python, .NET * Browser support includes Chromium, Firefox, WebKit (Safari), Chrome and Edge * Supports headless and headed modes on all browsers and platforms: Windows, Linux, Mac * It can hook easily with Test Runners like JUnit, TestNG, thereby enabling features of test runners like Before/After annotations, parallel tests, ability to rerun failed tests * Provides debugging capabilities such as traceviewer to check sequence of test actions, state of the page before and after the action Thanks, Vivek Sharma On 14/07/23, 1:52 PM, "Hassija, Vanshu" <vhass...@visa.com.inva <mailto:vhass...@visa.com.inva> <mailto:vhass...@visa.com.inva <mailto:vhass...@visa.com.inva>>LID> wrote: Hello all, During our ongoing efforts to upgrade libraries to their latest versions, we have discovered that ambari-web currently relies on PhantomJS as the testing framework. However, we have encountered a significant issue: PhantomJS has been deprecated, and the last available version lacks support for ES6 features. As this package is no longer maintained, it is unlikely to receive future updates that introduce new JavaScript functionalities. To address this concern, we have evaluated various alternatives and have determined that transitioning from PhantomJS to Puppeteer would be the most beneficial course of action. * Puppeteer is a powerful Node.js library developed by the Chrome team at Google. It offers a high-level API for automating headless Chrome or Chromium instances, enabling seamless interaction with web pages, automated testing, and data scraping. * By embracing Puppeteer, we can leverage a modern and actively maintained tool that fully supports ES6 and provides a wide range of features. * Some notable advantages include: Full ES6 Support: Puppeteer enables the use of the latest JavaScript updates, ensuring compatibility with future updates and language enhancements. Robust Feature Set: Puppeteer offers powerful debugging capabilities, screenshot generation, and PDF rendering, making it a versatile choice for web automation tasks. Extensive Documentation and Community Support: Puppeteer benefits from comprehensive documentation and a thriving community, providing reliable resources and assistance for developers. While Puppeteer offers numerous benefits, we also want to address some potential challenges and limitations associated with it: * Increased Code Complexity: Transitioning to Puppeteer may require significant code changes and a learning curve for developers unfamiliar with the library. * Performance Impact: Running Puppeteer tests can be resource-intensive and may have an impact on overall test execution time. On the other hand, we have also considered another popular testing framework called Cypress, which offers the following advantages: * Simplified API: Cypress provides a clean and intuitive API that simplifies test creation and maintenance. * Real-Time Reloads: Cypress offers real-time reloads while editing tests, making the development and debugging process more efficient. However, based on our experimentation and evaluation, we have found Puppeteer to be particularly well-suited for our requirements and the future of ambari-web. To ensure we make an informed decision, we welcome your input and suggestions. If you have any alternative frameworks in mind or insights about Puppeteer, Cypress, or any other relevant tools, please feel free to share them with us. We value your expertise and contributions to the open source community. Thanks Vanshu Hassija