Skip to content

Commit

Permalink
archive text translation project
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobbykumar706584 committed Oct 9, 2023
1 parent ea3d3a0 commit 578a181
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 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, 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');
Expand Down Expand Up @@ -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 */
Expand Down
30 changes: 30 additions & 0 deletions e2e-tests/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions renderer/src/layouts/projects/Layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ export default function ProjectsLayout(props) {
{showArchived ? (
<>
<ComputerDesktopIcon className="h-4 mr-2 text-white" />
<span>{t('label-active')}</span>
<span aria-label="active-projects">{t('label-active')}</span>
</>
) : (
<>
<ArchiveBoxIcon className="h-4 mr-2 text-white" />
<span>{t('label-archived')}</span>
<span aria-label="archived-projects">{t('label-archived')}</span>
</>
)}
</button>
Expand Down

0 comments on commit 578a181

Please sign in to comment.