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

Code before:
        })
      ).toHaveAttribute('aria-expanded', 'true');

      await expect(
        page.getByRole('button', {
          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

Review comment (suggestion):
```suggestion
```
Challenge completion doesn't affect `currentChallengeId` except that it causes you to visit another challenge and we already do that.

Code after:
        page.getByRole('button', {
          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'
      );

      // 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
        })