diff --git a/e2e-tests/base.test.ts b/e2e-tests/base.test.ts index 46f4fbf1f..8403ba74f 100644 --- a/e2e-tests/base.test.ts +++ b/e2e-tests/base.test.ts @@ -11,7 +11,7 @@ import { goToProjectPage, exportProjects, archivedProjects, unarchivedProjects, goToEditProject, changeAppLanguage, projectTargetLanguage, userProfileValidaiton, - exportAudioProject, updateDescriptionAbbriviation, changeLicense + exportAudioProject, updateDescriptionAbbriviation, changeLicense, customAddEditLanguage } from './common'; const fs = require('fs'); @@ -386,6 +386,30 @@ test("Changing text translation project language from Persian to English", async await projectTargetLanguage(window, expect, textProject, "english", "English") }) +// custom project with custom language for text translation +test("Custom text translation with custom language project", async ({ customTextTargetLanguage }) => { + await expect(window.locator('//a[@aria-label="new"]')).toBeVisible() + await window.locator('//a[@aria-label="new"]').click() + await createProjectValidation(window, expect) + await expect(window.locator('//input[@id="project_name"]')).toBeVisible() + await window.locator('//input[@id="project_name"]').fill(customTextTargetLanguage) + await expect(window.locator('//textarea[@id="project_description"]')).toBeVisible() + await window.locator('//textarea[@id="project_description"]').fill('test description') + await expect(window.locator('//input[@id="version_abbreviated"]')).toBeVisible() + await window.locator('//input[@id="version_abbreviated"]').fill('ttp') + //adding new custom text translation language + await customAddEditLanguage(window, expect, "add-language", "custom text translation language", 'cttl', "RTL", "create-language") + await expect(window.locator('//*[@id="open-advancesettings"]')).toBeVisible() + await window.locator('//*[@id="open-advancesettings"]').click() + await expect(window.locator('//*[@aria-label="custom-book"]')).toBeVisible() + await window.locator('//*[@aria-label="custom-book"]').click() + await window.locator('//*[@aria-label="nt-Matthew"]').click() + await window.locator('//*[@id="save-canon"]').click() + await window.locator('//button[@aria-label="create"]').click() + const projectName = await window.innerText(`//div[@id="${customTextTargetLanguage}"]`) + await expect(projectName).toBe(customTextTargetLanguage); +}) + /* updating user profile */ test("Update user Profile", async () => { await userProfileValidaiton(window, expect) diff --git a/e2e-tests/common.js b/e2e-tests/common.js index c4b83865c..a812a0645 100644 --- a/e2e-tests/common.js +++ b/e2e-tests/common.js @@ -310,6 +310,20 @@ export const changeLicense = async (window, expect, currentLicense, newLicense) expect(await title).toBe('Projects') } +//Create Custom langauge +export const customAddEditLanguage = async (window, expect, openModal, targetLanguageName, targetLanguageCode, targetDirection, createLanguage, flavorType) => { + await window.locator(`//*[@aria-label="${openModal}"]`).click() + expect(await window.locator('//*[@id="language"]')).toBeVisible() + await window.locator('//*[@id="language"]').fill(targetLanguageName) + expect(await window.locator('//*[@id="code"]')).toBeVisible() + await window.locator('//*[@id="code"]').fill(targetLanguageCode) + if(flavorType !== "Audio"){ + await window.locator(`//*[@aria-label="${targetDirection}"]`).click() + } + await window.locator(`//*[@aria-label="${createLanguage}"]`).click() +} + + // Performs user profile validation checks. export const userProfileValidaiton = async(window, expect) => { expect(await window.locator('//*[@id="user-profile-image"]')).toBeVisible() diff --git a/e2e-tests/myFixtures.ts b/e2e-tests/myFixtures.ts index 884385686..28284cd6d 100644 --- a/e2e-tests/myFixtures.ts +++ b/e2e-tests/myFixtures.ts @@ -12,7 +12,7 @@ type myFixture = { flavorObs: string textUnderscore: string, obsUnderscore: string, - obsUrduProject: string, + customTextTargetLanguage: string, } const myFixtureTest = myTest.extend({ userName: "Playwright user", @@ -26,7 +26,7 @@ const myFixtureTest = myTest.extend({ doorPassword: "Bobby@123", flavorText: "textTranslation", flavorObs: "textStories", - obsUrduProject: "Obs urdu project", + customTextTargetLanguage: "Custom text transaltion", }) export const test = myFixtureTest; diff --git a/renderer/src/components/ProjectsPage/CreateProject/TargetLanguagePopover.js b/renderer/src/components/ProjectsPage/CreateProject/TargetLanguagePopover.js index 2462147b0..8ec250979 100644 --- a/renderer/src/components/ProjectsPage/CreateProject/TargetLanguagePopover.js +++ b/renderer/src/components/ProjectsPage/CreateProject/TargetLanguagePopover.js @@ -299,6 +299,7 @@ export default function TargetLanguagePopover({ projectType }) { type="radio" className="form-radio h-4 w-4 text-primary" value={t('label-ltr')} + aria-label="LTR" checked={direction === t('label-ltr')} onChange={() => setDirection(t('label-ltr'))} disabled={lock} @@ -310,6 +311,7 @@ export default function TargetLanguagePopover({ projectType }) { type="radio" className="form-radio h-4 w-4 text-primary" value={t('label-rtl')} + aria-label="RTL" checked={direction === t('label-rtl')} onChange={() => setDirection(t('label-rtl'))} disabled={lock} @@ -323,7 +325,6 @@ export default function TargetLanguagePopover({ projectType }) {