-
+
{t('footer.tax-exempt-status')}
{t('footer.mission-statement')}
{t('footer.donation-initiatives')}
@@ -27,163 +24,164 @@ function Footer(): JSX.Element {
-
{t('footer.trending-guides')}
-
+ {t('footer.trending-guides')}
+
+
- {/* the span elements were add so the link can be inline and its text would be the only active target */}
-
+ -
{t('trending:article0title')}
-
-
+
+ -
{t('trending:article1title')}
-
-
+
+ -
{t('trending:article2title')}
-
-
+
+ -
{t('trending:article3title')}
-
-
+
+ -
{t('trending:article4title')}
-
-
+
+ -
{t('trending:article5title')}
-
-
+
+ -
{t('trending:article6title')}
-
-
+
+ -
{t('trending:article7title')}
-
-
+
+ -
{t('trending:article8title')}
-
-
+
+ -
{t('trending:article9title')}
-
-
+
+ -
{t('trending:article10title')}
-
-
+
+ -
{t('trending:article11title')}
-
-
+
+ -
{t('trending:article12title')}
-
-
+
+ -
{t('trending:article13title')}
-
-
+
+ -
{t('trending:article14title')}
-
-
+
+ -
{t('trending:article15title')}
-
-
+
+ -
{t('trending:article16title')}
-
-
+
+ -
{t('trending:article17title')}
-
-
+
+ -
{t('trending:article18title')}
-
-
+
+ -
{t('trending:article19title')}
-
-
+
+ -
{t('trending:article20title')}
-
-
+
+ -
{t('trending:article21title')}
-
-
+
+ -
{t('trending:article22title')}
-
-
+
+ -
{t('trending:article23title')}
-
-
+
+ -
{t('trending:article24title')}
-
-
+
+ -
{t('trending:article25title')}
-
-
+
+ -
{t('trending:article26title')}
-
-
+
+ -
{t('trending:article27title')}
-
-
+
+ -
{t('trending:article28title')}
-
-
+
+ -
{t('trending:article29title')}
-
-
+
+
diff --git a/e2e/footer.spec.ts b/e2e/footer.spec.ts
index 074aa305789..48c38791429 100644
--- a/e2e/footer.spec.ts
+++ b/e2e/footer.spec.ts
@@ -2,6 +2,53 @@ import { test, expect } from '@playwright/test';
import translations from '../client/i18n/locales/english/translations.json';
import links from '../client/i18n/locales/english/links.json';
+const BOTTOM_LINKS = [
+ {
+ title: translations.footer.links.about,
+ href: links.footer['about-url']
+ },
+ {
+ title: translations.footer.links.alumni,
+ href: 'https://www.linkedin.com/school/free-code-camp/people/'
+ },
+ {
+ title: translations.footer.links['open-source'],
+ href: 'https://github.com/freeCodeCamp/'
+ },
+ {
+ title: translations.footer.links.shop,
+ href: links.footer['shop-url']
+ },
+ {
+ title: translations.footer.links.support,
+ href: links.footer['support-url']
+ },
+ {
+ title: translations.footer.links.sponsors,
+ href: links.footer['sponsors-url']
+ },
+ {
+ title: translations.footer.links.honesty,
+ href: links.footer['honesty-url']
+ },
+ {
+ title: translations.footer.links.coc,
+ href: links.footer['coc-url']
+ },
+ {
+ title: translations.footer.links.privacy,
+ href: links.footer['privacy-url']
+ },
+ {
+ title: translations.footer.links.tos,
+ href: links.footer['tos-url']
+ },
+ {
+ title: translations.footer.links.copyright,
+ href: links.footer['copyright-url']
+ }
+];
+
test.beforeEach(async ({ page }) => {
await page.goto('/');
});
@@ -34,7 +81,7 @@ test.describe('Footer Trending Guides section', () => {
).toBeVisible();
const articles = await page
- .getByTestId('trending-guides-articles')
+ .getByRole('list', { name: translations.footer['trending-guides'] })
.getByRole('link')
.all();
@@ -46,109 +93,21 @@ test.describe('Footer Trending Guides section', () => {
});
});
-test.describe('Footer bottom links', () => {
- test('should display correct link to about us page', async ({ page }) => {
- const link = page.getByRole('link', {
- name: translations.footer.links.about
- });
+test.describe('Footer bottom section', () => {
+ test('should display the content correctly', async ({ page, isMobile }) => {
+ if (isMobile) {
+ await expect(
+ page.getByRole('heading', {
+ name: translations.footer['our-nonprofit']
+ })
+ ).toBeVisible();
+ }
- await expect(link).toBeVisible();
- await expect(link).toHaveAttribute('href', links.footer['about-url']);
- });
+ for (const item of BOTTOM_LINKS) {
+ const link = page.getByRole('link', { name: item.title });
- test('should display correct link to alumni page', async ({ page }) => {
- const link = page.getByRole('link', {
- name: translations.footer.links.alumni
- });
-
- await expect(link).toBeVisible();
- await expect(link).toHaveAttribute(
- 'href',
- 'https://www.linkedin.com/school/free-code-camp/people/'
- );
- });
-
- test('should display correct link to open-source page', async ({ page }) => {
- const link = page.getByRole('link', {
- name: translations.footer.links['open-source']
- });
-
- await expect(link).toBeVisible();
- await expect(link).toHaveAttribute(
- 'href',
- 'https://github.com/freeCodeCamp/'
- );
- });
-
- test('should display correct link to shop', async ({ page }) => {
- const link = page.getByRole('link', {
- name: translations.footer.links.shop
- });
-
- await expect(link).toBeVisible();
- await expect(link).toHaveAttribute('href', links.footer['shop-url']);
- });
-
- test('should display correct link to support page', async ({ page }) => {
- const link = page.getByRole('link', {
- name: translations.footer.links.support
- });
-
- await expect(link).toBeVisible();
- await expect(link).toHaveAttribute('href', links.footer['support-url']);
- });
-
- test('should display correct link to sponsors page', async ({ page }) => {
- const link = page.getByRole('link', {
- name: translations.footer.links.sponsors
- });
-
- await expect(link).toBeVisible();
- await expect(link).toHaveAttribute('href', links.footer['sponsors-url']);
- });
-
- test('should display correct link to honesty page', async ({ page }) => {
- const link = page.getByRole('link', {
- name: translations.footer.links.honesty
- });
-
- await expect(link).toBeVisible();
- await expect(link).toHaveAttribute('href', links.footer['honesty-url']);
- });
-
- test('should display correct link to coc page', async ({ page }) => {
- const link = page.getByRole('link', {
- name: translations.footer.links.coc
- });
-
- await expect(link).toBeVisible();
- await expect(link).toHaveAttribute('href', links.footer['coc-url']);
- });
-
- test('should display correct link to privacy page', async ({ page }) => {
- const link = page.getByRole('link', {
- name: translations.footer.links.privacy
- });
-
- await expect(link).toBeVisible();
- await expect(link).toHaveAttribute('href', links.footer['privacy-url']);
- });
-
- test('should display correct link to tos page', async ({ page }) => {
- const link = page.getByRole('link', {
- name: translations.footer.links.tos
- });
-
- await expect(link).toBeVisible();
- await expect(link).toHaveAttribute('href', links.footer['tos-url']);
- });
-
- test('should display correct link to copyright page', async ({ page }) => {
- const link = page.getByRole('link', {
- name: translations.footer.links.copyright
- });
-
- await expect(link).toBeVisible();
- await expect(link).toHaveAttribute('href', links.footer['copyright-url']);
+ await expect(link).toBeVisible();
+ await expect(link).toHaveAttribute('href', item.href);
+ }
});
});