From 4dc044bd63f21fe310393136e05796af8b800d48 Mon Sep 17 00:00:00 2001 From: Bobbykumar706584 Date: Mon, 9 Oct 2023 16:18:44 +0530 Subject: [PATCH] unarchive text translation project --- e2e-tests/base.test.ts | 4 ++++ e2e-tests/common.js | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/e2e-tests/base.test.ts b/e2e-tests/base.test.ts index 496ddd6c7..3542d908a 100644 --- a/e2e-tests/base.test.ts +++ b/e2e-tests/base.test.ts @@ -253,6 +253,10 @@ test("Archive text translation project", async ({ textProject }) => { await archivedProjects(window, expect, textProject) }) +test("Restore text translation project from archived page", async ({ textProject }) => { + await unarchivedProjects(window, expect, textProject) +}) + /*signing out */ test("Sign out the Application", async () => { diff --git a/e2e-tests/common.js b/e2e-tests/common.js index 64b43b239..65895c8a4 100644 --- a/e2e-tests/common.js +++ b/e2e-tests/common.js @@ -237,6 +237,35 @@ export const archivedProjects = async (window, expect, projectname) => { await expect(projectTitle).toBe('Projects'); } +// unarchived projects +export const unarchivedProjects = async (window, expect, projectname) => { + await window.locator('//*[@aria-label="archived-projects"]').click() + 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.locator('.pl-5 > div > div').click({ timeout: 4000 }) + await window.locator('//*[@aria-label="unstar-archive-restore-project"]').click() + await window.waitForTimeout(500) + expect(await rows.count()).toBe(0) + break + } + } + const archiveTitle = await window.locator('//*[@aria-label="projects"]').textContent() + + await expect(archiveTitle).toBe("Archived projects") + await window.locator('//*[@aria-label="active-projects"]').click() + const projectName = await window.innerText(`//div[@id="${projectname}"]`) + await expect(projectName).toBe(projectname); + const projectTitle = await window.locator('//*[@aria-label="projects"]').textContent() + await expect(projectTitle).toBe('Projects'); +} // sing out export const signOut = async (window, expect) => {