From 1b760f2eb981f2a967aed0b2a47ab1de76c63af8 Mon Sep 17 00:00:00 2001 From: Bobbykumar706584 Date: Tue, 3 Oct 2023 16:50:28 +0530 Subject: [PATCH] adding new attribute --- e2e-tests/base.test.ts | 20 +++++++++---------- e2e-tests/common.js | 14 +++++++------ .../EditorPage/ObsEditor/NavigationObs.js | 1 + .../ResourceUtils/CustomMultiComboBox.js | 2 +- renderer/src/modules/editor/Editor.js | 1 + 5 files changed, 21 insertions(+), 17 deletions(-) diff --git a/e2e-tests/base.test.ts b/e2e-tests/base.test.ts index 2d792e49e..eee9c1441 100644 --- a/e2e-tests/base.test.ts +++ b/e2e-tests/base.test.ts @@ -187,12 +187,12 @@ test('Increase the font size of the obs editor', async () => { await window.click('[aria-label=increase-font]'); const editorpane = await window.innerText('[aria-label=editor-pane]', { timeout: 120000 }); expect(editorpane).toBe('EDITOR'); - const div = await window.locator('//*[@id="__next"]/main/div/div[3]/div[2]') + const div = await window.locator('//*[@aria-label="editor"]') const fontSize = await div.evaluate((ele) => { return window.getComputedStyle(ele).getPropertyValue('font-size') }) - expect(fontSize).toBe('22.4px'); + expect(await fontSize).toBe('22.4px'); }); test('Decrease the font size of the obs editor', async () => { @@ -200,22 +200,22 @@ test('Decrease the font size of the obs editor', async () => { expect(editorpane).toBe('EDITOR'); await window.click('[aria-label=decrease-font]'); await window.click('[aria-label=decrease-font]'); - const div = await window.locator('//*[@id="__next"]/main/div/div[3]/div[2]') + const div = await window.locator('//*[@aria-label="editor"]') const fontSize = await div.evaluate((ele) => { return window.getComputedStyle(ele).getPropertyValue('font-size') }) - expect(fontSize).toBe('16px'); + expect(await fontSize).toBe('16px'); }); test('Change the obs navigation story from 1 to 12 and edit the title', async () => { const editorpane = await window.innerText('[aria-label=editor-pane]', { timeout: 120000 }); expect(editorpane).toBe('EDITOR'); - await expect(window.locator('//*[@id="__next"]/main/div/div[3]/div[1]/div[1]/div/span[2]')).toBeVisible() - await window.locator('//*[@id="__next"]/main/div/div[3]/div[1]/div[1]/div/span[2]').click() - await window.getByRole('button', { name: "12" }).click(); - await expect(window.locator('//*[@id="__next"]/main/div/div[3]/div[2]/div[1]/textarea')).toBeVisible() - await window.locator('//*[@id="__next"]/main/div/div[3]/div[2]/div[1]/textarea').fill('12. The Exodus Edit title') - const title = await window.textContent('//*[@id="__next"]/main/div/div[3]/div[2]/div[1]/textarea') + await expect(window.locator('//*[@aria-label="obs-navigation"]')).toBeVisible() + await window.locator('//*[@aria-label="obs-navigation"]').click() + await window.locator('//*[@aria-label="12"]').click(); + await expect(window.locator('//*[@name="12. The Exodus"]')).toBeVisible() + await window.locator('//*[@name="12. The Exodus"]').fill('12. The Exodus Edit title') + const title = await window.textContent('//*[@name="12. The Exodus Edit title"]') expect(title).toBe('12. The Exodus Edit title'); }); diff --git a/e2e-tests/common.js b/e2e-tests/common.js index 02bf052ce..be3b678d0 100644 --- a/e2e-tests/common.js +++ b/e2e-tests/common.js @@ -209,7 +209,7 @@ export const exportProject = async (window, expect, projectname) => { } export const archivedProjects = async (window, expect, projectname) => { - await expect(window.locator('//*[@id="projects-list"]')).toBeVisible() + await expect(await 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') @@ -217,16 +217,17 @@ export const archivedProjects = async (window, expect, projectname) => { const row = await rows.nth(i); const tds = await row.locator('td'); if (await tds.nth(1).textContent() === projectname) { - expect(await tds.first().locator('[aria-label=unstar-project]')).toBeVisible() + 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="archive-project"]').click() expect(await rows.count()).toBe(4) await window.locator('//*[@aria-label="archive-active-button"]').click() + const title = await window.locator('//*[@aria-label="projects"]').textContent() + expect(await title).toBe("Archived projects") const projectName = await window.innerText(`//div[@id="${projectname}"]`) expect(projectName).toBe(projectname); - } } await window.locator('//*[@aria-label="archive-active-button"]').click() @@ -236,7 +237,7 @@ export const archivedProjects = async (window, expect, projectname) => { export const unarchivedProjects = async (window, expect, projectname) => { await window.locator('//*[@aria-label="archive-active-button"]').click() - await expect(window.locator('//*[@id="projects-list"]')).toBeVisible() + await expect(await 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') @@ -244,11 +245,12 @@ export const unarchivedProjects = async (window, expect, projectname) => { const row = await rows.nth(i); const tds = await row.locator('td'); if (await tds.nth(1).textContent() === projectname) { - expect(await tds.first().locator('[aria-label=unstar-project]')).toBeVisible() + 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="archive-project"]').click() - expect(await rows.count()).toBe(2) + await window.waitForTimeout(500) + expect(await rows.count()).toBe(0) const title = await window.locator('//*[@aria-label="projects"]').textContent() expect(await title).toBe("Archived projects") } diff --git a/renderer/src/components/EditorPage/ObsEditor/NavigationObs.js b/renderer/src/components/EditorPage/ObsEditor/NavigationObs.js index a64c5be77..02a62a7e3 100644 --- a/renderer/src/components/EditorPage/ObsEditor/NavigationObs.js +++ b/renderer/src/components/EditorPage/ObsEditor/NavigationObs.js @@ -31,6 +31,7 @@ const SelectFile = ({ openChapter, onChapterSelect }) => ( onClick={(e) => { onChapterSelect(e, i + 1); }} className={styles.select} tabIndex={0} + aria-label={i+1} > {i + 1} diff --git a/renderer/src/components/Resources/ResourceUtils/CustomMultiComboBox.js b/renderer/src/components/Resources/ResourceUtils/CustomMultiComboBox.js index 2810b102d..c9eaf47eb 100644 --- a/renderer/src/components/Resources/ResourceUtils/CustomMultiComboBox.js +++ b/renderer/src/components/Resources/ResourceUtils/CustomMultiComboBox.js @@ -32,7 +32,7 @@ function CustomMultiComboBox({ className="w-full border-none py-2 pl-3 pr-10 text-sm leading-5 text-gray-900 focus:ring-0" // displayValue={(language) => language?.ang} displayValue={(selectedList) => `${selectedList.length > 0 ? `${selectedList[0][filterParams]}${multiSelect ? '... click for more' : ''}` : ''}`} - placeholder={placeholder === 'Select Language' ? t('label-lang') : ''} + placeholder="Select Language" onFocus={() => !open && setIsActive(true)} onBlur={() => setIsActive(false)} onChange={(event) => setQuery(event.target.value)} diff --git a/renderer/src/modules/editor/Editor.js b/renderer/src/modules/editor/Editor.js index dcdf2e8e7..300b60d79 100644 --- a/renderer/src/modules/editor/Editor.js +++ b/renderer/src/modules/editor/Editor.js @@ -181,6 +181,7 @@ export default function Editor({ lineHeight: (fontSize > 1.3) ? 1.5 : '', direction: `${projectScriptureDir === 'RTL' ? 'rtl' : 'auto'}`, }} + aria-label='editor' className="border-l-2 border-r-2 border-secondary pb-16 max-w-none overflow-auto h-full scrollbars-width" > {children}