fix(tests): disable dc e2e tests (#66357)

This commit is contained in:
Tom
2026-03-10 17:31:53 -05:00
committed by GitHub
parent 9362039fce
commit a1c5e08728
+39 -38
View File
@@ -1,5 +1,4 @@
import { test, expect, type Page } from '@playwright/test'; import { test, expect } from '@playwright/test';
import * as fs from 'fs';
import { import {
getTodayUsCentral, getTodayUsCentral,
formatDate, formatDate,
@@ -66,14 +65,15 @@ const mockApiAllChallenges = [
const mockDaysInMonth = new Date(year, month, 0).getDate(); const mockDaysInMonth = new Date(year, month, 0).getDate();
const runChallengeTest = async (page: Page, isMobile: boolean) => { // Temporarily disabled
if (isMobile) { // const runChallengeTest = async (page: Page, isMobile: boolean) => {
await page.getByRole('tab', { name: 'Console' }).click(); // if (isMobile) {
await page.getByText('Run').click(); // await page.getByRole('tab', { name: 'Console' }).click();
} else { // await page.getByText('Run').click();
await page.getByText('Run the Tests (Ctrl + Enter)').click(); // } else {
} // await page.getByText('Run the Tests (Ctrl + Enter)').click();
}; // }
// };
test.describe('Daily Coding Challenges', () => { test.describe('Daily Coding Challenges', () => {
test('should redirect to archive for invalid date', async ({ page }) => { test('should redirect to archive for invalid date', async ({ page }) => {
@@ -268,32 +268,33 @@ test.describe('Daily Coding Challenge Archive', () => {
}); });
}); });
test.describe('Daily code challenge solution can be downloaded', () => { // Temporarily disabled
test('Downloaded solution files are named by challenge number', async ({ // test.describe('Daily code challenge solution can be downloaded', () => {
page, // test('Downloaded solution files are named by challenge number', async ({
isMobile // page,
}) => { // isMobile
await page.route(/.*\/daily-coding-challenge\/date\/.*/, async route => { // }) => {
await route.fulfill({ // await page.route(/.*\/daily-coding-challenge\/date\/.*/, async route => {
status: 200, // await route.fulfill({
headers: { 'Content-Type': 'application/json' }, // status: 200,
json: mockApiChallenge // headers: { 'Content-Type': 'application/json' },
}); // json: mockApiChallenge
}); // });
// });
await page.goto(`/learn/daily-coding-challenge/${todayUsCentral}`); // await page.goto(`/learn/daily-coding-challenge/${todayUsCentral}`);
await runChallengeTest(page, isMobile); // await runChallengeTest(page, isMobile);
await expect(page.getByRole('dialog')).toBeVisible({ timeout: 15000 }); // await expect(page.getByRole('dialog')).toBeVisible({ timeout: 15000 });
await expect( // await expect(
page.getByRole('link', { name: 'Download my solution' }) // page.getByRole('link', { name: 'Download my solution' })
).toBeVisible({ timeout: 15000 }); // ).toBeVisible({ timeout: 15000 });
const [download] = await Promise.all([ // const [download] = await Promise.all([
page.waitForEvent('download'), // page.waitForEvent('download'),
page.getByRole('link', { name: 'Download my solution' }).click() // page.getByRole('link', { name: 'Download my solution' }).click()
]); // ]);
const suggestedFileName = download.suggestedFilename(); // const suggestedFileName = download.suggestedFilename();
await download.saveAs(suggestedFileName); // await download.saveAs(suggestedFileName);
expect(fs.existsSync(suggestedFileName)).toBeTruthy(); // expect(fs.existsSync(suggestedFileName)).toBeTruthy();
expect(suggestedFileName).toBe('challenge-1.txt'); // expect(suggestedFileName).toBe('challenge-1.txt');
}); // });
}); // });