Skip to content

Conversation

@Bharath-K-Shetty
Copy link
Contributor

@Bharath-K-Shetty Bharath-K-Shetty commented Aug 17, 2025

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

This PR adds comprehensive end-to-end tests for the TranslationBuilder component to ensure proper functionality and user experience across different workflows.

  • Added 8 comprehensive test workflows covering TranslationBuilder functionality
  • Added robust selectors and waiting mechanisms for Carbon Design System components
  • Scoped selectors to avoid conflicts with duplicate elements (e.g., language dropdowns)

Test Coverage

  1. Basic Translation Builder Display - Verifies core UI components are rendered
  2. Language Selection and Switching - Tests language dropdown functionality
  3. Translation Filtering by Tabs - Tests All/Translated/Untranslated filtering
  4. Translation Search Functionality - Tests search input and filtering
  5. Edit Individual Translation - Tests editing translations through modal
  6. Download Translation File - Tests download functionality
  7. Upload Translation File - Tests upload button functionality
  8. Translation State Management - Tests translation entry interactions

Screenshots

Related Issue

https://openmrs.atlassian.net/browse/O3-4968

Other

@Bharath-K-Shetty Bharath-K-Shetty marked this pull request as ready for review August 21, 2025 12:19
@gracepotma
Copy link
Contributor

Tests are so important. Thank you so much @Bharath-K-Shetty for your continued work on this really important tooling!!

Copy link
Collaborator

@NethmiRodrigo NethmiRodrigo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Close @Bharath-K-Shetty, a few more changes

@Bharath-K-Shetty
Copy link
Contributor Author

All test workflows works good now. @NethmiRodrigo

Screenshot 2025-08-24 101305

await addFormResources(api, valueReference, formUuid);
});

test('Manage translations: switch languages, filter, and search', async ({ page }) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Steps should go like this,

When I open the language dropdown
Then I should see the language list
And I should see "English (en)" in the language list

When I select the "All" translations tab
Then the "All" translations tab should be selected

When I select the "Translated" translations tab
Then I should see 0 "translated" entries

When I select the "Untranslated" translations tab
Then the "Untranslated" translations tab should be selected
And I should see at least 1 "untranslated" entry

When I search translations for "Visit Details"
Then the translation search input should contain "Visit Details"
And I should see at least 1 translation result
And the first translation result should be visible

await expect(results).not.toHaveCount(0);
});

await test.step('And the first translation result should be visible', async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Shouldn't this include that the translation result should contain the word visit details?

labelText={t('translationValue', 'Translated Value')}
value={newValue}
onChange={(e) => setNewValue(e.target.value)}
data-testid="translation-value-input"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Is the data test id necessary? Can't we target the button from the label text?

onClick={() => handleEditClick(key)}
size="md"
className={styles.deleteButton}
data-testid="edit-translation-button"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here about the label

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants