Repository: freeCodeCamp/freeCodeCamp
File: e2e/super-block-page.spec.ts (TypeScript)

Code before:
          name: 'Learn Basic JavaScript by Building a Role Playing Game'
        })
      ).toHaveAttribute('aria-expanded', 'false');

      await page.goto(
        '/learn/javascript-algorithms-and-data-structures-v8/learn-basic-javascript-by-building-a-role-playing-game/step-2'
      );

      const editor = getEditors(page);
      await focusEditor({ page, isMobile });
      await clearEditor({ page, browserName });
      await editor.fill('<script></script>');
      await page.getByRole('button', { name: /check your code/i }).click();
      await page.getByRole('button', { name: /submit and go/i }).click();

      // The submit button navigates user to the next challenge.
      // Allow that navigation to complete before going back to the super block page.
      await page.waitForURL(
        '/learn/javascript-algorithms-and-data-structures-v8/learn-basic-javascript-by-building-a-role-playing-game/step-3'
      );

      // Go back to the super block page
      await page.goto('/learn/javascript-algorithms-and-data-structures-v8');

      await expect(
        page.getByRole('button', {
          name: 'Learn Introductory JavaScript by Building a Pyramid Generator'
        })
      ).toHaveAttribute('aria-expanded', 'false');

      await expect(
        page.getByRole('button', {
          name: 'Learn Basic JavaScript by Building a Role Playing Game'
        })
      ).toHaveAttribute('aria-expanded', 'true');
    });
  });

  test.describe('Super Block in Accordion View', () => {
    test.skip(
      () => process.env.SHOW_UPCOMING_CHANGES !== 'true',
      'The FSD superblock is not available if SHOW_UPCOMING_CHANGES is false'
    );

    test('should expand the correct block when user goes to the page from breadcrumb click', async ({
      page
    }) => {
      await page.goto(`/learn/full-stack-developer/workshop-cafe-menu/step-2`);

      await page
        .getByRole('link', {

Review comment (bug):
Skipped if `SHOW_UPCOMING_CHANGES !== true` so that the tests won't fail in CI, but it's still possible to run the tests locally.

I have created #57506 to track the removable of `test.skip()`.

Code after:
      await page.goto(
        '/learn/javascript-algorithms-and-data-structures-v8/learn-basic-javascript-by-building-a-role-playing-game/step-2'
      );

      // Go back to the super block page
      await page.goto('/learn/javascript-algorithms-and-data-structures-v8');

      await expect(
        page.getByRole('button', {
          name: 'Learn Introductory JavaScript by Building a Pyramid Generator'
        })
      ).toHaveAttribute('aria-expanded', 'false');

      await expect(
        page.getByRole('button', {
          name: 'Learn Basic JavaScript by Building a Role Playing Game'
        })
      ).toHaveAttribute('aria-expanded', 'true');
    });
  });

  test.describe('Super Block in Accordion View', () => {
    test.skip(
      () => process.env.SHOW_UPCOMING_CHANGES !== 'true',
      'The FSD superblock is not available if SHOW_UPCOMING_CHANGES is false'
    );

    test('should expand the correct block when user goes to the page from breadcrumb click', async ({
      page
    }) => {
      await page.goto(`/learn/full-stack-developer/workshop-cafe-menu/step-2`);

      await page
        .getByRole('link', {
          name: 'Design a Cafe Menu'
        })
        .click();

      await page.waitForURL('/learn/full-stack-developer/#workshop-cafe-menu');

      // Chapter
      await expect(
        page.getByRole('button', {
          name: 'CSS',
          exact: true
        })
      ).toHaveAttribute('aria-expanded', 'true');

      // Module
      await expect(
        page.getByRole('button', {