MCPcopy Create free account
hub / github.com/freeCodeCamp/freeCodeCamp / focusEditor

Function focusEditor

e2e/utils/editor.ts:7–23  ·  view source on GitHub ↗
({
  page,
  isMobile
}: {
  page: Page;
  isMobile: boolean;
})

Source from the content-addressed store, hash-verified

5};
6
7export const focusEditor = async ({
8 page,
9 isMobile
10}: {
11 page: Page;
12 isMobile: boolean;
13}) => {
14 if (isMobile) {
15 const codeBtn = page.getByRole('tab', { name: 'Code' });
16 // The outer div intercepts the click action of its children,
17 // preventing Playwright from verifying if the children actually receive the click.
18 // In reality, the children do receive the click, so we bypass that check here.
19 await codeBtn.click({ force: true });
20 }
21
22 await getEditors(page).focus();
23};
24
25export async function clearEditor({
26 page,

Calls 1

getEditorsFunction · 0.85

Tested by 1

completeChallengesFunction · 0.72