diff --git a/e2e-tests/base.test.ts b/e2e-tests/base.test.ts index 61a3e3ac9..a89c9831e 100644 --- a/e2e-tests/base.test.ts +++ b/e2e-tests/base.test.ts @@ -2,7 +2,7 @@ import { test, expect } from './myFixtures'; import packageInfo from '../package.json'; -import { showLoginPage, checkLogInOrNot, userFile, userFolder, userJson, createUserValidation, createProjectValidation } from './common'; +import { showLoginPage, checkLogInOrNot, userFile, userFolder, userJson, createUserValidation, createProjectValidation, createProjects } from './common'; const fs = require('fs'); const path = require('path'); @@ -92,6 +92,17 @@ test('Click New and Fill project page details to create a new project for text t expect(title).toBe('Projects'); }) +///Obs translation project +test('Click New and Fill project page details to create a new project for obs', async ({ obsProject }) => { + await createProjects(window, expect, obsProject, "OBS", "test description", "otp") +}) + +/////Audio project +test('Click Click New and Fill project page details to create a new project for audio', async ({ audioProject }) => { + await createProjects(window, expect, audioProject, "Audio", "test description", "atp") +}) + + test("Logout and delete that playwright user from the backend", async ({ userName }) => { ///user json const json = await userJson(window, packageInfo, fs, path) diff --git a/e2e-tests/common.js b/e2e-tests/common.js index c5da057d9..a736b4e86 100644 --- a/e2e-tests/common.js +++ b/e2e-tests/common.js @@ -69,4 +69,28 @@ export const createProjectValidation = async (window, expect) => { const title = await window.textContent('[aria-label=projects]'); expect(title).toBe('New Project'); await window.waitForTimeout(3000) +} + +///function for creating a project for obs and audio +export const createProjects = async (window, expect, projectname, type, description, abb) => { + await expect(window.locator('//a[@aria-label="new"]')).toBeVisible() + await window.getByRole('link', { name: '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="${type}"]`)).toBeVisible() + await window.locator(`//a[@data-id="${type}"]`).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) + await expect(window.locator('//button[@aria-label="create"]')).toBeVisible() + await window.locator('//button[@aria-label="create"]').click() + const projectName = await window.innerText(`//div[@id="${projectname}"]`) + expect(projectName).toBe(projectname); + const title = await window.textContent('[aria-label=projects]', { timeout: 10000 }); + expect(title).toBe('Projects'); } \ No newline at end of file