MCPcopy Index your code
hub / github.com/angular/angular-cli / browserCheck

Function browserCheck

tests/e2e/tests/i18n/setup.ts:65–92  ·  view source on GitHub ↗
(page: Page, lang: string)

Source from the content-addressed store, hash-verified

63export const sourceLocale = langTranslations[0].lang;
64
65export async function browserCheck(page: Page, lang: string) {
66 const translation = langTranslations.find((t) => t.lang === lang)?.translation;
67 if (!translation) {
68 throw new Error(`Could not find translation for language '${lang}'`);
69 }
70
71 const getParagraph = async (id: string) => page.$eval(`p#${id}`, (el) => el.textContent?.trim());
72
73 const hello = await getParagraph('hello');
74 if (hello !== translation.hello) {
75 throw new Error(`Expected 'hello' to be '${translation.hello}', but got '${hello}'.`);
76 }
77
78 const locale = await getParagraph('locale');
79 if (locale !== lang) {
80 throw new Error(`Expected 'locale' to be '${lang}', but got '${locale}'.`);
81 }
82
83 const date = await getParagraph('date');
84 if (date !== translation.date) {
85 throw new Error(`Expected 'date' to be '${translation.date}', but got '${date}'.`);
86 }
87
88 const plural = await getParagraph('plural');
89 if (plural !== translation.plural) {
90 throw new Error(`Expected 'plural' to be '${translation.plural}', but got '${plural}'.`);
91 }
92}
93
94export interface ExternalServer {
95 readonly server: Server;

Calls 2

findMethod · 0.80
getParagraphFunction · 0.70

Tested by

no test coverage detected