-
Notifications
You must be signed in to change notification settings - Fork 3
course/program enrollment dialog #2797
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
base: main
Are you sure you want to change the base?
Conversation
7c84159 to
36ea334
Compare
| courseRun(), | ||
| ) | ||
| const nextRunId = overrides.next_run_id ?? faker.helpers.arrayElement(runs).id | ||
| const nextRunId = has(overrides, "next_run_id") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the original version of this factory, it was impossible to specify null next_run_id, even thought that is possible via the api.
| } | ||
|
|
||
| const enrollment = { | ||
| enrollmentsList: () => `${API_BASE_URL}/api/v1/enrollments/`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We weren't using this; I removed the mock from some tests and they all still passed.
| */ | ||
| if (isNetworkError || !NO_RETRY_CODES.includes(status)) { | ||
| return failureCount < MAX_RETRIES | ||
| return failureCount < maxRetries |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We recently switched to using makeBrowserQueryClient in our tests, too.
In tests, we don't want any retries.
3586a6d to
7ac4d8e
Compare
af96251 to
a0c69f0
Compare
| // Check based on the actual enrollment status, not array position | ||
| if (course.enrollment?.status === EnrollmentStatus.Enrolled) { | ||
| expect(indicator).toHaveTextContent("Enrolled") | ||
| expect(indicator).toHaveTextContent(/^Enrolled$/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As originally written, a bunch of tests in this file passed irrespective of whether the text was "Enrolled" or "Not Enrolled". toHaveTextContent is only an exact match if you use regex to specify start/stop. If you pass a string, it just checks for inclusion.
| )?.id, | ||
| course: { id: courses[0].id, title: courses[0].title }, | ||
| }, | ||
| grades: [], // No grades = enrolled but not completed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notes:
- By default, enrollment factory creates a certificate. (We might want to revisit that choice.)
- Subsequent to fix dashboard card enrollment association and display #2792, the comment
grades: [], // No grades = enrolled but not completedis innacurate. The enrollment in this test SHOULD be "Completed" since it has a cert but no grades.
| // Override enrollments for this test | ||
| setMockResponse.get(urls.enrollment.enrollmentsList(), enrollments) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On main, this test was not behaving as intended.
- if you remove all enrollments and unset this mock, it still passes
- The enrollments were not being matched to the org because enrollment-level b2b props were missing
- The assertions still passed for aforementioned reason, namely
toHaveTextContent("Enrolled")was matching "Not Enrolled".
What are the relevant tickets?
Description (What does it do?)
Adds enrollment dialog
Screenshots (if appropriate):
Note
No formal mobile designs yet
How can this be tested?
Prerequisites: MIT Learn and MITxOnline integrated; for example, as described in the README. Additionally, set
NEXT_PUBLIC_MITX_ONLINE_LEGACY_BASE_URL=http://mitxonline.odl.local:8065/in your local frontend env file. When logged into Learn, you should be logged into MITxOnline frontend, too.Data Setup: Set up data in MITxOnline:
include_in_learn_catalogset to true../manage.py backpopulate_mitxonline_dataagainst your local mitxonline instance.Feature Flags:
enrollment-dashboardset to true in posthogproduct-page-courseset to true in posthogTesting:
http://open.odl.local/course/READABLE_IDand program product page athttp://open.odl.local/program/READABLE_ID; these pages have an "Enroll for Free" button that should now be functional.