Skip to content

Commit

Permalink
test: ensure i18n application E2E tests are executed
Browse files Browse the repository at this point in the history
  • Loading branch information
clydin committed Nov 6, 2019
1 parent b200e13 commit 6a93776
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/legacy-cli/e2e/tests/i18n/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const langTranslations = [
translation: {
helloPartial: 'Bonjour',
hello: 'Bonjour i18n!',
plural: 'Mis à jour Il y a 3 minutes',
plural: 'Mis à jour il y a 3 minutes',
date: 'janvier',
},
translationReplacements: [
Expand All @@ -34,7 +34,7 @@ export const langTranslations = [
['Updated', 'Mis à jour'],
['just now', 'juste maintenant'],
['one minute ago', 'il y a une minute'],
['other {', 'other {Il y a'],
[/other {/g, 'other {il y a '],
['minutes ago', 'minutes'],
],
},
Expand All @@ -52,7 +52,7 @@ export const langTranslations = [
['Updated', 'Aktualisiert'],
['just now', 'gerade jetzt'],
['one minute ago', 'vor einer Minute'],
['other {', 'other {vor'],
[/other {/g, 'other {vor '],
['minutes ago', 'Minuten'],
],
},
Expand Down Expand Up @@ -91,12 +91,12 @@ export async function setupI18nConfig(useLocalize = true) {

// Add e2e specs for each lang.
for (const { lang, translation } of langTranslations) {
await writeFile(`./src/app.${lang}.e2e-spec.ts`, `
await writeFile(`./e2e/src/app.${lang}.e2e-spec.ts`, `
import { browser, logging, element, by } from 'protractor';
describe('workspace-project App', () => {
const getParagraph = (name: string) => element(by.css('app-root p#' + name)).getText();
beforeEach(() => browser.get(browser.baseUrl););
beforeEach(() => browser.get(browser.baseUrl));
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
Expand All @@ -112,7 +112,7 @@ export async function setupI18nConfig(useLocalize = true) {
expect(getParagraph('locale')).toEqual('${lang}'));
it('should display localized date', () =>
expect(getParagraph('date')).toEqual('${translation.plural}'));
expect(getParagraph('date')).toEqual('${translation.date}'));
it('should display pluralized message', () =>
expect(getParagraph('plural')).toEqual('${translation.plural}'));
Expand Down Expand Up @@ -190,7 +190,7 @@ export async function setupI18nConfig(useLocalize = true) {
if (lang != sourceLocale) {
await copyFile('src/locale/messages.xlf', `src/locale/messages.${lang}.xlf`);
for (const replacements of translationReplacements) {
await replaceInFile(`src/locale/messages.${lang}.xlf`, replacements[0], replacements[1]);
await replaceInFile(`src/locale/messages.${lang}.xlf`, replacements[0], replacements[1] as string);
}
}
}
Expand Down

0 comments on commit 6a93776

Please sign in to comment.