Skip to content

Commit

Permalink
test for create audio and obs project with validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobbykumar706584 committed Sep 26, 2023
1 parent f8bf704 commit e57db55
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
13 changes: 12 additions & 1 deletion e2e-tests/base.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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)
Expand Down
24 changes: 24 additions & 0 deletions e2e-tests/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

0 comments on commit e57db55

Please sign in to comment.