Skip to content
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

Listener for airside logs + Widget to display airside logs #22

Merged
merged 34 commits into from
Jul 12, 2024

Conversation

ellyokes253
Copy link
Contributor

No description provided.

Copy link
Contributor

@BalajiLeninrajan BalajiLeninrajan left a comment

Choose a reason for hiding this comment

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

Have you removed the widgets? I don't see them here

Copy link
Contributor

@BalajiLeninrajan BalajiLeninrajan left a comment

Choose a reason for hiding this comment

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

So far so good, the reason it's not displaying is because of the DroneInformation widget, we're going to get that fixed ASAP. Otherwise I suggested pretty minor changes.

Copy link
Contributor

@BalajiLeninrajan BalajiLeninrajan left a comment

Choose a reason for hiding this comment

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

Once you're done with the changes, we can start discussing styling and stuff

Copy link
Contributor

@BalajiLeninrajan BalajiLeninrajan left a comment

Choose a reason for hiding this comment

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

Pretty close to completion, so far so good!

flutter_app/lib/widgets/display_all_logs_widget.dart Outdated Show resolved Hide resolved
flutter_app/lib/screens/log_displayer_screen.dart Outdated Show resolved Hide resolved
flutter_app/lib/screens/home_screen.dart Outdated Show resolved Hide resolved
flutter_app/lib/screens/home_screen.dart Outdated Show resolved Hide resolved
Copy link
Contributor

@BalajiLeninrajan BalajiLeninrajan left a comment

Choose a reason for hiding this comment

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

Great job so far, you're almost done! I left a couple of nitpicks and you'll need to write tests for your widgets and modules

title: Text(fileName),
),
body: SingleChildScrollView(
child: ListTile(
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove unnecessary ListTile

),
body: SingleChildScrollView(
child: ListTile(
title: Text(fileContext),
Copy link
Contributor

Choose a reason for hiding this comment

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

Try adding some padding

child: ListView.builder(
itemCount: getAirsideLogs.getFiles().length,
itemBuilder: (context, index) {
String fileName = getAirsideLogs.getFiles()[index].path;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this looks better

List<String> segs = getAirsideLogs.getFiles()[index].uri.pathSegments;
String fileName = segs.length == 1
    ? segs.last
    : segs.sublist(segs.length - 2, segs.length).join('/');

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe use a better variable name than segs if you decide to make this change

arguments: {
'fileContent': fileContent,
'fileName': fileName,
});
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: add a comma, i.e. '},);'. The formatter will make it look nicer

@@ -21,6 +24,9 @@ class HomePage extends StatelessWidget {
DroneInformation(
getDroneInformation: GetDroneInformation(comm: comm),
),
LogsList(
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove once you're done testing, there will be a task to add the widgets we've developed so far to main in the future

Copy link
Contributor

@BalajiLeninrajan BalajiLeninrajan left a comment

Choose a reason for hiding this comment

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

After you restore home_screen.dart and add tests, you should be done!


class HomePage extends StatelessWidget {
HomePage({Key? key, required this.title}) : super(key: key);

final String title;
final comm =
MavlinkCommunication(MavlinkCommunicationType.tcp, '127.0.0.1', 14550);
static const String pathToDirectory = "C:\\Users\\emmao\\Documents\\logs";
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: replace with single quotes

Copy link
Contributor

@BalajiLeninrajan BalajiLeninrajan left a comment

Choose a reason for hiding this comment

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

Once you restore home_screen.dart you should be good to merge! I terms of feedback it would be better if you could split the tests into multiple groups, but I can understand why you did it this way. Remember that for tests, performance doesn't matter as much, so feel free to initialize somethings more times than is actually required.

testWidgets(
'Displays airside logs by showing their respective path',
(WidgetTester tester) async {
const String pathToDirectory = 'C:\\Users\\emmao\\Documents\\logs';
Copy link
Contributor

Choose a reason for hiding this comment

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

The CI/CD pipeline will fail with the current path, try creating a folder with test logs and pushing that as well. It's not that elegant, but it works (also use unix directory structure: ./folder/subfolder/etc.)

await tester.pumpAndSettle();

expect(find.text(lastFileName),
findsOneWidget); // don't know if this effectively checks if it can scroll
Copy link
Contributor

Choose a reason for hiding this comment

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

Scrolling isn't something that can be tested well, checking for a ScollView or ListView widget usually satisfies though. Usually tester.drag is used for stuff like scrolling to a new page or initiating a function or something, but what you have done here is still a valid test.

Copy link
Contributor

@BalajiLeninrajan BalajiLeninrajan left a comment

Choose a reason for hiding this comment

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

I don't see the test_logs file in the repo rn. Apart from that, restoring main and changing the windows style filepaths to unix style ones (check comments), we should be good to merge this branch. If you have time try splitting your big test into multiple smaller tests (makes it so much easier to debug).


class HomePage extends StatelessWidget {
HomePage({Key? key, required this.title}) : super(key: key);

final String title;
final comm =
MavlinkCommunication(MavlinkCommunicationType.tcp, '127.0.0.1', 14550);
static const String pathToDirectory = 'test\\test_logs';
Copy link
Contributor

Choose a reason for hiding this comment

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

change to test/test_logs

testWidgets(
'Displays airside logs by showing their respective path',
(WidgetTester tester) async {
const String pathToDirectory = 'test\\test_logs';
Copy link
Contributor

Choose a reason for hiding this comment

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

change to test/test_logs

@ellyokes253
Copy link
Contributor Author

ellyokes253 commented Jul 12, 2024

I don't see the test_logs file in the repo rn. Apart from that, restoring main and changing the windows style filepaths to unix style ones (check comments), we should be good to merge this branch. If you have time try splitting your big test into multiple smaller tests (makes it so much easier to debug).

to break the test into smaller tests, would i repeatedly call tester.pumpWidget(), and call GetAirsideLogs within that to separate each thing i'm testing for?

Copy link
Contributor

@BalajiLeninrajan BalajiLeninrajan left a comment

Choose a reason for hiding this comment

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

Lgtm!

@ellyokes253 ellyokes253 merged commit 1b3ce62 into main Jul 12, 2024
1 check passed
@ellyokes253 ellyokes253 deleted the mynewbranch branch July 12, 2024 15:50
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