I have made a GitHub project published
Background
I have a Katalon Studio project VisualTestingInKatalonStudio. It is a visual testing tool for Web application, built on top of KatalonStudio. The tool takes screenshots of web pages, save them into .png files. I will execute the tool twice β before I change my Web Application Under Test, and after I changed it. The tool compares 2 sets of screenshots β the current screenshot against the previous one. It produces a concise report if it has detected any differences in the page views. I often use this tool when I upgrade/reconfigure my business Web application in production. One of my Katalon project based on the VisualTestingInKatalonStudio processes 800 URLs in 80 minutes without any human intervention. When I see the report telling me βNo Significant difference found in the 800 pages of your AUTβ, I am relieved. I get confident that I havenβt made any silly mistakes to the production service. This tool frees me from slavery labor of looking at a lot of URLs manually before/after system changes.
Problem to solve
When I execute a image comparison processing, I need to specify which set of previous screenshots to choose as the basis with which the current screenshots are compared against. The following image shows an example how the previous sets of screenshots are stored and accumulated in a VisualTesting project directory.
VisualTesting project
βββ Storage
β βββ CURA.chronos_capture
β β βββ CURA_DevelopmentEnv
β β βββ 20200628_231335
β β βββ 20200701_220844
β β βββ 20200704_071004
β β βββ CURA.visitSite
β β β βββ appointment.php%23summary.png
β β β βββ default%23appointment.png
β β β βββ home.png
β β β βββ profile.php%23login.png
β β β βββ revisited.png
β β β βββ γγγ.png
β β βββ material-metadata-bundle.json
The current version (1.19.5) of βVisualTestingInKatalonStudioβ has a test case script CURA/restorePreviousScreenshots. This selects one of the timestamp directories(yyyyMMdd_hhmmss). The default behavior is to choose the last previous set.
WebUI.callTestCase(findTestCase("Test Cases/VT/restorePreviousTSuiteResult"),
["STRATEGY":"last"])
Potentially the script can chose any other set if I specify the exact timestamp (e.g, 20200628_231335
) as:
WebUI.callTestCase(findTestCase("Test Cases/VT/restorePreviousTSuiteResult"),
["STRATEGY":"exactlyAtOrBefore", "timestamp":"20200628_231335" ])
However I do not want to edit CURA/restorePreviousScreenshots
script often. I would rather like to interactively visit the directories and select one from the GUI-rendered list.
So my question is: Is it possible to open File Chooser dialog in a Katalon Test Case?
Solution
In a test case script in Katalon Studio, I can use javax.swing.JFileChooser
to open a File Chooser.
Description
Just have a look at the sample test case script Test Cases/openJFileChooser
.