From 578a181dcf8a8a2218f0d44b67435251c3550256 Mon Sep 17 00:00:00 2001 From: Bobbykumar706584 Date: Mon, 9 Oct 2023 16:18:05 +0530 Subject: [PATCH] archive text translation project --- e2e-tests/base.test.ts | 6 ++++- e2e-tests/common.js | 30 +++++++++++++++++++++++++ renderer/src/layouts/projects/Layout.js | 4 ++-- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/e2e-tests/base.test.ts b/e2e-tests/base.test.ts index 208a16ade..496ddd6c7 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, createProjectValidation, createProjects, unstarProject, starProject, userValidation, signOut, showActiveUsers, searchProject, checkProjectName, checkNotification, goToProjectPage, exportProjects } from './common'; +import { showLoginPage, checkLogInOrNot, userFile, userFolder, userJson, createProjectValidation, createProjects, unstarProject, starProject, userValidation, signOut, showActiveUsers, searchProject, checkProjectName, checkNotification, goToProjectPage, exportProjects, archivedProjects, unarchivedProjects } from './common'; const fs = require('fs'); const path = require('path'); @@ -248,6 +248,10 @@ test("Export the audio project in the Downloads folder", async ({ audioProject } await exportProjects(window, expect, audioProject) }) +/*archive and unarchive project */ +test("Archive text translation project", async ({ textProject }) => { + await archivedProjects(window, expect, textProject) +}) /*signing out */ diff --git a/e2e-tests/common.js b/e2e-tests/common.js index fb1d58108..64b43b239 100644 --- a/e2e-tests/common.js +++ b/e2e-tests/common.js @@ -208,6 +208,36 @@ export const exportProjects = async (window, expect, projectname) => { } } +// archived projects +export const archivedProjects = async (window, expect, projectname) => { + await expect(window.locator('//*[@id="projects-list"]')).toBeVisible() + const table = window.locator('//*[@id="projects-list"]') + const body = 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() === projectname) { + expect(await tds.last().locator('[aria-label=unstar-expand-project]')).toBeVisible() + await tds.last().locator('[aria-label=unstar-expand-project]').click() + await window.waitForTimeout(1000) + await window.locator('.pl-5 > div > div').click() + await window.locator('//*[@aria-label="unstar-archive-restore-project"]').click() + expect(await rows.count()).toBe(4) + break + } + } + await window.locator('//*[@aria-label="archived-projects"]').click() + const archiveTitle = await window.locator('//*[@aria-label="projects"]').textContent() + await expect(archiveTitle).toBe("Archived projects") + const projectName = await window.innerText(`//div[@id="${projectname}"]`) + await expect(projectName).toBe(projectname); + await window.locator('//*[@aria-label="active-projects"]').click() + const projectTitle = await window.locator('//*[@aria-label="projects"]').textContent() + await expect(projectTitle).toBe('Projects'); +} + + // sing out export const signOut = async (window, expect) => { await expect(window.locator('//*[@id="user-profile"]')).toBeVisible() diff --git a/renderer/src/layouts/projects/Layout.js b/renderer/src/layouts/projects/Layout.js index 9c4898ab2..7c4b023f5 100644 --- a/renderer/src/layouts/projects/Layout.js +++ b/renderer/src/layouts/projects/Layout.js @@ -103,12 +103,12 @@ export default function ProjectsLayout(props) { {showArchived ? ( <> - {t('label-active')} + {t('label-active')} ) : ( <> - {t('label-archived')} + {t('label-archived')} )}