Skip to content

Commit

Permalink
validation and create a project for text translation
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobbykumar706584 committed Sep 26, 2023
1 parent a0e580b commit f8bf704
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
28 changes: 27 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 } from './common';
import { showLoginPage, checkLogInOrNot, userFile, userFolder, userJson, createUserValidation, createProjectValidation } from './common';

const fs = require('fs');
const path = require('path');
Expand Down Expand Up @@ -65,6 +65,32 @@ test('Create a new user and login', async ({ userName }) => {
expect(title).toBe('Projects');
})

/*CREATE PROJECTS FOR ALL FLAVOR TYPE */
// // /* Translation Project */
test('Click New and Fill project page details to create a new project for text translation with custom book', async ({ textProject }) => {
await expect(window.locator('//a[@aria-label="new"]')).toBeVisible()
await window.getByRole('link', { name: 'new' }).click()
await createProjectValidation(window, expect)
await expect(window.locator('//input[@id="project_name"]')).toBeVisible()
await window.locator('//input[@id="project_name"]').fill(textProject)
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')
await expect(window.locator('//button[@id="open-advancesettings"]')).toBeVisible()
await window.locator('//button[@id="open-advancesettings"]').click()
await expect(window.locator('//div[@aria-label="custom-book"]')).toBeVisible()
await window.locator('//div[@aria-label="custom-book"]').click()
await window.getByLabel('nt-Matthew').click()
await window.getByRole('button', { name: 'Save' }).click()
await window.locator('//button[@aria-label="create"]').click()
const notifyMe = await window.textContent('//*[@id="__next"]/div/div[2]/div[2]/div/div')
expect(await notifyMe).toBe('New project created')
const projectName = await window.innerText(`//div[@id="${textProject}"]`)
expect(projectName).toBe(textProject);
const title = await window.textContent('[aria-label=projects]');
expect(title).toBe('Projects');
})

test("Logout and delete that playwright user from the backend", async ({ userName }) => {
///user json
Expand Down
9 changes: 9 additions & 0 deletions e2e-tests/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,13 @@ export const createUserValidation = async (window, expect) => {
const lengthError = await window.locator('//*[@id="show-error"]')
expect(await lengthError === true)
expect(await lengthError.textContent()).toBe('The input has to be between 3 and 15 characters long')
}

export const createProjectValidation = async (window, expect) => {
await window.locator('//button[@aria-label="create"]').click()
const snackbar = await window.textContent('//*[@id="__next"]/div/div[2]/div[2]/div/div')
expect(await snackbar).toBe('Fill all the fields')
const title = await window.textContent('[aria-label=projects]');
expect(title).toBe('New Project');
await window.waitForTimeout(3000)
}
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ export default function AdvancedSettingsDropdown({ call, project, projectType })
onClick={() => selectCanon(canonList[3])}
role="button"
tabIndex="0"
aria-label="custom-book"
>
{t('label-custom')}
</div>
Expand Down

0 comments on commit f8bf704

Please sign in to comment.