Skip to content

Commit

Permalink
chapter wise and full audio project export
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobbykumar706584 committed Oct 17, 2023
1 parent 83ce697 commit 217952f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
13 changes: 12 additions & 1 deletion e2e-tests/base.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
searchProject, checkProjectName, checkNotification,
goToProjectPage, exportProjects, archivedProjects,
unarchivedProjects, goToEditProject, changeAppLanguage,
projectTargetLanguage, userProfileValidaiton
projectTargetLanguage, userProfileValidaiton, exportAudioProject
} from './common';

const fs = require('fs');
Expand Down Expand Up @@ -187,6 +187,7 @@ test('Add content in verses 1 and 2 in the obs story 1 editor', async () => {
});

test('Increase the font size in the obs editor', async () => {
await window.waitForSelector('//*[@aria-label="increase-font"]', { timeout: 5000 })
await window.locator('//*[@aria-label="increase-font"]').click();
await window.locator('//*[@aria-label="increase-font"]').click();
const div = await window.locator('//*[@aria-label="editor"]')
Expand All @@ -198,6 +199,7 @@ test('Increase the font size in the obs editor', async () => {
});

test('Decrease the font size in the obs editor', async () => {
await window.waitForSelector('//*[@aria-label="decrease-font"]', { timeout: 5000 })
await window.locator('//*[@aria-label="decrease-font"]').click();
await window.locator('//*[@aria-label="decrease-font"]').click();
const div = await window.locator('//*[@aria-label="editor"]')
Expand Down Expand Up @@ -264,6 +266,15 @@ test("Export the audio project in the Downloads folder", async ({ audioProject }
await exportProjects(window, expect, audioProject)
})

//export chapter wise and full audio project
test("Export chapter wise audio project in the Downloads folder", async ({ audioProject }) => {
await exportAudioProject(window, expect, audioProject, "Chapter")
})

test("Export full audio project in the Downloads folder", async ({ audioProject }) => {
await exportAudioProject(window, expect, audioProject, "full")
})

/* archive and unarchive project */
test("Archive text translation project", async ({ textProject }) => {
await archivedProjects(window, expect, textProject)
Expand Down
21 changes: 18 additions & 3 deletions e2e-tests/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ export const createProjectValidation = async (window, expect) => {
}

/* Creates a project with a given name, type, description, and abbreviation. */
export const createProjects = async (window, expect, projectname, type, description, abb) => {
export const createProjects = async (window, expect, projectname, flavorType, description, abb) => {
await expect(window.locator('//a[@aria-label="new"]')).toBeVisible()
await window.locator('//a[@aria-label="new"]').click()
await expect(window.locator('//button[@aria-label="open-popover"]')).toBeVisible()
await window.locator('//button[@aria-label="open-popover"]').click()
await expect(window.locator(`//a[@data-id="${type}"]`)).toBeVisible()
await window.locator(`//a[@data-id="${type}"]`).click()
await expect(window.locator(`//a[@data-id="${flavorType}"]`)).toBeVisible()
await window.locator(`//a[@data-id="${flavorType}"]`).click()
// checking for create project validation
await createProjectValidation(window, expect)
await expect(window.locator('//input[@id="project_name"]')).toBeVisible()
Expand Down Expand Up @@ -211,6 +211,20 @@ export const exportProjects = async (window, expect, projectname) => {
await window.locator('[aria-label=arrow-up]').click()
}

//Export a project with chapter and full audio project
export const exportAudioProject = async(window, expect, projectname, itemCheck) => {
const newpath = await window.evaluate(() => Object.assign({}, window.localStorage))
const userpath = newpath.userPath.split(".")[0]
await commonFilterTable(window, expect, projectname, "export-project")
await expect(window.locator('input[name="location"]')).toBeVisible()
await window.locator('input[name="location"]').fill(`${userpath}/Downloads`)
await window.locator(`//*[@value="${itemCheck}"]`).click()
await window.locator('//*[@aria-label="export-projects"]').click()
await window.waitForTimeout(2000)
const snackText = await window.locator('//*[@aria-label="snack-text"]').textContent()
await expect(snackText).toBe("Exported Successfully")
await window.locator('[aria-label=arrow-up]').click()
}

// Moves a project to the archived projects section
export const archivedProjects = async (window, expect, projectname) => {
Expand Down Expand Up @@ -241,6 +255,7 @@ export const unarchivedProjects = async (window, expect, projectname) => {
// Navigates to the project editing page.
export const goToEditProject = async (window, expect, projectName) => {
await commonFilterTable(window, expect, projectName, "edit-project")
await window.waitForTimeout(500)
const editTitle = await window.locator('//*[@aria-label="projects"]').textContent()
await expect(editTitle).toBe('Edit Project');
}
Expand Down

0 comments on commit 217952f

Please sign in to comment.