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

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

    test('should expand the block of the current challenge if it is saved in local storage', async ({
      page
    }) => {
      await page.addInitScript(() => {
        window.localStorage.setItem(
          'currentChallengeId',
          '660ee6e3a242da6bd579de69' // JS Pyramid Generator step 2
        );
      });

      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', 'true');
    });

    test('should expand the block of the most recently completed challenge', async ({
      page,
      isMobile,
      browserName
    }) => {
      test.setTimeout(20000);

      await page.goto('/learn/javascript-algorithms-and-data-structures-v8');

      // The first block is expanded by default
      await expect(
        page.getByRole('button', {
          name: 'Learn Introductory JavaScript by Building a Pyramid Generator'
        })
      ).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'
      );


Review comment (suggestion):
```suggestion
    test('should expand the block of the most recently viewed challenge', async ({
```
`currentChallengeId` is stored on challenge mount.

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

    test('should expand the block of the current challenge if it is saved in local storage', async ({
      page
    }) => {
      await page.addInitScript(() => {
        window.localStorage.setItem(
          'currentChallengeId',
          '660ee6e3a242da6bd579de69' // JS Pyramid Generator step 2
        );
      });

      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', 'true');
    });

    test('should expand the block of the most recently viewed challenge', async ({
      page
    }) => {
      test.setTimeout(20000);

      await page.goto('/learn/javascript-algorithms-and-data-structures-v8');

      // The first block is expanded by default
      await expect(
        page.getByRole('button', {
          name: 'Learn Introductory JavaScript by Building a Pyramid Generator'
        })
      ).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'
      );

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

      await expect(