ExuApplePie opened a new pull request, #36297:
URL: https://github.com/apache/superset/pull/36297

   <!---
   Please write the PR title following the conventions at 
https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   This PR includes new functionality to run a suite of tests using Playwright 
in order to take screenshots of the UI so that the docs will have up to date 
screenshots.
   
   The first changes made are to the `playwright.config.ts` along with a new 
fijle `auth.setup.ts`. Using these two files, I defined two new projects so 
that our tests do not need to go through the login screen every time. For the 
authentication setup, I just hard coded the default admin/admin login as I was 
not sure if there is an env variable to handle this. The authentication is then 
stored in `\superset\superset-frontend\playwright\.auth`, which was also added 
to the `.gitignore`. Then our second project from the config file is set to 
depend on the auth file, so it is always run before our project. In addition, I 
set a `testMatch` and `testIgnore` property, so that only these tests will use 
the authentication, and the already existing E2E tests will still have the 
functionality to test login. 
   
   The 'tests' that take the screenshots are written in 
`\superset\superset-frontend\playwright\tests\docs\docs-screenshots.spec.ts`. 
Each test navigates to the content I want to screenshot, sometimes may zoom out 
for a nicer screenshot, then will wait a a few seconds to ensure the page has 
fully loaded, then finally will take a screenshot as a JPEG and save it to 
`\superset\docs\static\img\screenshots` folder. 
   
   The tests try to use locators that are easy to read/understand, and are 
resilient to changes. For example, instead of using a CSS path, I try to locate 
a combobox with some name property. I used the non-development environment for 
these screenshots. It also seemed like some of the locators didn't exist in the 
development version of Superset. Please do note that if there are major UI 
overhauls, it is likely that these tests will have to be re-written. 
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   N/A
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   Aside from verifying the files exist at the paths mentioned earlier, you can 
run the tests by using the command `npx playwright test 
--project=chromium-authenticated` in the superset-frontend directory.
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to