Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
ef2959e
Workflow 1: Basic Translation Builder Display
Bharath-K-Shetty Aug 15, 2025
f6514ea
Workflow 2: Language Selection and Switching
Bharath-K-Shetty Aug 15, 2025
3be06ac
Merge branch 'main' into test/O3-4968
Bharath-K-Shetty Aug 17, 2025
2bec8c3
Added remaining e2e tests to Translation Builder
Bharath-K-Shetty Aug 21, 2025
ed1dfe7
Merge branch 'main' of https://github.com/Bharath-K-Shetty/openmrs-es…
Bharath-K-Shetty Aug 21, 2025
90abacd
Merge branch 'test/O3-4968' of https://github.com/Bharath-K-Shetty/op…
Bharath-K-Shetty Aug 21, 2025
977c97f
Merge branch 'main' into test/O3-4968
Bharath-K-Shetty Aug 21, 2025
f93ebdc
Merge branch 'main' of https://github.com/Bharath-K-Shetty/openmrs-es…
Bharath-K-Shetty Aug 23, 2025
95d0bd9
Refined the e2e test workflows
Bharath-K-Shetty Aug 23, 2025
fae2941
Merge branch 'test/O3-4968' of https://github.com/Bharath-K-Shetty/op…
Bharath-K-Shetty Aug 23, 2025
dee15b2
Updated the step names
Bharath-K-Shetty Aug 23, 2025
4b007ba
Added workflow for upload and download translation file
Bharath-K-Shetty Aug 23, 2025
833dfdc
Merge branch 'main' into test/O3-4968
Bharath-K-Shetty Aug 24, 2025
7090561
Made all the tests pass
Bharath-K-Shetty Aug 24, 2025
49fe191
Merge branch 'test/O3-4968' of https://github.com/Bharath-K-Shetty/op…
Bharath-K-Shetty Aug 24, 2025
2581cb8
Merge branch 'main' into test/O3-4968
Bharath-K-Shetty Aug 25, 2025
9f73bc6
Merge branch 'main' into test/O3-4968
Bharath-K-Shetty Aug 25, 2025
5bf32e7
Merge branch 'main' into test/O3-4968
Bharath-K-Shetty Aug 26, 2025
03cf72e
Merge branch 'main' of https://github.com/Bharath-K-Shetty/openmrs-es…
Bharath-K-Shetty Aug 26, 2025
e9871f9
Merge branch 'main' into test/O3-4968
NethmiRodrigo Aug 27, 2025
4d2d42e
remove eslint-disable and update to use formBuilderPage.page queries
Bharath-K-Shetty Aug 27, 2025
cd025b2
Merge branch 'main' of https://github.com/Bharath-K-Shetty/openmrs-es…
Bharath-K-Shetty Aug 27, 2025
04820c4
Merge branch 'test/O3-4968' of https://github.com/Bharath-K-Shetty/op…
Bharath-K-Shetty Aug 27, 2025
76adcd2
Merge branch 'main' into test/O3-4968
Bharath-K-Shetty Aug 27, 2025
78a81e4
Merge branch 'main' into test/O3-4968
Bharath-K-Shetty Aug 28, 2025
6891076
Merge branch 'main' of https://github.com/Bharath-K-Shetty/openmrs-es…
Bharath-K-Shetty Aug 29, 2025
96485a8
Refined the step names of the workflows
Bharath-K-Shetty Aug 29, 2025
8eec6a6
Merge branch 'test/O3-4968' of https://github.com/Bharath-K-Shetty/op…
Bharath-K-Shetty Aug 29, 2025
fbbed14
Merge branch 'main' of https://github.com/Bharath-K-Shetty/openmrs-es…
Bharath-K-Shetty Aug 30, 2025
b1af41d
Update the step names of the upload translation workflow
Bharath-K-Shetty Aug 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions e2e/pages/form-builder-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,22 @@ export class FormBuilderPage {
readonly questionIdInput = () => this.page.getByRole('textbox', { name: /question id/i });
readonly questionCreatedMessage = () => this.page.getByText(/new question created/i);

readonly translationBuilderTab = () => this.page.getByRole('tab', { name: /translation builder/i });
readonly translationBuilderPanel = () =>
this.page.getByRole('tabpanel').filter({ has: this.page.getByRole('button', { name: /upload translation/i }) });
readonly languageDropdown = () => this.translationBuilderPanel().locator('#target-language');
readonly downloadTranslationButton = () => this.page.getByRole('button', { name: /download translation/i });
readonly uploadTranslationButton = () => this.page.getByRole('button', { name: /upload translation/i });
readonly translationSearchInput = () => this.page.getByPlaceholder(/search translation keys/i);
readonly allTranslationsTab = () => this.page.getByRole('tab', { name: 'All' });
readonly translatedTab = () => this.page.getByRole('tab', { name: 'Translated' });
readonly untranslatedTab = () => this.page.getByRole('tab', { name: 'Untranslated' });
readonly editTranslationButton = (index: number = 0) =>
this.page.locator('[data-testid="edit-translation-button"]').nth(index);
readonly translationModal = () => this.page.getByRole('dialog');
readonly translationValueInput = () => this.page.getByLabel(/translation value/i);
readonly saveTranslationButton = () => this.page.getByRole('button', { name: /save/i });

async gotoFormBuilder() {
await this.page.goto('form-builder');
}
Expand Down
98 changes: 98 additions & 0 deletions e2e/specs/translation-builder-workflows.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/* eslint-disable testing-library/prefer-screen-queries */
import { test } from '../core';
import { expect } from '@playwright/test';
import { deleteForm, createForm, createValueReference, addFormResources } from '../commands/form-operations';
import { FormBuilderPage } from '../pages';

let formUuid = '';

const formDetails = {
name: 'Covid-19 Screening',
description: 'A test form for recording COVID-19 screening information',
version: '1.0',
published: true,
};

test.describe('Translation Builder Workflows', () => {
test.beforeEach(async ({ api }) => {
const form = await createForm(api, false, formDetails);
formUuid = form.uuid;

const valueReference = await createValueReference(api);
await addFormResources(api, valueReference, formUuid);
});

test.afterEach(async ({ api }) => {
if (formUuid) {
await deleteForm(api, formUuid);
}
});

test('Workflow 1: Basic Translation Builder Display', async ({ page }) => {
const formBuilderPage = new FormBuilderPage(page);

await test.step('Navigate to form builder', async () => {
await formBuilderPage.gotoFormBuilder();
});

await test.step('Search and open the test form', async () => {
await formBuilderPage.searchForForm(formDetails.name);
await formBuilderPage.page.getByRole('row', { name: formDetails.name }).getByLabel('Edit Schema').first().click();
});

await test.step('Open translation builder tab', async () => {
await formBuilderPage.translationBuilderTab().click();
});

await test.step('Verify translation builder components are displayed', async () => {
const translationPanel = formBuilderPage.page
.getByRole('tabpanel')
.filter({ has: formBuilderPage.page.getByRole('button', { name: /upload translation/i }) });

await expect(translationPanel).toBeVisible();
await expect(translationPanel.getByRole('button', { name: /download translation/i })).toBeVisible();
await expect(translationPanel.getByRole('button', { name: /upload translation/i })).toBeVisible();
const tabList = translationPanel.getByRole('tablist', { name: 'Translation filter' });
await expect(tabList).toBeVisible();

const tabs = tabList.getByRole('tab');
await expect(tabs).toHaveCount(3);
await expect(tabs.nth(0)).toContainText(/all/i);
await expect(tabs.nth(1)).toContainText(/translated/i);
await expect(tabs.nth(2)).toContainText(/untranslated/i);
await expect(translationPanel.getByPlaceholder(/search translation keys/i)).toBeVisible();
});
});

test('Workflow 2: Language Selection and Switching', async ({ page }) => {
const formBuilderPage = new FormBuilderPage(page);

await test.step('Navigate to form builder and open translation builder', async () => {
await formBuilderPage.gotoFormBuilder();
await formBuilderPage.searchForForm(formDetails.name);
await formBuilderPage.page.getByRole('row', { name: formDetails.name }).getByLabel('Edit Schema').first().click();
await formBuilderPage.translationBuilderTab().click();
await expect(formBuilderPage.downloadTranslationButton()).toBeVisible();
});

await test.step('Verify language dropdown is present and functional', async () => {
const languageDropdown = formBuilderPage.languageDropdown();
await expect(languageDropdown).toBeVisible();
await expect(languageDropdown).toBeEnabled();
});

await test.step('Open language dropdown and verify available languages', async () => {
await formBuilderPage.languageDropdown().click();

const dropdownMenu = formBuilderPage.translationBuilderPanel().locator('.cds--list-box__menu');
await expect(dropdownMenu).toBeVisible();

const languageOptions = dropdownMenu.getByRole('option');
const optionCount = await languageOptions.count();
expect(optionCount).toBeGreaterThan(0);

await expect(dropdownMenu.getByRole('option', { name: 'English (en)' })).toBeVisible();
await expect(languageOptions.nth(1)).toBeVisible();
});
});
});