Skip to content

Commit

Permalink
created project with new custom text translation language
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobbykumar706584 committed Oct 18, 2023
1 parent f630eb9 commit d3f2520
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 5 deletions.
26 changes: 25 additions & 1 deletion e2e-tests/base.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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)
Expand Down
14 changes: 14 additions & 0 deletions e2e-tests/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/myFixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type myFixture = {
flavorObs: string
textUnderscore: string,
obsUnderscore: string,
obsUrduProject: string,
customTextTargetLanguage: string,
}
const myFixtureTest = myTest.extend<myFixture>({
userName: "Playwright user",
Expand All @@ -26,7 +26,7 @@ const myFixtureTest = myTest.extend<myFixture>({
doorPassword: "Bobby@123",
flavorText: "textTranslation",
flavorObs: "textStories",
obsUrduProject: "Obs urdu project",
customTextTargetLanguage: "Custom text transaltion",
})

export const test = myFixtureTest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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}
Expand All @@ -323,7 +325,6 @@ export default function TargetLanguagePopover({ projectType }) {
<div className="flex items-center justify-center mt-8">
<button
type="button"
aria-label="create-language"
onClick={closeModal}
className="mr-5 bg-error w-28 h-8 border-color-error rounded
uppercase shadow text-white text-xs tracking-wide leading-4 font-light focus:outline-none"
Expand All @@ -334,7 +335,7 @@ export default function TargetLanguagePopover({ projectType }) {
: (
<button
type="button"
aria-label="edit-language"
aria-label={edit === true ? 'edit-language' : 'create-language'}
className=" bg-success w-28 h-8 border-color-success rounded uppercase text-white text-xs shadow focus:outline-none"
onClick={() => (edit === true ? editLanguage() : addLanguage())}
>
Expand Down

0 comments on commit d3f2520

Please sign in to comment.