-
Notifications
You must be signed in to change notification settings - Fork 825
feat: added integration tests #2853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's GuideThis PR establishes an end-to-end integration test suite that traverses the core app flow to capture up‐to‐date screenshots, introduces unique keys for reliable UI element identification, cleans up localization definitions, refactors scaffold key handling, and patches data initialization and permission flows to ensure test stability. Entity relationship diagram for new instrument screen keyserDiagram
INSTRUMENTS_SCREEN {
string instrumentsScreenTitleKey
}
ACCELEROMETER_SCREEN {
string accelerometerScreenTitleKey
}
MULTIMETER_SCREEN {
string multimeterScreenTitleKey
}
WAVE_GENERATOR_SCREEN {
string waveGeneratorScreenTitleKey
}
OSCILLOSCOPE_SCREEN {
string oscilloscopeScreenTitleKey
}
POWER_SOURCE_SCREEN {
string powerSourceScreenTitleKey
}
INSTRUMENTS_SCREEN ||--|| ACCELEROMETER_SCREEN : identifies
INSTRUMENTS_SCREEN ||--|| MULTIMETER_SCREEN : identifies
INSTRUMENTS_SCREEN ||--|| WAVE_GENERATOR_SCREEN : identifies
INSTRUMENTS_SCREEN ||--|| OSCILLOSCOPE_SCREEN : identifies
INSTRUMENTS_SCREEN ||--|| POWER_SOURCE_SCREEN : identifies
Class diagram for updated AccelerometerStateProvider data initializationclassDiagram
class AccelerometerStateProvider {
- List<double> _xData
- List<double> _yData
- List<double> _zData
+ List<FlSpot> xData = [FlSpot(0, 0)]
+ List<FlSpot> yData = [FlSpot(0, 0)]
+ List<FlSpot> zData = [FlSpot(0, 0)]
- int _maxLength
- double _xMin
- double _xMax
}
Class diagram for MainScaffoldWidget scaffold key refactorclassDiagram
class MainScaffold {
+ Key? scaffoldKey
+ String title
}
class _MainScaffoldState {
+ build()
}
MainScaffold <|-- _MainScaffoldState
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes - here's some feedback:
- Replace the multiple fixed-duration pumps (e.g. pump(const Duration(seconds: 5))) with event-driven waits or reuse pumpUntilFound to make the integration test faster and more reliable.
- Inject or mock the microphone permission request in tests (instead of real Permission.microphone.request()) to avoid system dialogs blocking the CI run.
- Use the localized string for the oscilloscope title rather than a hard-coded 'Oscilloscope' literal to keep titles consistent and localizable.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Replace the multiple fixed-duration pumps (e.g. pump(const Duration(seconds: 5))) with event-driven waits or reuse pumpUntilFound to make the integration test faster and more reliable.
- Inject or mock the microphone permission request in tests (instead of real Permission.microphone.request()) to avoid system dialogs blocking the CI run.
- Use the localized string for the oscilloscope title rather than a hard-coded 'Oscilloscope' literal to keep titles consistent and localizable.
## Individual Comments
### Comment 1
<location> `lib/providers/accelerometer_state_provider.dart:18` </location>
<code_context>
- final List<FlSpot> xData = [];
- final List<FlSpot> yData = [];
- final List<FlSpot> zData = [];
+ final List<FlSpot> xData = [const FlSpot(0, 0)];
+ final List<FlSpot> yData = [const FlSpot(0, 0)];
+ final List<FlSpot> zData = [const FlSpot(0, 0)];
final int _maxLength = 50;
</code_context>
<issue_to_address>
Initializing xData, yData, and zData with a default value may affect chart rendering.
Initializing with FlSpot(0, 0) may cause an unintended data point to appear. If this is not desired, use empty lists and update your chart to handle cases with no data.
Suggested implementation:
```
final List<FlSpot> xData = [];
final List<FlSpot> yData = [];
final List<FlSpot> zData = [];
```
You should review the chart rendering logic to ensure it does not fail or display incorrectly when these lists are empty. For example, you may need to add checks to avoid rendering the chart or show a placeholder when there is no data.
</issue_to_address>
### Comment 2
<location> `lib/view/widgets/channel_parameters_widget.dart:250` </location>
<code_context>
groupValue:
oscilloscopeStateProvider.isInBuiltMICSelected,
- onChanged: (bool? value) {
+ onChanged: (bool? value) async {
+ await Permission.microphone.request();
setState(
() {
</code_context>
<issue_to_address>
Requesting microphone permission on every RadioGroup change may be redundant.
Repeatedly requesting microphone permission on every radio button change can disrupt the user experience. Only request permission when the microphone option is selected and permission hasn't been granted yet.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
Build successful. APKs to test: https://github.com/fossasia/pslab-app/actions/runs/17077638979/artifacts/3801535968 |
ed1401f to
954bb50
Compare
Fixes #2842.
Adds an integration test covering the app flow, also used to obtain screenshots.
More specifically, this PR:
Screenshots / Recordings
Complete run of the test:
https://www.loom.com/share/e7896865513d4a11a8d308dff68f0b9a?sid=5ac03f8f-713a-4e4a-8510-3d6a000da1f3
Summary by Sourcery
Add a full app end-to-end integration test suite with screenshot capture, instrument screen key identifiers, and supporting fixes for data initialization, permissions, and localization to ensure test stability
New Features:
Bug Fixes:
Enhancements:
Build:
Tests: