Skip to content

Conversation

@Oknarb258
Copy link
Contributor

Proposed Changes

Added comprehensive widget tests for the exercise contribution screen, covering form validation, stepper navigation, provider integration, submission flow, and access control for verified users. Improved test structure and localization handling for consistency across all steps.

Related Issue(s)

No related issue.

Please check that the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)
  • Set a 100 character limit in your editor/IDE to avoid white space diffs in the PR
    (run dart format .)
  • Updated/added relevant documentation (doc comments with ///).
  • Added relevant reviewers.

@Oknarb258
Copy link
Contributor Author

@rolandgeider pull request is ready for review!

@rolandgeider
Copy link
Member

@Oknarb258 one of the new tests is failing 😆

@Oknarb258
Copy link
Contributor Author

@rolandgeider i think that it was caused by the missing mock file, i uploaded it and maybe the test will run now in order

@rolandgeider
Copy link
Member

probably, I also often forget to regenerate them

/// - User profile with isTrustworthy = true
/// - Categories, muscles, equipment, and languages data
/// - All properties required by the 6-step stepper form
void setupVerifiedUser() {
Copy link
Member

Choose a reason for hiding this comment

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

isn't this called on every test? why not call it from within setUp?

In any case better call it something else, since it does a bit more than setting up a user 😄

final l10n = AppLocalizations.of(context);

// Find the Next button (use .first since there are 6 steps with 6 Next buttons)
final nextButton = find.widgetWithText(ElevatedButton, l10n.next).first;
Copy link
Member

Choose a reason for hiding this comment

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

as a note to myself in the future, it's probably a good idea to add keys to navigation widgets so that they can be more robustly accessed in tests

await tester.pumpAndSettle();

// Verify that multi-line text was accepted and is displayed
expect(find.text('Chest Press\nFlat Bench Press'), findsOneWidget);
Copy link
Member

Choose a reason for hiding this comment

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

we could also test here that the names are properly read into individual elements in the alternateNamesEn list

@rolandgeider rolandgeider merged commit 7589160 into wger-project:master Nov 18, 2025
2 of 3 checks passed
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.

2 participants