Skip to content

And/add basic smoke tests#12

Merged
andrey-canon merged 11 commits intomainfrom
and/add-basic-smoke-tests
Sep 25, 2025
Merged

And/add basic smoke tests#12
andrey-canon merged 11 commits intomainfrom
and/add-basic-smoke-tests

Conversation

@andrey-canon
Copy link
Collaborator

Description

This PR introduces a complete suite of reusable Playwright-based smoke tests for validating core Open edX LMS functionality.

✅ Implemented Test Scripts

  • test_login_user.py: Confirms login works and dashboard loads.
  • test_view_course.py: Loads a specific course and verifies structure and content.
  • test_eox_plugins.py: Loops through /eox-*/eox-info endpoints and prints version metadata.
  • test_heartbeat.py: Simple check for availability of /heartbeat endpoint.
  • test_complete_multiplechoice_unit.py: Navigates to a unit, selects a multiple-choice option, and submits it.
  • test_register_user.py: Fills out the dynamic user registration form and asserts success.

browser = p.chromium.launch()
page = browser.new_page()

response = page.goto(f"{base_url.rstrip('/')}/heartbeat")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
response = page.goto(f"{base_url.rstrip('/')}/heartbeat")
response = page.goto(f"{base_url.rstrip('/')}/heartbeat?extended=true")

you could do this. And also the ingration test could check by different key of dict, other services like celery and forum. So we could have the info if those services are working as expected.

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the test wrong? the test just checks a 200 code status it doesn't matter the response itself so if the service is down the status code would be 200 no matter what but the status key would be false ?


- name: Install dependencies
run: |
pip install pytest-playwright

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you select playwright instead of selenium??

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And why do you select these tools that use Chromium instead of other tools like K6 or Locust (load testing tools)? To test the browser behavior??

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you select playwright instead of selenium??

Playwright was selected over Selenium primarily due to its modern architecture, improved reliability, and built-in tooling. Key reasons include:

  1. Launch and Modernity
  2. Browser Support
  3. Speed and Performance
  4. Handling Dynamic Content
  5. Setup and Ease of Use

Reference : https://www.browserstack.com/guide/playwright-vs-selenium

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And why do you select these tools that use Chromium instead of other tools like K6 or Locust (load testing tools)? To test the browser behavior??

Tools like K6 and Locust are excellent for load testing, but they are not suitable for browser-based functional validation. Here's why Playwright was chosen:

Goal mismatch:

  • K6/Locust simulate HTTP traffic and are ideal for performance/load testing (e.g., 1000 users hitting an API).
  • Playwright controls a real browser, making it ideal for verifying user experience, JavaScript execution, and UI behavior.
    React-based UI needs full rendering:
  • Open edX LMS relies heavily on client-side rendering and dynamic content.
  • Tools like K6/Locust don’t execute JavaScript, so they cannot validate DOM updates, modals, or SPA navigation

In short: Playwright tests browser behavior, while K6/Locust test backend load. The selected tool matches the functional validation goals.

Comment on lines 142 to 150
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install dependencies
run: |
pip install pytest-playwright
playwright install

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think there is a way to not repeat these steps? What are being used in all the jobs.?

Or maybe use some cache for python or something like that, at least to reduce the time of reconfiguring and installing Python and dependencies?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done cad5443

@andrey-canon andrey-canon force-pushed the and/add-basic-smoke-tests branch 2 times, most recently from e48a518 to 4a26397 Compare September 24, 2025 19:50
runs:
using: composite
steps:
- name: Set up Python

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add here a cache step like this.
https://github.com/nelc/eox-nelp/blob/76fdc2245533faa2a5f6f34fdd5476854dc706f4/.github/workflows/tests.yml#L22-L32

Also we could add a integration requirements file to add eg pytest-playwright. And try to dont reconfigure python and the pip requirement for each test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@andrey-canon andrey-canon force-pushed the and/add-basic-smoke-tests branch from cc50737 to 94d50b9 Compare September 24, 2025 22:36
@@ -0,0 +1 @@
pytest-playwright

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please pin to a version to manage the hit or not of the cache. =)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This version cannot be pin for two reason

  1. python version is variable so we cannot ensure that the pinned version will be compatible with all the python versions
  2. Pinned versions are just useful when there are conflicts and pip should install the last available version compatible with the current version

The cache is handled by the python version if that changes the cache shouldn't return anything

@andrey-canon andrey-canon force-pushed the and/add-basic-smoke-tests branch from 94d50b9 to 057d484 Compare September 24, 2025 22:49
@johanseto johanseto self-requested a review September 25, 2025 21:41
Copy link

@johanseto johanseto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a little of doubt about the cache behavior, but let's test it going forward.

@andrey-canon andrey-canon merged commit 832b844 into main Sep 25, 2025
2 checks passed
@andrey-canon andrey-canon deleted the and/add-basic-smoke-tests branch September 25, 2025 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants