Skip to content

Commit

Permalink
Feature/more tests (#10)
Browse files Browse the repository at this point in the history
* feat: Add CORS middleware to handle cross-origin requests

* feat: Update launch.json and SpinifyInterface to improve WebSocket handling and add support for Protobuf transport

* feat: Improve WebSocket handling and add Protobuf transport support

* Example of rpc disconnect

* feat: Add support for reconnecting in RPC disconnect method

This commit modifies the RPC disconnect method in the `echo.go` file to add support for reconnecting. It checks if the data parameter contains the string "reconnect" and disconnects the client with reconnection if true. Otherwise, it disconnects the client without reconnection. This enhancement improves the flexibility of the RPC disconnect functionality.

* feat: Add support for reconnecting in RPC disconnect method

* feat: Update timeouts in smoke_test.dart to improve RPC testing

This commit updates the timeouts in the smoke_test.dart file to improve RPC testing. The previous timeouts were [1000, 100, 10, 100, 0], and they have been changed to [200, 50, 10, 25, 0]. This change ensures that the RPC requests are sent and received within the specified time intervals, enhancing the reliability and performance of the RPC functionality.

* feat: Improve WebSocket handling and add Protobuf transport support

* refactor: Update WebSocket handling and Protobuf transport in smoke_test.dart

This commit refactors the WebSocket handling and adds support for Protobuf transport in the smoke_test.dart file. It improves the RPC testing by updating the timeouts from [1000, 100, 10, 100, 0] to [200, 50, 10, 25, 0]. Additionally, it introduces reconnecting functionality in the RPC disconnect method in the echo.go file. The client is now disconnected with reconnection if the data parameter contains the string "reconnect". This enhancement improves the flexibility and reliability of the RPC functionality.

* refactor: Create event queue for socket events

* feat: Add support for reconnecting in RPC disconnect method

* refactor: Update WebSocket handling and Protobuf transport in transport_ws_pb_js.dart

* refactor: Create event queue for socket events

* refactor: Update WebSocket handling and Protobuf transport in transport_ws_pb_js.dart

* refactor: Update WebSocket handling and Protobuf transport in transport_ws_pb_js.dart

* refactor: Update WebSocket handling and Protobuf transport in transport_ws_pb_js.dart

* refactor: Update async_test.dart to improve caching performance

This commit updates the async_test.dart file to improve caching performance. It introduces a cache timer that clears the cache after 5 minutes of inactivity. This enhancement ensures that the cache remains up-to-date and avoids unnecessary memory usage.

* refactor: Update screenshot description in pubspec.yaml

* Fix dart tests

* Add benchmark app

* refactor: Update launch configuration for benchmark in VSCode

This commit updates the launch configuration in the `.vscode/launch.json` file to set up debugging for the benchmark app instead of the example app. The `name` field is changed to "[Flutter] Benchmark" and the `cwd` field is updated to "${workspaceFolder}/benchmark". This change ensures that the correct app is launched and debugged when running the benchmark.

* refactor: Update payload size and message count UI in benchmark app

This commit updates the UI of the benchmark app to improve the user experience when setting the payload size and message count. It adds labels for the payload size and message count sliders, making it easier for users to understand their purpose. Additionally, it adjusts the layout and padding of the UI elements for better visual consistency. These changes enhance the usability of the benchmark app and make it more intuitive for users to configure the payload size and message count.

* refactor: Update BenchmarkController to use abstract base class

This commit updates the `BenchmarkController` class to use an abstract base class called `BenchmarkControllerBase`. This change allows for better code organization and separation of concerns. The `BenchmarkControllerBase` class contains common properties and methods that are shared by different benchmark implementations. By using an abstract base class, it becomes easier to add new benchmark implementations in the future. This refactor improves the maintainability and extensibility of the codebase.

* refactor: Update payload size and message count UI in benchmark app

* refactor: Update payload size and message count UI in benchmark app

* refactor: Update benchmark app UI and status handling

This commit refactors the benchmark app to improve the user interface and status handling. It updates the UI to enhance the user experience when setting the payload size and message count, adding labels for the sliders and adjusting the layout for better visual consistency. Additionally, it introduces a new status property in the `BenchmarkControllerBase` class to track the status of the benchmark, allowing for better communication with the user. These changes improve the usability and clarity of the benchmark app.

* refactor: Update benchmark app UI and status handling

* ```text
refactor: Add constants for JWT token and WebSocket endpoint

This commit adds two constants to the benchmark app: `tokenHmacSecretKey` for the JWT token HMAC key and `defaultEndpoint` for the default WebSocket connection endpoint. These constants provide a centralized and easily configurable way to manage these values throughout the app. By using constants, it improves code readability and maintainability.

* refactor: Add HelpTab to benchmark app UI

This commit adds the HelpTab component to the benchmark app UI. The HelpTab provides helpful information and instructions for using the app, including steps for setting up the benchmark environment and running the benchmark. This addition enhances the usability and user experience of the benchmark app.

* refactor: Update benchmark app UI and status handling

* refactor: Update launch configuration for benchmark in VSCode

* refactor: Update benchmark app UI and status handling

* refactor: Update firebase.json hosting ignore rules

This commit updates the `firebase.json` file to modify the hosting ignore rules. The previous rules were spread across multiple lines, which made the file harder to read and maintain. This change consolidates the ignore rules into a single line, improving the readability and maintainability of the file.

* refactor: Update app titles to include "Spinify"

This commit updates the titles of the benchmark app to include "Spinify" for better branding consistency. The app titles were changed from "Benchmark" to "Spinify Benchmark" in both the main app and the app bar. This change improves the branding and recognition of the app.

* refactor: Update app titles to include "Spinify"

* refactor: Update timestamp in pubspec.yaml.g.dart

This commit updates the timestamp in the pubspec.yaml.g.dart file to reflect the correct build date and time. The previous values were incorrect and have been corrected to ensure accurate tracking of build information. This change improves the reliability and integrity of the build process.

* refactor: Update version to 0.0.2 in pubspec.yaml

* refactor: Update pubspec.yaml to add Protobuf support for WebSockets

* refactor: Update description in pubspec.yaml for Dart and Flutter compatibility

* Update version
  • Loading branch information
PlugFox committed Aug 18, 2024
1 parent da52211 commit aae6784
Show file tree
Hide file tree
Showing 154 changed files with 6,634 additions and 210 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/checkout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
id: verify-versions
timeout-minutes: 1
run: |
test -f pubspec.yaml && test -f lib/src/model/pubspec.yaml.g.dart
test -f pubspec.yaml && test -f lib/src/model/pubspec.yaml.g.dart && test -f CHANGELOG.md
version_pubspec=$(grep '^version:' pubspec.yaml | awk '{print $2}' | sed 's/[^[:print:]]//g')
version_dart=$(grep 'representation: r' lib/src/model/pubspec.yaml.g.dart | awk -F"'" '{print $2}' | sed 's/[^[:print:]]//g')
test -n "$version_pubspec" && test -n "$version_dart"
Expand All @@ -95,6 +95,7 @@ jobs:
echo "$version_pubspec" > /tmp/version_pubspec
echo "$version_dart" > /tmp/version_dart
diff /tmp/version_pubspec /tmp/version_dart
grep -q "# $version_pubspec" CHANGELOG.md || (echo "Version not found in CHANGELOG.md" >&2; exit 1)
- name: 🧪 Run unit tests
id: run-unit-tests
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,7 @@ config.json

# Binaries for programs and plugins
*.exe
*.exe~
*.exe~

# Firebase
.firebase/
41 changes: 29 additions & 12 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,36 @@
{
"version": "0.2.0",
"configurations": [
/* {
"name": "[Flutter] Example (Local)",
{
"name": "[Flutter] Benchmark (debug)",
"request": "launch",
"type": "dart",
"flutterMode": "debug",
"cwd": "${workspaceFolder}/example",
"cwd": "${workspaceFolder}/benchmark",
"program": "lib/main.dart",
"env": {
"ENVIRONMENT": "local"
},
"console": "debugConsole",
"runTestsOnDevice": false,
"toolArgs": [],
"args": [
"--dart-define-from-file=config/local.json"
]
}, */
"args": []
},
{
"name": "[Flutter] Benchmark (release)",
"request": "launch",
"type": "dart",
"flutterMode": "release",
"cwd": "${workspaceFolder}/benchmark",
"program": "lib/main.dart",
"env": {
"ENVIRONMENT": "local"
},
"console": "debugConsole",
"runTestsOnDevice": false,
"toolArgs": [],
"args": []
},
/* {
"name": "[Flutter] Example (Development)",
"request": "launch",
Expand Down Expand Up @@ -84,7 +97,7 @@
"--file-reporter=json:coverage/tests.json",
"--timeout=30s",
"--concurrency=12",
/* "--name=can send binary data" */
/* "--name=Disconnect_permanent" */
],
"args": []
},
Expand Down Expand Up @@ -132,8 +145,10 @@
"--reporter=expanded",
"--platform=vm", // chrome
"--file-reporter=json:coverage/tests.json",
"--timeout=30s",
"--concurrency=12"
"--timeout=5m",
"--concurrency=12",
"--chain-stack-traces",
/* "--name=Disconnect_temporarily" */
],
"args": [],
/* "preLaunchTask": "echo:start",
Expand All @@ -158,8 +173,10 @@
"--platform=chrome",
"--compiler=dart2js",
"--file-reporter=json:coverage/tests.json",
"--timeout=30s",
"--concurrency=12"
"--timeout=5m",
"--concurrency=12",
"--chain-stack-traces",
/* "--name=Connect_and_disconnect" */
],
"args": [],
/* "preLaunchTask": "echo:start",
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.0.2

- Basic functionality implemented

## 0.0.1-pre.9

- **ADDED**: Initial release
5 changes: 5 additions & 0 deletions benchmark/.firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "spinify-benchmark"
}
}
43 changes: 43 additions & 0 deletions benchmark/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.pub-cache/
.pub/
/build/

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
45 changes: 45 additions & 0 deletions benchmark/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: "80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819"
channel: "stable"

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
- platform: android
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
- platform: ios
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
- platform: linux
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
- platform: macos
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
- platform: web
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
- platform: windows
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
13 changes: 13 additions & 0 deletions benchmark/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Spinify: benchmark

## Build

```bash
flutter build web --release --no-source-maps --pwa-strategy offline-first --web-renderer canvaskit --web-resources-cdn --base-href /
```

## Deploy

```bash
firebase deploy --only hosting
```
Loading

0 comments on commit aae6784

Please sign in to comment.