Repository: oppia/oppia
File: core/tests/puppeteer-acceptance-tests/utilities/user/logged-in-user.ts (TypeScript)

Code before:
    await this.expectGoalToBePresent(goal, completedGoalsSection);
  }

  /**
   * Function to verify the learn something new section in the redesigned learner dashboard.
   * @param {boolean} visible - Whether the section should be visible or not.
   */
  async expectLearnSomethingNewSectionInRedesignedDashboardToBePresent(
    visible: boolean = true
  ): Promise<void> {
    await this.expectElementToBeVisible(
      learnSomethingNewSectionSelector,
      visible
    );
  }

  /**
   * Function to verify that a specific chapter is present in the Learn Something New section.
   * @param {string} chapterTitle - The title of the chapter to verify.
   */
  async expectChapterToBePresentInLearnSomethingNewSection(
    chapterTitle: string
  ): Promise<void> {
    await this.page.waitForSelector(learnSomethingNewSectionSelector, {
      visible: true,
    });
    const learnSomethingNewSection = await this.page.$(
      learnSomethingNewSectionSelector
    );
    if (!learnSomethingNewSection) {
      throw new Error('Learn Something New section not found.');
    }
    await this.expectLessonCardToBePresent(
      chapterTitle,
      learnSomethingNewSection
    );
  }

  /**
   * Function to verify the continue from where you left section in the redesigned learner dashboard is present or not.
   * @param {boolean} visible - Whether the section should be visible or not.
   */
  async expectContinueFromWhereYouLeftSectionInRedesignedDashboardToBePresent(
    visible: boolean = true
  ): Promise<void> {
    await this.expectElementToBeVisible(
      continueFromWhereLeftOffSectionInRedesignedDashboardSelector,
      visible
    );
  }


Review comment (suggestion):
You can use `expectElementTOBeVisible`. It's a common method we have created. It helps missing `visible: true` which is essential. Your approch is correct as you have added the same, but let's have consistent behaviour across the codebase.

Code after:
  async expectLearnSomethingNewSectionInRedesignedDashboardToBePresent(
    visible: boolean = true
  ): Promise<void> {
    await this.expectElementToBeVisible(
      learnSomethingNewSectionSelector,
      visible
    );
  }

  /**
   * Function to verify that a specific chapter is present in the Learn Something New section.
   * @param {string} chapterTitle - The title of the chapter to verify.
   */
  async expectChapterToBePresentInLearnSomethingNewSection(
    chapterTitle: string
  ): Promise<void> {
    await this.expectElementToBeVisible(learnSomethingNewSectionSelector);
    // Wait for lesson cards to load if they exist.
    try {
      await this.page.waitForSelector(lessonCardContainer, {
        visible: true,
        timeout: 5000,
      });
    } catch (error) {
      // Lesson cards may not be present if section is empty (no untracked topics).
      // This is expected for new users.
      showMessage(
        'Learn Something New section is empty (no lesson cards found). This is expected for new users.'
      );
      return;
    }
    const learnSomethingNewSection = await this.page.$(
      learnSomethingNewSectionSelector
    );
    if (!learnSomethingNewSection) {
      throw new Error('Learn Something New section not found.');
    }
    await this.expectLessonCardToBePresent(
      chapterTitle,
      learnSomethingNewSection
    );
  }

  /**
   * Function to verify the continue from where you left section in the redesigned learner dashboard is present or not.
   * @param {boolean} visible - Whether the section should be visible or not.
   */
  async expectContinueFromWhereYouLeftSectionInRedesignedDashboardToBePresent(
    visible: boolean = true
  ): Promise<void> {
    await this.expectElementToBeVisible(