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

Convert Playwright E2E tests to use global logins #7219

Open
jmcameron opened this issue Aug 24, 2023 · 1 comment
Open

Convert Playwright E2E tests to use global logins #7219

jmcameron opened this issue Aug 24, 2023 · 1 comment
Labels

Comments

@jmcameron
Copy link
Collaborator

Currently, the "beforeAll()" for each test file logs into the BHIMA instance. When starting the migration this seemed like the only way to do it. But I later discovered that you can do global setup (for logins). See https://playwright.dev/docs/test-global-setup-teardown. Reworking all tests to use global setup for logins should be relatively simple. Once the fix is determined for one test file, applying to all the others should be straightforward and done with a script. Note that the reference above shows how to do some of the tests with logins and some without (so we can test logging in).

@jmcameron
Copy link
Collaborator Author

jmcameron commented Feb 1, 2024

I started working on this but it does not appear to be easy. I could not get the "project" approach to work at all (nor sure why). I tried the other approach ('globalSetup') but ran into problems with it too. I'm not sure it can be done without significant restructing of the way pages are handled by functions in TestUtils and the test scripts. The key problem is how to save the 'page' object between each test file setups. Saving the global state seems to work.

I've decided to give up on this for now, but I've attached a gzip file with diffs from current master (8e534a6) to my current attempt. I've started with just trying (unsuccessfully) to get a demo target working: npm run test:e2e-cash

issue7219-diffs.txt.gz

Also, see video on using dependencies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant