Skip to content

Commit

Permalink
Display drawer based on screen size
Browse files Browse the repository at this point in the history
  • Loading branch information
Serious-senpai committed Dec 19, 2024
1 parent d8ed557 commit a2fbe9c
Show file tree
Hide file tree
Showing 5 changed files with 247 additions and 208 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ jobs:
VNPAY_SECRET_KEY: ${{ secrets.VNPAY_SECRET_KEY }}
PORT: 8000

strategy:
matrix:
resolution: [375x667x24, 1024x768x32, 1920x1080x24]

steps:
- name: Download repository
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -146,7 +150,7 @@ jobs:
- name: Run integration tests
timeout-minutes: 30
working-directory: app/resident_manager
run: xvfb-run flutter test integration_test
run: xvfb-run --server-args="-screen 0 ${{ matrix.resolution }}" flutter test integration_test

- name: Stop API server
run: |
Expand All @@ -165,7 +169,7 @@ jobs:
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-flutter-integration
name: coverage-flutter-integration-${{ matrix.resolution }}
path: .coverage.flutter-integration
include-hidden-files: true

Expand Down
49 changes: 35 additions & 14 deletions app/resident_manager/integration_test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import "package:integration_test/integration_test.dart";
import "package:resident_manager/main.dart";
import "package:resident_manager/src/config.dart";
import "package:resident_manager/src/state.dart";
import "package:resident_manager/src/utils.dart";
import "package:resident_manager/src/widgets/home.dart";
import "package:resident_manager/src/widgets/login.dart";
import "package:resident_manager/src/widgets/register.dart";
Expand Down Expand Up @@ -113,6 +114,9 @@ void main() {
testWidgets(
"Administrator login",
(tester) async {
final screenSize = tester.view.physicalSize;
final hiddenDrawer = screenSize.width < ScreenWidth.EXTRA_LARGE;

final state = ApplicationState();
await state.prepare();
await state.deauthorize(); // Start integration test without existing authorization data
Expand All @@ -132,26 +136,32 @@ void main() {
await pumpUntilFound((widget) => widget is RegisterQueuePage, findsOneWidget, tester);

// Open drawer
await tester.tap(find.byIcon(Icons.menu_outlined));
await tester.pumpAndSettle();
if (hiddenDrawer) {
await tester.tap(find.byIcon(Icons.menu_outlined));
await tester.pumpAndSettle();
}

// Open residents list
await tester.tap(find.byIcon(Icons.people_outlined));
await tester.pumpAndSettle();
expect(find.byWidgetPredicate((widget) => widget is ResidentsPage), findsOneWidget);

// Open drawer
await tester.tap(find.byIcon(Icons.menu_outlined));
await tester.pumpAndSettle();
if (hiddenDrawer) {
await tester.tap(find.byIcon(Icons.menu_outlined));
await tester.pumpAndSettle();
}

// Open rooms list
await tester.tap(find.byIcon(Icons.room_outlined));
await tester.pumpAndSettle();
expect(find.byWidgetPredicate((widget) => widget is RoomsPage), findsOneWidget);

// Open drawer
await tester.tap(find.byIcon(Icons.menu_outlined));
await tester.pumpAndSettle();
if (hiddenDrawer) {
await tester.tap(find.byIcon(Icons.menu_outlined));
await tester.pumpAndSettle();
}

// Logout
await tester.tap(find.byIcon(Icons.logout_outlined));
Expand All @@ -164,6 +174,9 @@ void main() {
testWidgets(
"Resident registration",
(tester) async {
final screenSize = tester.view.physicalSize;
final hiddenDrawer = screenSize.width < ScreenWidth.EXTRA_LARGE;

final state = ApplicationState();
await state.prepare();
await state.deauthorize(); // Start integration test without existing authorization data
Expand Down Expand Up @@ -266,8 +279,10 @@ void main() {
await tester.drag(find.byType(CustomScrollView), const Offset(0, -100));

// Open drawer
await tester.tap(find.byIcon(Icons.menu_outlined));
await tester.pumpAndSettle();
if (hiddenDrawer) {
await tester.tap(find.byIcon(Icons.menu_outlined));
await tester.pumpAndSettle();
}

// Logout
await tester.tap(find.byIcon(Icons.logout_outlined));
Expand All @@ -289,8 +304,10 @@ void main() {
await pumpUntilFound((widget) => widget is HomePage, findsOneWidget, tester);

// Open drawer
await tester.tap(find.byIcon(Icons.menu_outlined));
await tester.pumpAndSettle();
if (hiddenDrawer) {
await tester.tap(find.byIcon(Icons.menu_outlined));
await tester.pumpAndSettle();
}

// Logout
await tester.tap(find.byIcon(Icons.logout_outlined));
Expand All @@ -312,8 +329,10 @@ void main() {
await pumpUntilFound((widget) => widget is RegisterQueuePage, findsOneWidget, tester);

// Open drawer
await tester.tap(find.byIcon(Icons.menu_outlined));
await tester.pumpAndSettle();
if (hiddenDrawer) {
await tester.tap(find.byIcon(Icons.menu_outlined));
await tester.pumpAndSettle();
}

// View resident list
await tester.tap(find.byIcon(Icons.people_outlined));
Expand Down Expand Up @@ -406,8 +425,10 @@ void main() {
await tester.drag(find.byType(CustomScrollView), const Offset(0, -100));

// Open drawer
await tester.tap(find.byIcon(Icons.menu_outlined));
await tester.pumpAndSettle();
if (hiddenDrawer) {
await tester.tap(find.byIcon(Icons.menu_outlined));
await tester.pumpAndSettle();
}

// Logout
await tester.tap(find.byIcon(Icons.logout_outlined));
Expand Down
Loading

0 comments on commit a2fbe9c

Please sign in to comment.