Skip to content

Commit a1c5e08

Browse files
authored
fix(tests): disable dc e2e tests (freeCodeCamp#66357)
1 parent 9362039 commit a1c5e08

1 file changed

Lines changed: 40 additions & 39 deletions

File tree

e2e/daily-coding-challenge.spec.ts

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { test, expect, type Page } from '@playwright/test';
2-
import * as fs from 'fs';
1+
import { test, expect } from '@playwright/test';
32
import {
43
getTodayUsCentral,
54
formatDate,
@@ -66,14 +65,15 @@ const mockApiAllChallenges = [
6665

6766
const mockDaysInMonth = new Date(year, month, 0).getDate();
6867

69-
const runChallengeTest = async (page: Page, isMobile: boolean) => {
70-
if (isMobile) {
71-
await page.getByRole('tab', { name: 'Console' }).click();
72-
await page.getByText('Run').click();
73-
} else {
74-
await page.getByText('Run the Tests (Ctrl + Enter)').click();
75-
}
76-
};
68+
// Temporarily disabled
69+
// const runChallengeTest = async (page: Page, isMobile: boolean) => {
70+
// if (isMobile) {
71+
// await page.getByRole('tab', { name: 'Console' }).click();
72+
// await page.getByText('Run').click();
73+
// } else {
74+
// await page.getByText('Run the Tests (Ctrl + Enter)').click();
75+
// }
76+
// };
7777

7878
test.describe('Daily Coding Challenges', () => {
7979
test('should redirect to archive for invalid date', async ({ page }) => {
@@ -268,32 +268,33 @@ test.describe('Daily Coding Challenge Archive', () => {
268268
});
269269
});
270270

271-
test.describe('Daily code challenge solution can be downloaded', () => {
272-
test('Downloaded solution files are named by challenge number', async ({
273-
page,
274-
isMobile
275-
}) => {
276-
await page.route(/.*\/daily-coding-challenge\/date\/.*/, async route => {
277-
await route.fulfill({
278-
status: 200,
279-
headers: { 'Content-Type': 'application/json' },
280-
json: mockApiChallenge
281-
});
282-
});
283-
284-
await page.goto(`/learn/daily-coding-challenge/${todayUsCentral}`);
285-
await runChallengeTest(page, isMobile);
286-
await expect(page.getByRole('dialog')).toBeVisible({ timeout: 15000 });
287-
await expect(
288-
page.getByRole('link', { name: 'Download my solution' })
289-
).toBeVisible({ timeout: 15000 });
290-
const [download] = await Promise.all([
291-
page.waitForEvent('download'),
292-
page.getByRole('link', { name: 'Download my solution' }).click()
293-
]);
294-
const suggestedFileName = download.suggestedFilename();
295-
await download.saveAs(suggestedFileName);
296-
expect(fs.existsSync(suggestedFileName)).toBeTruthy();
297-
expect(suggestedFileName).toBe('challenge-1.txt');
298-
});
299-
});
271+
// Temporarily disabled
272+
// test.describe('Daily code challenge solution can be downloaded', () => {
273+
// test('Downloaded solution files are named by challenge number', async ({
274+
// page,
275+
// isMobile
276+
// }) => {
277+
// await page.route(/.*\/daily-coding-challenge\/date\/.*/, async route => {
278+
// await route.fulfill({
279+
// status: 200,
280+
// headers: { 'Content-Type': 'application/json' },
281+
// json: mockApiChallenge
282+
// });
283+
// });
284+
285+
// await page.goto(`/learn/daily-coding-challenge/${todayUsCentral}`);
286+
// await runChallengeTest(page, isMobile);
287+
// await expect(page.getByRole('dialog')).toBeVisible({ timeout: 15000 });
288+
// await expect(
289+
// page.getByRole('link', { name: 'Download my solution' })
290+
// ).toBeVisible({ timeout: 15000 });
291+
// const [download] = await Promise.all([
292+
// page.waitForEvent('download'),
293+
// page.getByRole('link', { name: 'Download my solution' }).click()
294+
// ]);
295+
// const suggestedFileName = download.suggestedFilename();
296+
// await download.saveAs(suggestedFileName);
297+
// expect(fs.existsSync(suggestedFileName)).toBeTruthy();
298+
// expect(suggestedFileName).toBe('challenge-1.txt');
299+
// });
300+
// });

0 commit comments

Comments
 (0)