diff --git a/site/gatsby-site/playwright/e2e-full/pageCreators/createCitationPages.spec.ts b/site/gatsby-site/playwright/e2e-full/pageCreators/createCitationPages.spec.ts index 0b51b69b12..185990f407 100644 --- a/site/gatsby-site/playwright/e2e-full/pageCreators/createCitationPages.spec.ts +++ b/site/gatsby-site/playwright/e2e-full/pageCreators/createCitationPages.spec.ts @@ -3,7 +3,7 @@ import sinon from 'sinon'; import createCitationPages from '../../../page-creators/createCitationPages'; import { CreatePagesArgs } from 'gatsby'; import { expect } from '@playwright/test'; -import { test } from '../../utils'; +import { getLanguages, test } from '../../utils'; test.describe('createCitationPages', () => { let graphql: sinon.SinonStub; @@ -62,40 +62,7 @@ test.describe('createCitationPages', () => { extensions: {}, }; - const languages = [ - { - code: 'en', - hrefLang: 'en-US', - name: 'English', - localName: 'English', - langDir: 'ltr', - dateFormat: 'MM/DD/YYYY', - }, - { - code: 'es', - hrefLang: 'es', - name: 'Spanish', - localName: 'Español', - langDir: 'ltr', - dateFormat: 'DD-MM-YYYY', - }, - { - code: 'fr', - hrefLang: 'fr', - name: 'French', - localName: 'Français', - langDir: 'ltr', - dateFormat: 'DD-MM-YYYY', - }, - { - code: 'ja', - hrefLang: 'ja', - name: 'Japanese', - localName: '日本語', - langDir: 'ltr', - dateFormat: 'YYYY/MM/DD', - }, - ]; + const languages = getLanguages(); test.beforeEach(() => { graphql = sinon.stub(); diff --git a/site/gatsby-site/playwright/e2e-full/pageCreators/createReportPages.spec.ts b/site/gatsby-site/playwright/e2e-full/pageCreators/createReportPages.spec.ts index 8302871660..d00ed9a4a5 100644 --- a/site/gatsby-site/playwright/e2e-full/pageCreators/createReportPages.spec.ts +++ b/site/gatsby-site/playwright/e2e-full/pageCreators/createReportPages.spec.ts @@ -2,7 +2,7 @@ import sinon from 'sinon'; import createReportPages from '../../../page-creators/createReportPages'; import { CreatePagesArgs } from 'gatsby'; import { expect } from '@playwright/test'; -import { test } from '../../utils'; +import { getLanguages, test } from '../../utils'; test.describe('createReportPages', () => { let graphql: sinon.SinonStub; @@ -19,12 +19,7 @@ test.describe('createReportPages', () => { }, }; - const languages = [ - { code: 'en', hrefLang: 'en-US', name: 'English', localName: 'English', langDir: 'ltr', dateFormat: 'MM/DD/YYYY' }, - { code: 'es', hrefLang: 'es', name: 'Spanish', localName: 'Español', langDir: 'ltr', dateFormat: 'DD-MM-YYYY' }, - { code: 'fr', hrefLang: 'fr', name: 'French', localName: 'Français', langDir: 'ltr', dateFormat: 'DD-MM-YYYY' }, - { code: 'ja', hrefLang: 'ja', name: 'Japanese', localName: '日本語', langDir: 'ltr', dateFormat: 'YYYY/MM/DD' }, - ]; + const languages = getLanguages(); test.beforeEach(() => { graphql = sinon.stub(); diff --git a/site/gatsby-site/playwright/utils.ts b/site/gatsby-site/playwright/utils.ts index 0ffb38328e..a85fa88ddf 100644 --- a/site/gatsby-site/playwright/utils.ts +++ b/site/gatsby-site/playwright/utils.ts @@ -282,3 +282,12 @@ export async function fillAutoComplete(page: Page, selector: string, sequence: s await page.getByText(target).first().click({ timeout: 1000 }); }).toPass(); } + +export function getLanguages() { + return [ + { code: 'en', hrefLang: 'en-US', name: 'English', localName: 'English', langDir: 'ltr', dateFormat: 'MM/DD/YYYY' }, + { code: 'es', hrefLang: 'es', name: 'Spanish', localName: 'Español', langDir: 'ltr', dateFormat: 'DD-MM-YYYY' }, + { code: 'fr', hrefLang: 'fr', name: 'French', localName: 'Français', langDir: 'ltr', dateFormat: 'DD-MM-YYYY' }, + { code: 'ja', hrefLang: 'ja', name: 'Japanese', localName: '日本語', langDir: 'ltr', dateFormat: 'YYYY/MM/DD' }, + ]; +}