From 8b3cac2fe36f59b4666740d93c26b23318b27e47 Mon Sep 17 00:00:00 2001
From: Bobbykumar706584 <bobbykumar706584@gmail.com>
Date: Wed, 18 Oct 2023 11:02:56 +0530
Subject: [PATCH] created project for obs/audio with custom language

---
 e2e-tests/base.test.ts  | 12 +++++++++++-
 e2e-tests/common.js     | 23 +++++++++++++++++++++++
 e2e-tests/myFixtures.ts |  4 ++++
 3 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/e2e-tests/base.test.ts b/e2e-tests/base.test.ts
index 8403ba74f..1867b96f2 100644
--- a/e2e-tests/base.test.ts
+++ b/e2e-tests/base.test.ts
@@ -11,7 +11,8 @@ import {
   goToProjectPage, exportProjects, archivedProjects,
   unarchivedProjects, goToEditProject, changeAppLanguage,
   projectTargetLanguage, userProfileValidaiton,
-  exportAudioProject, updateDescriptionAbbriviation, changeLicense, customAddEditLanguage
+  exportAudioProject, updateDescriptionAbbriviation, changeLicense,
+  customAddEditLanguage, customProjectTargetLanguage
 } from './common';
 
 const fs = require('fs');
@@ -410,6 +411,15 @@ test("Custom text translation with custom language project", async ({ customText
   await expect(projectName).toBe(customTextTargetLanguage);
 })
 
+//Obs and Audio custom target language RTL project 
+test("Custom obs project with custom language project", async ({ customObsTargetLanguage }) => {
+  await customProjectTargetLanguage(window, expect, customObsTargetLanguage, "OBS", "custom obs language test description", "cotp", "add-language", "obs target language", 'cotl', "RTL", "create-language")
+})
+
+test("Custom audio project with custom language project", async ({ customAudioTargetLanguage }) => {
+  await customProjectTargetLanguage(window, expect, customAudioTargetLanguage, "Audio", "custom audio language test description", "catp", "add-language", "audio target language", 'catl', "RTL", "create-language")
+})
+
 /* 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 a812a0645..6ac10e183 100644
--- a/e2e-tests/common.js
+++ b/e2e-tests/common.js
@@ -323,6 +323,29 @@ export const customAddEditLanguage = async (window, expect, openModal, targetLan
   await window.locator(`//*[@aria-label="${createLanguage}"]`).click()
 }
 
+///obs and audio custom target language project
+export const customProjectTargetLanguage = async (window, expect, projectname, flavorType, description, abb, openModal, targetLanguageName, targetLanguageCode, targetDirection, createLanguage) => {
+  await expect(window.locator('//a[@aria-label="new"]')).toBeVisible()
+  await window.locator('//a[@aria-label="new"]').click()
+  await expect(window.locator('//button[@aria-label="open-popover"]')).toBeVisible()
+  await window.locator('//button[@aria-label="open-popover"]').click()
+  await expect(window.locator(`//a[@data-id="${flavorType}"]`)).toBeVisible()
+  await window.locator(`//a[@data-id="${flavorType}"]`).click()
+  // checking for create project validation
+  await createProjectValidation(window, expect)
+  await expect(window.locator('//input[@id="project_name"]')).toBeVisible()
+  await window.locator('//input[@id="project_name"]').fill(projectname)
+  await expect(window.locator('//textarea[@id="project_description"]')).toBeVisible()
+  await window.locator('//textarea[@id="project_description"]').fill(description)
+  await expect(window.locator('//input[@id="version_abbreviated"]')).toBeVisible()
+  await window.locator('//input[@id="version_abbreviated"]').fill(abb)  
+   //adding new custom text translation language 
+   await customAddEditLanguage(window, expect, openModal, targetLanguageName, targetLanguageCode, targetDirection, createLanguage, flavorType)
+   await window.locator('//button[@aria-label="create"]').click()
+   const projectName = await window.innerText(`//div[@id="${projectname}"]`)
+   await expect(projectName).toBe(projectname);
+}
+
 
 // Performs user profile validation checks.
 export const userProfileValidaiton = async(window, expect) => {
diff --git a/e2e-tests/myFixtures.ts b/e2e-tests/myFixtures.ts
index 28284cd6d..f0a821b69 100644
--- a/e2e-tests/myFixtures.ts
+++ b/e2e-tests/myFixtures.ts
@@ -13,6 +13,8 @@ type myFixture = {
   textUnderscore: string,
   obsUnderscore: string,
   customTextTargetLanguage: string,
+  customObsTargetLanguage: string,
+  customAudioTargetLanguage: string,
 }
 const myFixtureTest = myTest.extend<myFixture>({
   userName: "Playwright user",
@@ -27,6 +29,8 @@ const myFixtureTest = myTest.extend<myFixture>({
   flavorText: "textTranslation",
   flavorObs: "textStories",
   customTextTargetLanguage: "Custom text transaltion",
+  customObsTargetLanguage: "Custom obs target project",
+  customAudioTargetLanguage: "Custom audio target project",
 })
 
 export const test = myFixtureTest;