openedx / frontend-app-learning

Front-end for the Open edX course experience, implemented using React and Paragon.
GNU Affero General Public License v3.0
46 stars 207 forks source link

feat: add functionality to see unit draft preview #1501

Closed KristinAoki closed 1 month ago

KristinAoki commented 1 month ago

Description

This PR adds a new route that supports unit preview and updates the iframe url to include a param to tell the backend that the content should be from the draft branch of the unit.

Supporting information

JIRA Ticket: AU-1067 🔒

The Preview environment has drifted a bit away from the live view. The particular thing I spotted was that all the unit content is in an iframe, and preview doesn’t. There are some visual differences too, like the size of navigation elements, the placement of the bottom-of-page Previous/Next buttons, etc.

Things still look fairly accurate, but if you’re testing javascript, it can be a big difference.

Testing instructions

  1. Open a course in Studio
  2. Publish an existing unit
  3. Make a change to the unit so that it is showing a draft version in Studio
  4. Click "View live"
  5. Confirm that the published version of unit is visible
  6. Confirm that preview is not in the URL
  7. Go back to the Studio page
  8. Click "Preview"
  9. Confirm that the draft version of the unit is visible
  10. Confirm that "preview" is at the beginning of the URL

    Other information

This PR is dependent on edx-platform PR #35687

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 98.23009% with 2 lines in your changes missing coverage. Please review.

Project coverage is 89.23%. Comparing base (2a58ad2) to head (81590b7). Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
src/courseware/course/Course.jsx 60.00% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1501 +/- ## ========================================== + Coverage 88.69% 89.23% +0.54% ========================================== Files 312 315 +3 Lines 5501 5545 +44 Branches 1365 1369 +4 ========================================== + Hits 4879 4948 +69 + Misses 605 581 -24 + Partials 17 16 -1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.