In this video, we'll go with the basics of Winston logger and how to generate a log file for the Playwright.
In this video, the creator discusses the use of the Winston logger in test automation. The video starts by explaining how console.log is commonly used in test automation to track the progress and status of tests. However, when running test scripts in CI/CD pipelines or GitHub actions, relying solely on console logs may not be effective as the logs can be cleared or overwritten by other jobs.
To address this issue, the creator introduces the Winston logger, which is a simple and easy-to-implement logger for JavaScript. The creator demonstrates how to set up the logger by installing the Winston dependency through npm and creating a logger object with various options. The options include setting the log level (e.g., error, warning, info), specifying the transport (e.g., file or console), and configuring additional settings like file name, log size, maximum number of files, and colorization.
The logger object can then be used in place of console.log throughout the code. The creator shows an example of logging with different levels (e.g., info, warning) and demonstrates how the logs are stored in a file or displayed in the console, depending on the specified transport option. Finally, the creator mentions that in the next video, they will show how to use the logger in a base class or fixture.
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].