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

Function completeChallenges

e2e/donation-modal.spec.ts:85–109  ·  view source on GitHub ↗
({
  page,
  browserName,
  isMobile,
  number
}: {
  page: Page;
  browserName: string;
  isMobile: boolean;
  number: number;
})

Source from the content-addressed store, hash-verified

83];
84
85const completeChallenges = async ({
86 page,
87 browserName,
88 isMobile,
89 number
90}: {
91 page: Page;
92 browserName: string;
93 isMobile: boolean;
94 number: number;
95}) => {
96 await page.goto(challenges[0].url);
97 for (const challenge of challenges.slice(0, number)) {
98 await page.waitForURL(allowTrailingSlash(challenge.url));
99 await focusEditor({ page, isMobile });
100 await clearEditor({ page, browserName });
101 await page.evaluate(
102 async contents => await navigator.clipboard.writeText(contents),
103 challenge.solution
104 );
105 await page.keyboard.press('ControlOrMeta+V');
106 await page.getByRole('button', { name: 'Check Your Code' }).click();
107 await page.getByRole('button', { name: 'Submit and continue' }).click();
108 }
109};
110
111test.skip(
112 ({ browserName }) => browserName !== 'chromium',

Callers 1

Calls 3

allowTrailingSlashFunction · 0.90
focusEditorFunction · 0.90
clearEditorFunction · 0.90

Tested by

no test coverage detected