mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-19 10:07:46 -05:00
refactor: remove some imports from to e2e (#58556)
This commit is contained in:
committed by
GitHub
parent
e876e1cea0
commit
4c7b0d2372
@@ -9,7 +9,7 @@ enum SuperBlockI18nKeys {
|
||||
// the key above is used to create the last word for superBlock titles used on
|
||||
// the map and window. e.g. 'Certification' in Responsive Web Design
|
||||
// Certification
|
||||
export const superBlocksWithoutLastWord = [
|
||||
const superBlocksWithoutLastWord = [
|
||||
SuperBlocks.RespWebDesign,
|
||||
SuperBlocks.CodingInterviewPrep,
|
||||
SuperBlocks.TheOdinProject,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { execSync } from 'child_process';
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { ChallengeData } from '../tools/challenge-editor/api/interfaces/challenge-data';
|
||||
|
||||
const failedUpdates = [
|
||||
{
|
||||
@@ -16,8 +15,8 @@ const failedUpdates = [
|
||||
];
|
||||
const storeKey = 'fcc-failed-updates';
|
||||
|
||||
function getCompletedIds(completedChallenges: ChallengeData[]): string[] {
|
||||
return completedChallenges.map((challenge: ChallengeData) => challenge.id);
|
||||
function getCompletedIds(completedChallenges: { id: string }[]): string[] {
|
||||
return completedChallenges.map(challenge => challenge.id);
|
||||
}
|
||||
test.use({ storageState: 'playwright/.auth/development-user.json' });
|
||||
|
||||
|
||||
@@ -1,22 +1,76 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import translations from '../client/i18n/locales/english/translations.json';
|
||||
import intro from '../client/i18n/locales/english/intro.json';
|
||||
|
||||
import { SuperBlockStage, superBlockStages } from '../shared/config/curriculum';
|
||||
import { superBlocksWithoutLastWord } from '../client/src/utils/superblock-map-titles';
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('/learn');
|
||||
});
|
||||
|
||||
const superBlocksWithLinks = [
|
||||
...superBlockStages[SuperBlockStage.Core],
|
||||
...superBlockStages[SuperBlockStage.Next],
|
||||
...superBlockStages[SuperBlockStage.English],
|
||||
...superBlockStages[SuperBlockStage.NextEnglish],
|
||||
...superBlockStages[SuperBlockStage.Professional],
|
||||
...superBlockStages[SuperBlockStage.Extra],
|
||||
...superBlockStages[SuperBlockStage.Legacy]
|
||||
const LANDING_PAGE_LINKS = [
|
||||
{
|
||||
slug: '2022/responsive-web-design',
|
||||
name: 'Responsive Web Design Certification'
|
||||
},
|
||||
{
|
||||
slug: 'javascript-algorithms-and-data-structures-v8',
|
||||
name: 'JavaScript Algorithms and Data Structures Certification'
|
||||
},
|
||||
{
|
||||
slug: 'front-end-development-libraries',
|
||||
name: 'Front End Development Libraries Certification'
|
||||
},
|
||||
{ slug: 'data-visualization', name: 'Data Visualization Certification' },
|
||||
{ slug: 'relational-database', name: 'Relational Database Certification' },
|
||||
{
|
||||
slug: 'back-end-development-and-apis',
|
||||
name: 'Back End Development and APIs Certification'
|
||||
},
|
||||
{ slug: 'quality-assurance', name: 'Quality Assurance Certification' },
|
||||
{
|
||||
slug: 'scientific-computing-with-python',
|
||||
name: 'Scientific Computing with Python Certification'
|
||||
},
|
||||
{
|
||||
slug: 'data-analysis-with-python',
|
||||
name: 'Data Analysis with Python Certification'
|
||||
},
|
||||
{ slug: 'information-security', name: 'Information Security Certification' },
|
||||
{
|
||||
slug: 'machine-learning-with-python',
|
||||
name: 'Machine Learning with Python Certification'
|
||||
},
|
||||
{
|
||||
slug: 'college-algebra-with-python',
|
||||
name: 'College Algebra with Python Certification'
|
||||
},
|
||||
{
|
||||
slug: 'full-stack-developer',
|
||||
name: 'Certified Full Stack Developer Curriculum'
|
||||
},
|
||||
{
|
||||
slug: 'a2-english-for-developers',
|
||||
name: 'A2 English for Developers (Beta) Certification'
|
||||
},
|
||||
{
|
||||
slug: 'b1-english-for-developers',
|
||||
name: 'B1 English for Developers (Beta) Certification'
|
||||
},
|
||||
{
|
||||
slug: 'foundational-c-sharp-with-microsoft',
|
||||
name: '(New) Foundational C# with Microsoft Certification'
|
||||
},
|
||||
{ slug: 'the-odin-project', name: 'The Odin Project - freeCodeCamp Remix' },
|
||||
{ slug: 'coding-interview-prep', name: 'Coding Interview Prep' },
|
||||
{ slug: 'project-euler', name: 'Project Euler' },
|
||||
{ slug: 'rosetta-code', name: 'Rosetta Code' },
|
||||
{
|
||||
slug: 'responsive-web-design',
|
||||
name: 'Legacy Responsive Web Design Challenges'
|
||||
},
|
||||
{
|
||||
slug: 'javascript-algorithms-and-data-structures',
|
||||
name: 'Legacy JavaScript Algorithms and Data Structures Certification'
|
||||
},
|
||||
{ slug: 'python-for-everybody', name: 'Legacy Python for Everybody' }
|
||||
];
|
||||
|
||||
test.describe('Map Component', () => {
|
||||
@@ -31,27 +85,16 @@ test.describe('Map Component', () => {
|
||||
page.getByText(translations.landing['interview-prep-heading'])
|
||||
).toBeVisible();
|
||||
const curriculumBtns = page.getByTestId('curriculum-map-button');
|
||||
await expect(curriculumBtns).toHaveCount(superBlocksWithLinks.length);
|
||||
|
||||
for (let i = 0; i < superBlocksWithLinks.length; i++) {
|
||||
const addLastWord = !Object.values(superBlocksWithoutLastWord).includes(
|
||||
superBlocksWithLinks[i]
|
||||
);
|
||||
|
||||
const name = addLastWord
|
||||
? `${intro[superBlocksWithLinks[i]].title} Certification`
|
||||
: intro[superBlocksWithLinks[i]].title;
|
||||
await expect(curriculumBtns).toHaveCount(23);
|
||||
|
||||
for (const { name, slug } of LANDING_PAGE_LINKS) {
|
||||
const superblockLink = page.getByRole('link', {
|
||||
exact: true,
|
||||
name
|
||||
});
|
||||
|
||||
await expect(superblockLink).toBeVisible();
|
||||
await expect(superblockLink).toHaveAttribute(
|
||||
'href',
|
||||
`/learn/${superBlocksWithLinks[i]}/`
|
||||
);
|
||||
await expect(superblockLink).toHaveAttribute('href', `/learn/${slug}/`);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { SuperBlocks } from '../shared/config/curriculum';
|
||||
import type { ListItem } from '../client/src/components/seo/';
|
||||
import metaTags from '../client/i18n/locales/english/meta-tags.json';
|
||||
|
||||
interface StructuredData {
|
||||
@@ -9,6 +8,23 @@ interface StructuredData {
|
||||
itemListElement: ListItem[];
|
||||
}
|
||||
|
||||
interface ListItem {
|
||||
'@type': string;
|
||||
position: number;
|
||||
item: {
|
||||
'@type': string;
|
||||
url: string;
|
||||
name: string;
|
||||
description: string;
|
||||
provider: {
|
||||
'@type': string;
|
||||
name: string;
|
||||
sameAs: string;
|
||||
nonprofitStatus: string;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('/');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user