Skip to content

Comments

feat: Added tests for verifying course visibility options and schedule and details settings#162

Open
irin2811 wants to merge 6 commits intoopenedx:masterfrom
raccoongang:advanced-settings-tests
Open

feat: Added tests for verifying course visibility options and schedule and details settings#162
irin2811 wants to merge 6 commits intoopenedx:masterfrom
raccoongang:advanced-settings-tests

Conversation

@irin2811
Copy link
Contributor

Smoke tests:

  • Test course visibility in catalog: none, about and both behavior (case: not enroled student on a course)
    Regression tests:
  • Set pacing to instructor paced
  • Set pacing to self paced
  • Set start date and end date
  • Set start time and end time

irin2811 and others added 6 commits December 30, 2025 11:25
Added based Schedule and Details Tests:
- [TC_AUTHOR_106] Set pacing to instructor paced
[TC_AUTHOR_107] Set pacing to self paced
[TC_AUTHOR_108] Set start date and end date
move general api methods to separate file, fixing lint issues
Added tests for [TC_AUTHOR_109] Set start time and end time
Added tests
- [TC_AUTHOR_133] Check course visibility "both"
- add methods for advanced settings tests
- fix lint issues
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jan 26, 2026
@openedx-webhooks
Copy link

Thanks for the pull request, @irin2811!

This repository is currently maintained by @openedx/committers-cypress-e2e-tests.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@github-project-automation github-project-automation bot moved this to Needs Triage in Contributions Jan 26, 2026
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Ready for Review in Contributions Jan 27, 2026
@mphilbrick211 mphilbrick211 requested a review from a team January 27, 2026 21:24
Copy link
Contributor

@cmltaWt0 cmltaWt0 left a comment

Choose a reason for hiding this comment

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

Beautiful work! 💟

I like API-driven test setup - using direct API calls to configure course dates/pacing/visibility instead of clicking through UI is fast and reliable, searchReindex integration correctly triggers search reindex after visibility changes so the course catalog reflects updates, pages structure, test coverage, preserved skipped tests etc.
It's really solid PR.

Let's just consider my suggestions to make it even better.

export const getCsrfToken = () => cy.getAllCookies() // gets all cookies from browser
.then((allCookiesArray) => {
const csrfCookie = allCookiesArray.find( // filter by domain and cookie name
(cookieObj) => cookieObj.domain === getDomain()
Copy link
Contributor

Choose a reason for hiding this comment

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

You can get a cookie by name and specified domain.
https://docs.cypress.io/api/commands/getcookie

}

// Get CSRF token from cookies
export const getCsrfToken = () => cy.getAllCookies() // gets all cookies from browser
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we refactor cy.getCookie('csrftoken') in commands.js to have a single way of doing thing?

advancedSettings.courseVisibility(courseId, 'none')
.then(() => scheduleAndDetails.searchReindex(courseId))
// eslint-disable-next-line cypress/no-unnecessary-waiting
.then(() => cy.wait(2000)) // reduce flakiness
Copy link
Contributor

Choose a reason for hiding this comment

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

Either poll the search endpoint until the updated visibility takes effect, or at minimum make the wait duration configurable via an env var or constant so it can be tuned per environment (for really slow ones).

}))
}

searchReindex(courseId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a general helper that should not be coupled to scheduleAndDetails page.
Please move to to utility/helper.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

}

// Helper: Get an offset date from today
getDateWithOffset(daysAhead = 10) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The same as above. Please decouple from the current page and move to a shared helpers.

cy.visit(`${baseMFEURL}/learning/course/${courseId}/home`)

// Verify that the course content is accessible
cy.contains('Begin your course today').should('be.visible')
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a note for a future ourselves - do thing about localization.

let endDateTime
let startEnrollDateTime

before(function () {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we use arrow function consistently across the whole codebase?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd prefer to keep existing style for consistency with the current file, and suggest doing it in a separate refactor/formatting PR for making it consistently across the codebase

cy.clearCookies()
})

beforeEach(function () {
Copy link
Contributor

Choose a reason for hiding this comment

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

The same as above.

it.skip('Set pacing to instructor paced', () => {
import ScheduleAndDetails from '../../../pages/studio/settings/scheduleAndDetails'
import AboutCoursePage from '../../../pages/lms/courseAboutPage'
import { getCsrfToken } from '../../../support/apiHelpers'
Copy link
Contributor

Choose a reason for hiding this comment

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

Unused import.

scheduleAndDetails.setInstructorPaced(courseId)

// Verify the pacing is set to instructor paced
getCsrfToken().then((token) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

The test is importing the test helpers/infrastructure (getCsrfToken) directly rather than using it through the page objects.
Consider whether the pacing verification could be a method on the ScheduleAndDetails page object (e.g., verifyPacing(courseId, expectedSelfPaced)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

Status: Ready for Review

Development

Successfully merging this pull request may close these issues.

3 participants