Skip to content

Commit

Permalink
check project name in editor
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobbykumar706584 committed Sep 27, 2023
1 parent 3fcac9c commit 27f162e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
6 changes: 5 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, 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');
Expand Down Expand Up @@ -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
Expand Down
20 changes: 19 additions & 1 deletion e2e-tests/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

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());
}

0 comments on commit 27f162e

Please sign in to comment.