Skip to content

Commit

Permalink
unarchive text translation project
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobbykumar706584 committed Oct 9, 2023
1 parent 578a181 commit 4dc044b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
4 changes: 4 additions & 0 deletions e2e-tests/base.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
29 changes: 29 additions & 0 deletions e2e-tests/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 4dc044b

Please sign in to comment.