From 27f162e80982ad30af55c503fcd58e477847c803 Mon Sep 17 00:00:00 2001 From: Bobbykumar706584 Date: Wed, 27 Sep 2023 12:25:01 +0530 Subject: [PATCH] check project name in editor --- e2e-tests/base.test.ts | 6 +++++- e2e-tests/common.js | 20 +++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/e2e-tests/base.test.ts b/e2e-tests/base.test.ts index f47178c78..399c7d588 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, createProjects, unstarProject, starProject, searchProject } from './common'; +import { showLoginPage, checkLogInOrNot, userFile, userFolder, userJson, createUserValidation, createProjectValidation, createProjects, unstarProject, starProject, searchProject, checkProjectName } from './common'; const fs = require('fs'); const path = require('path'); @@ -135,6 +135,10 @@ test('Search a text project in all projects list', async ({ textProject }) => { await searchProject(window, expect, textProject, 'translation') }); +test('Click and Check the text Translation project name to the editor', async ({ textProject }) => { + await checkProjectName(window, expect, textProject) +}); + test("Logout and delete that playwright user from the backend", async ({ userName }) => { // user json diff --git a/e2e-tests/common.js b/e2e-tests/common.js index b2b477fd5..896b5ec20 100644 --- a/e2e-tests/common.js +++ b/e2e-tests/common.js @@ -143,4 +143,22 @@ export const searchProject = async (window, expect, projectName, searchtext) => await window.locator('//input[@id="search_box"]').fill(searchtext) const projectname = await window.innerText(`//*[@id="${projectName}"]`); expect(await projectname).toBe(projectName); -} \ No newline at end of file +} + +export const checkProjectName = async (window, expect, name) => { + expect(await window.locator('//*[@id="projects-list"]')).toBeVisible() + const table = await window.locator('//*[@id="projects-list"]') + const body = await table.locator('//*[@id="projects-list-unstar"]') + const rows = await body.locator('tr') + for (let i = 0; i < await rows.count(); i++) { + const row = await rows.nth(i); + const tds = await row.locator('td'); + if (await tds.nth(1).textContent() === name) { + await tds.nth(1).click() + } + } + const editorpane = await window.innerText('[aria-label=editor-pane]', { timeout: 120000 }); + expect(editorpane).toBe('EDITOR'); + const projectname = await window.innerText('[aria-label=editor-project-name]'); + expect(projectname).toBe(name.toUpperCase()); +}