* refactor early access breadcrumbs * Update permissions metadata to include users and teams with explicit access * Inform users of permission requirement for dependabot alerts * Apply suggestions from code review * version previews (#26571) * update search indexes * New translation batch for pt (#26591) * Add crowdin translations * Run script/i18n/homogenize-frontmatter.js * Run script/i18n/fix-translation-errors.js * Run script/i18n/lint-translation-files.js --check rendering * run script/i18n/reset-files-with-broken-liquid-tags.js --language=pt * run script/i18n/reset-known-broken-translation-files.js * Update subcategories for Codespaces (#25812) * Version actions for GHES, use reusables (#26004) Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com> Co-authored-by: Sarah Edwards <skedwards88@github.com> * New translation batch for ja (#26599) * Add crowdin translations * Run script/i18n/homogenize-frontmatter.js * Run script/i18n/lint-translation-files.js --check rendering * run script/i18n/reset-files-with-broken-liquid-tags.js --language=ja * run script/i18n/reset-known-broken-translation-files.js * Check in ja CSV report Co-authored-by: Grace Park <gracepark@github.com> * New translation batch for cn (#26598) * Add crowdin translations * Run script/i18n/homogenize-frontmatter.js * Run script/i18n/lint-translation-files.js --check rendering * run script/i18n/reset-files-with-broken-liquid-tags.js --language=cn * run script/i18n/reset-known-broken-translation-files.js * Check in cn CSV report Co-authored-by: Grace Park <gracepark@github.com> * New translation batch for es (#26597) * Add crowdin translations * Run script/i18n/homogenize-frontmatter.js * Run script/i18n/fix-translation-errors.js * Run script/i18n/lint-translation-files.js --check rendering * run script/i18n/reset-files-with-broken-liquid-tags.js --language=es * run script/i18n/reset-known-broken-translation-files.js * Check in es CSV report Co-authored-by: Grace Park <gracepark@github.com> * update search indexes * Rename xxtest-devcontainer.json to devcontainer.json * Delete .devcontainer/java-environment directory * Delete .devcontainer/ruby-environment directory * Update development.md * Update CONTRIBUTING.md * Add link to troubleshooting (#26514) * update search indexes * fix old tests Co-authored-by: Anthony Swierkosz <anthony@swierkosz.dev> Co-authored-by: mc <42146119+mchammer01@users.noreply.github.com> Co-authored-by: Sarah Edwards <skedwards88@github.com> Co-authored-by: GitHub Actions <action@github.com> Co-authored-by: docubot <67483024+docubot@users.noreply.github.com> Co-authored-by: Brian McManus <bdmac@github.com> Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com> Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com> Co-authored-by: Grace Park <gracepark@github.com> Co-authored-by: hubwriter <hubwriter@github.com>
223 lines
8.6 KiB
JavaScript
223 lines
8.6 KiB
JavaScript
import { jest } from '@jest/globals'
|
|
|
|
import { getDOM, getJSON } from '../helpers/e2etest.js'
|
|
|
|
// TODO: Use `describeViaActionsOnly` instead. See tests/rendering/server.js
|
|
const describeInternalOnly =
|
|
process.env.GITHUB_REPOSITORY === 'github/docs-internal' ? describe : describe.skip
|
|
// Breadcrumbs were moved to the Header and in the Menu for mobile, so there are now double the Breadcrumbs
|
|
describe('breadcrumbs', () => {
|
|
jest.setTimeout(300 * 1000)
|
|
|
|
describe('rendering', () => {
|
|
test('top-level product pages have breadcrumbs', async () => {
|
|
const $ = await getDOM('/github')
|
|
expect($('[data-testid=breadcrumbs]')).toHaveLength(2)
|
|
})
|
|
|
|
test('article pages have breadcrumbs with product, category, maptopic, and article', async () => {
|
|
const $ = await getDOM(
|
|
'/account-and-profile/setting-up-and-managing-your-github-user-account/managing-email-preferences/adding-an-email-address-to-your-github-account'
|
|
)
|
|
const $breadcrumbs = $('[data-testid=breadcrumbs] a')
|
|
|
|
expect($breadcrumbs).toHaveLength(8)
|
|
expect($breadcrumbs[0].attribs.title).toBe('Account and profile')
|
|
expect($breadcrumbs[1].attribs.title).toBe('User accounts')
|
|
expect($breadcrumbs[2].attribs.title).toBe('Manage email preferences')
|
|
expect($breadcrumbs[3].attribs.title).toBe('Add an email address')
|
|
})
|
|
|
|
test('maptopic pages include their own grayed-out breadcrumb', async () => {
|
|
const $ = await getDOM(
|
|
'/account-and-profile/setting-up-and-managing-your-github-user-account/managing-email-preferences'
|
|
)
|
|
const $breadcrumbs = $('[data-testid=breadcrumbs] a')
|
|
|
|
expect($breadcrumbs).toHaveLength(6)
|
|
expect($breadcrumbs[0].attribs.title).toBe('Account and profile')
|
|
expect($breadcrumbs[1].attribs.title).toBe('User accounts')
|
|
expect($breadcrumbs[2].attribs.title).toBe('Manage email preferences')
|
|
expect($breadcrumbs[2].attribs.class.includes('color-fg-muted')).toBe(true)
|
|
})
|
|
|
|
test('works for enterprise user pages', async () => {
|
|
const $ = await getDOM(
|
|
'/en/enterprise-server/account-and-profile/setting-up-and-managing-your-github-user-account/managing-email-preferences/adding-an-email-address-to-your-github-account'
|
|
)
|
|
const $breadcrumbs = $('[data-testid=breadcrumbs] a')
|
|
expect($breadcrumbs).toHaveLength(8)
|
|
expect($breadcrumbs[0].attribs.title).toBe('Account and profile')
|
|
})
|
|
|
|
test('works for ghec billing page', async () => {
|
|
const $ = await getDOM(
|
|
'/enterprise-cloud@latest/billing/managing-billing-for-your-github-account/about-billing-for-your-enterprise'
|
|
)
|
|
const $breadcrumbs = $('[data-testid=breadcrumbs] a')
|
|
expect($breadcrumbs).toHaveLength(6)
|
|
expect($breadcrumbs[0].attribs.title).toBe('Billing and payments')
|
|
})
|
|
|
|
test('works for pages that have overlapping product names', async () => {
|
|
const $ = await getDOM(
|
|
// article path has overlap with `/en/github`
|
|
'/en/github-cli/github-cli/about-github-cli'
|
|
)
|
|
const $breadcrumbs = $('[data-testid=breadcrumbs] a')
|
|
expect($breadcrumbs).toHaveLength(6)
|
|
expect($breadcrumbs[0].attribs.title).toBe('GitHub CLI')
|
|
expect($breadcrumbs[1].attribs.title).toBe('GitHub CLI')
|
|
expect($breadcrumbs[2].attribs.title).toBe('About GitHub CLI')
|
|
})
|
|
|
|
test('parses Liquid variables inside titles', async () => {
|
|
const $ = await getDOM('/en/education/manage-coursework-with-github-classroom')
|
|
const $breadcrumbs = $('[data-testid=breadcrumbs] a')
|
|
expect($breadcrumbs).toHaveLength(4)
|
|
expect($breadcrumbs[1].attribs.title).toBe('GitHub Classroom')
|
|
})
|
|
|
|
test('English breadcrumbs link to English pages', async () => {
|
|
const $ = await getDOM('/en/get-started/learning-about-github')
|
|
const $breadcrumbs = $('[data-testid=breadcrumbs] a')
|
|
expect($breadcrumbs[0].attribs.href).toBe('/en/get-started')
|
|
})
|
|
|
|
test('localized breadcrumbs link to localize pages', async () => {
|
|
const $ = await getDOM('/ja/get-started/learning-about-github')
|
|
const $breadcrumbs = $('[data-testid=breadcrumbs] a')
|
|
expect($breadcrumbs[0].attribs.href).toBe('/ja/get-started')
|
|
})
|
|
})
|
|
|
|
describeInternalOnly('early access rendering', () => {
|
|
test('top-level product pages have breadcrumbs', async () => {
|
|
const $ = await getDOM('/early-access/github/articles/using-gist-playground')
|
|
expect($('[data-testid=breadcrumbs]')).toHaveLength(2)
|
|
})
|
|
|
|
test('early access article pages have breadcrumbs with product, category, and article', async () => {
|
|
const $ = await getDOM(
|
|
'/early-access/github/enforcing-best-practices-with-github-policies/about-github-policies'
|
|
)
|
|
const $breadcrumbTitles = $('[data-testid=breadcrumbs] [data-testid=breadcrumb-title]')
|
|
const $breadcrumbLinks = $('[data-testid=breadcrumbs] a')
|
|
|
|
expect($breadcrumbTitles).toHaveLength(0)
|
|
expect($breadcrumbLinks).toHaveLength(4)
|
|
expect($breadcrumbLinks[0].attribs.title).toBe(
|
|
'Enforcing best practices with GitHub Policies'
|
|
)
|
|
expect($breadcrumbLinks[1].attribs.title).toBe('About GitHub Policies')
|
|
expect($breadcrumbLinks[1].attribs.class.includes('color-fg-muted')).toBe(true)
|
|
})
|
|
})
|
|
|
|
describe('breadcrumbs object', () => {
|
|
test('works on product index pages', async () => {
|
|
const breadcrumbs = await getJSON('/en/github?json=breadcrumbs')
|
|
const expected = [
|
|
{
|
|
href: '/en/github',
|
|
title: 'GitHub',
|
|
},
|
|
]
|
|
expect(breadcrumbs).toEqual(expected)
|
|
})
|
|
|
|
test('works on category index pages', async () => {
|
|
const breadcrumbs = await getJSON(
|
|
'/en/issues/tracking-your-work-with-issues/quickstart?json=breadcrumbs'
|
|
)
|
|
const expected = [
|
|
{
|
|
href: '/en/issues',
|
|
title: 'GitHub Issues',
|
|
},
|
|
{
|
|
href: '/en/issues/tracking-your-work-with-issues',
|
|
title: 'Issues',
|
|
},
|
|
{
|
|
href: '/en/issues/tracking-your-work-with-issues/quickstart',
|
|
title: 'Quickstart for GitHub Issues',
|
|
},
|
|
]
|
|
expect(breadcrumbs).toEqual(expected)
|
|
})
|
|
|
|
test('works on maptopic pages', async () => {
|
|
const breadcrumbs = await getJSON(
|
|
'/en/account-and-profile/setting-up-and-managing-your-github-user-account/managing-user-account-settings?json=breadcrumbs'
|
|
)
|
|
const expected = [
|
|
{
|
|
href: '/en/account-and-profile',
|
|
title: 'Account and profile',
|
|
},
|
|
{
|
|
href: '/en/account-and-profile/setting-up-and-managing-your-github-user-account',
|
|
title: 'User accounts',
|
|
},
|
|
{
|
|
href: '/en/account-and-profile/setting-up-and-managing-your-github-user-account/managing-user-account-settings',
|
|
title: 'User account settings',
|
|
},
|
|
]
|
|
expect(breadcrumbs).toEqual(expected)
|
|
})
|
|
|
|
test('works on articles that DO have maptopics ', async () => {
|
|
const breadcrumbs = await getJSON(
|
|
'/en/account-and-profile/setting-up-and-managing-your-github-user-account/managing-user-account-settings/about-your-personal-dashboard?json=breadcrumbs'
|
|
)
|
|
const expected = [
|
|
{
|
|
href: '/en/account-and-profile',
|
|
title: 'Account and profile',
|
|
},
|
|
{
|
|
href: '/en/account-and-profile/setting-up-and-managing-your-github-user-account',
|
|
title: 'User accounts',
|
|
},
|
|
{
|
|
href: '/en/account-and-profile/setting-up-and-managing-your-github-user-account/managing-user-account-settings',
|
|
title: 'User account settings',
|
|
},
|
|
{
|
|
href: '/en/account-and-profile/setting-up-and-managing-your-github-user-account/managing-user-account-settings/about-your-personal-dashboard',
|
|
title: 'Your personal dashboard',
|
|
},
|
|
]
|
|
expect(breadcrumbs).toEqual(expected)
|
|
})
|
|
|
|
test('works on articles that DO NOT have maptopics ', async () => {
|
|
const breadcrumbs = await getJSON(
|
|
'/site-policy/privacy-policies/github-privacy-statement?json=breadcrumbs'
|
|
)
|
|
const expected = [
|
|
{
|
|
href: '/en/site-policy',
|
|
title: 'Site policy',
|
|
},
|
|
{
|
|
href: '/en/site-policy/privacy-policies',
|
|
title: 'Privacy Policies',
|
|
},
|
|
{
|
|
href: '/en/site-policy/privacy-policies/github-privacy-statement',
|
|
title: 'GitHub Privacy Statement',
|
|
},
|
|
]
|
|
expect(breadcrumbs).toEqual(expected)
|
|
})
|
|
|
|
test('returns an empty array on the landing page', async () => {
|
|
const breadcrumbs = await getJSON('/en?json=breadcrumbs')
|
|
expect(breadcrumbs).toEqual([])
|
|
})
|
|
})
|
|
})
|