Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
Calcitem | 40e6f0a026 |
|
@ -10,7 +10,7 @@ indent_size = 4
|
||||||
end_of_line = lf
|
end_of_line = lf
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
|
|
||||||
[*.{dart,js}]
|
[*.dart]
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
end_of_line = lf
|
end_of_line = lf
|
||||||
|
|
|
@ -7,7 +7,6 @@ andnetwork
|
||||||
APARTMENTTHREADED
|
APARTMENTTHREADED
|
||||||
APIENTRY
|
APIENTRY
|
||||||
appbundle
|
appbundle
|
||||||
appium
|
|
||||||
APSTUDIO
|
APSTUDIO
|
||||||
ARGB
|
ARGB
|
||||||
argc
|
argc
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
name: CUI on macOS
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
paths:
|
|
||||||
- 'src/*.cpp'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: macos-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Export environment valuables
|
|
||||||
run: export
|
|
||||||
|
|
||||||
- name: Print clang version
|
|
||||||
run: g++ -v
|
|
||||||
|
|
||||||
# Build
|
|
||||||
- name: Build CUI
|
|
||||||
run: cd src; make -j build ARCH=x86-64
|
|
||||||
|
|
||||||
# Archive apk
|
|
||||||
- name: Archive CUI
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: sanmill-for-macos
|
|
||||||
path: src/sanmill
|
|
|
@ -1,33 +0,0 @@
|
||||||
name: CUI on Ubuntu
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
paths:
|
|
||||||
- 'src/*.cpp'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Export environment valuables
|
|
||||||
run: export
|
|
||||||
|
|
||||||
- name: Print g++ version
|
|
||||||
run: g++ -v
|
|
||||||
|
|
||||||
- name: Create App version
|
|
||||||
run: git fetch --tags; git tag; git log -n1; bash -x ./version.sh
|
|
||||||
|
|
||||||
# Build
|
|
||||||
- name: Build CUI
|
|
||||||
run: cd src; make -j build ARCH=x86-64
|
|
||||||
|
|
||||||
# Archive apk
|
|
||||||
- name: Archive CUI
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: sanmill-for-linux
|
|
||||||
path: src/sanmill
|
|
|
@ -1,30 +0,0 @@
|
||||||
name: CUI on Windows
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
paths:
|
|
||||||
- 'src/*.cpp'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: windows-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Set up Cygwin
|
|
||||||
uses: egor-tensin/setup-cygwin@v3
|
|
||||||
with:
|
|
||||||
platform: x64
|
|
||||||
packages: make gcc-g++
|
|
||||||
|
|
||||||
# Build
|
|
||||||
- name: Build CUI
|
|
||||||
run: cd src; make -j build ARCH=x86-64
|
|
||||||
|
|
||||||
# Archive apk
|
|
||||||
- name: Archive CUI
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: sanmill-for-cygwin
|
|
||||||
path: src/sanmill.exe
|
|
|
@ -0,0 +1,79 @@
|
||||||
|
name: CUI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- 'src/*.cpp'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
cygwin-g++:
|
||||||
|
runs-on: windows-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up Cygwin
|
||||||
|
uses: egor-tensin/setup-cygwin@v3
|
||||||
|
with:
|
||||||
|
platform: x64
|
||||||
|
packages: make gcc-g++
|
||||||
|
|
||||||
|
# Build
|
||||||
|
- name: Build with cygwin-g++
|
||||||
|
run: cd src; make -j build ARCH=x86-64
|
||||||
|
|
||||||
|
# Archive
|
||||||
|
- name: Archive
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: sanmill_cygwin-g++.exe
|
||||||
|
path: src/sanmill.exe
|
||||||
|
|
||||||
|
linux-g++:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Export environment valuables
|
||||||
|
run: export
|
||||||
|
|
||||||
|
- name: Print g++ version
|
||||||
|
run: g++ -v
|
||||||
|
|
||||||
|
- name: Create version
|
||||||
|
run: git fetch --tags; git tag; git log -n1; bash -x ./version.sh
|
||||||
|
|
||||||
|
# Build
|
||||||
|
- name: Build with linux-g++
|
||||||
|
run: cd src; make -j build ARCH=x86-64
|
||||||
|
|
||||||
|
# Archive
|
||||||
|
- name: Archive
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: sanmill_linux-g++
|
||||||
|
path: src/sanmill
|
||||||
|
|
||||||
|
darwin-g++:
|
||||||
|
runs-on: macos-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Export environment valuables
|
||||||
|
run: export
|
||||||
|
|
||||||
|
- name: Print g++ version
|
||||||
|
run: g++ -v
|
||||||
|
|
||||||
|
# Build
|
||||||
|
- name: Build with darwin-g++
|
||||||
|
run: cd src; make -j build ARCH=x86-64
|
||||||
|
|
||||||
|
# Archive
|
||||||
|
- name: Archive
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: sanmill_darwin-g++
|
||||||
|
path: src/sanmill
|
|
@ -1,23 +0,0 @@
|
||||||
name: Dart Analyze
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
paths:
|
|
||||||
- 'src/ui/flutter_app/**'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
linter:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: Lint flutter code
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Set up Flutter
|
|
||||||
uses: subosito/flutter-action@v1
|
|
||||||
- run: bash -x ./flutter-init.sh
|
|
||||||
- run: cp -f ./src/ui/flutter_app/analysis_options.yaml ./
|
|
||||||
- name: Analyze Flutter
|
|
||||||
uses: ValentinVignal/action-dart-analyze@v0.11
|
|
||||||
with:
|
|
||||||
fail-on: 'format'
|
|
||||||
working-directory: src/ui/flutter_app
|
|
|
@ -6,8 +6,25 @@ on:
|
||||||
- 'src/ui/flutter_app/**'
|
- 'src/ui/flutter_app/**'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
linter:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Lint flutter code
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Set up Flutter
|
||||||
|
uses: subosito/flutter-action@v1
|
||||||
|
- run: bash -x ./flutter-init.sh
|
||||||
|
- run: cp -f ./src/ui/flutter_app/analysis_options.yaml ./
|
||||||
|
- name: Analyze Flutter
|
||||||
|
uses: ValentinVignal/action-dart-analyze@v0.11
|
||||||
|
with:
|
||||||
|
fail-on: 'format'
|
||||||
|
working-directory: src/ui/flutter_app
|
||||||
|
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: linter
|
||||||
|
|
||||||
# Note that this workflow uses the latest stable version of the Dart SDK.
|
# Note that this workflow uses the latest stable version of the Dart SDK.
|
||||||
# Docker images for other release channels - like dev and beta - are also
|
# Docker images for other release channels - like dev and beta - are also
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Sanmill-monkey" type="FlutterRunConfigurationType" factoryName="Flutter">
|
||||||
|
<option name="additionalArgs" value="--dart-define monkey_test=true" />
|
||||||
|
<option name="filePath" value="$PROJECT_DIR$/src/ui/flutter_app/lib/main.dart" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
|
@ -1,7 +0,0 @@
|
||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="Sanmill-test" type="FlutterRunConfigurationType" factoryName="Flutter">
|
|
||||||
<option name="additionalArgs" value="--dart-define test=true" />
|
|
||||||
<option name="filePath" value="$PROJECT_DIR$/src/ui/flutter_app/lib/main.dart" />
|
|
||||||
<method v="2" />
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
|
@ -30,14 +30,14 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Sanmill-test",
|
"name": "Sanmill-monkey",
|
||||||
"type": "dart",
|
"type": "dart",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"cwd": "src/ui/flutter_app",
|
"cwd": "src/ui/flutter_app",
|
||||||
"program": "lib/main.dart",
|
"program": "lib/main.dart",
|
||||||
"args": [
|
"args": [
|
||||||
"--dart-define",
|
"--dart-define",
|
||||||
"test=true"
|
"monkey_test=true"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
"ALIGNAS",
|
"ALIGNAS",
|
||||||
"appbundle",
|
"appbundle",
|
||||||
"Appium",
|
|
||||||
"APSTUDIO",
|
"APSTUDIO",
|
||||||
"ARGB",
|
"ARGB",
|
||||||
"autobuild",
|
"autobuild",
|
||||||
|
@ -127,8 +126,6 @@
|
||||||
"VERSIONINFO",
|
"VERSIONINFO",
|
||||||
"VNNI",
|
"VNNI",
|
||||||
"vsync",
|
"vsync",
|
||||||
"wdio",
|
|
||||||
"webdriverio",
|
|
||||||
"winbase",
|
"winbase",
|
||||||
"winres",
|
"winres",
|
||||||
"winver",
|
"winver",
|
||||||
|
|
|
@ -73,7 +73,7 @@ Run `./flutter-init.sh` , copy `src/ui/flutter_app/android/key.properties.exampl
|
||||||
|
|
||||||
We use compile-time environment configs to enable specific parts of the code:
|
We use compile-time environment configs to enable specific parts of the code:
|
||||||
|
|
||||||
* `test` to prepare the app for Monkey and Appium testing. (References to external sites are going to be disabled.)
|
* `monkey_test` to prepare the app for monkey tests. (References to external sites are going to be disabled.)
|
||||||
* `dev_mode` to show the developer mode without needing to enable it first.
|
* `dev_mode` to show the developer mode without needing to enable it first.
|
||||||
* `catcher` to control the use of catcher. (This is on by default and needs to be disabled when required.)
|
* `catcher` to control the use of catcher. (This is on by default and needs to be disabled when required.)
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@ import 'package:double_back_to_close_app/double_back_to_close_app.dart';
|
||||||
import 'package:feedback/feedback.dart';
|
import 'package:feedback/feedback.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_driver/driver_extension.dart';
|
|
||||||
import 'package:hive_flutter/hive_flutter.dart' show Box;
|
import 'package:hive_flutter/hive_flutter.dart' show Box;
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:sanmill/generated/intl/l10n.dart';
|
import 'package:sanmill/generated/intl/l10n.dart';
|
||||||
|
@ -44,11 +43,7 @@ part 'package:sanmill/services/init_system_ui.dart';
|
||||||
Future<void> main() async {
|
Future<void> main() async {
|
||||||
debugPrint('Environment [catcher]: ${EnvironmentConfig.catcher}');
|
debugPrint('Environment [catcher]: ${EnvironmentConfig.catcher}');
|
||||||
debugPrint('Environment [dev_mode]: ${EnvironmentConfig.devMode}');
|
debugPrint('Environment [dev_mode]: ${EnvironmentConfig.devMode}');
|
||||||
debugPrint('Environment [test]: ${EnvironmentConfig.test}');
|
debugPrint('Environment [monkey_test]: ${EnvironmentConfig.monkeyTest}');
|
||||||
|
|
||||||
if (EnvironmentConfig.test) {
|
|
||||||
enableFlutterDriverExtension();
|
|
||||||
}
|
|
||||||
|
|
||||||
await LocalDatabaseService.initStorage();
|
await LocalDatabaseService.initStorage();
|
||||||
|
|
||||||
|
|
|
@ -993,7 +993,6 @@ class _GamePageState extends State<GamePage>
|
||||||
),
|
),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
key: const Key('infoDialogOkButton'),
|
|
||||||
child:
|
child:
|
||||||
Text(S.of(context).ok, style: AppTheme.moveHistoryTextStyle),
|
Text(S.of(context).ok, style: AppTheme.moveHistoryTextStyle),
|
||||||
onPressed: () => Navigator.pop(context),
|
onPressed: () => Navigator.pop(context),
|
||||||
|
@ -1426,28 +1425,24 @@ class _GamePageState extends State<GamePage>
|
||||||
|
|
||||||
List<Widget> get toolbar {
|
List<Widget> get toolbar {
|
||||||
final gameButton = ToolbarItem.icon(
|
final gameButton = ToolbarItem.icon(
|
||||||
key: const Key('gameButton'),
|
|
||||||
onPressed: onGameButtonPressed,
|
onPressed: onGameButtonPressed,
|
||||||
icon: const Icon(FluentIcons.table_simple_24_regular),
|
icon: const Icon(FluentIcons.table_simple_24_regular),
|
||||||
label: Text(S.of(context).game),
|
label: Text(S.of(context).game),
|
||||||
);
|
);
|
||||||
|
|
||||||
final optionsButton = ToolbarItem.icon(
|
final optionsButton = ToolbarItem.icon(
|
||||||
key: const Key('optionsButton'),
|
|
||||||
onPressed: onOptionButtonPressed,
|
onPressed: onOptionButtonPressed,
|
||||||
icon: const Icon(FluentIcons.settings_24_regular),
|
icon: const Icon(FluentIcons.settings_24_regular),
|
||||||
label: Text(S.of(context).options),
|
label: Text(S.of(context).options),
|
||||||
);
|
);
|
||||||
|
|
||||||
final moveButton = ToolbarItem.icon(
|
final moveButton = ToolbarItem.icon(
|
||||||
key: const Key('moveButton'),
|
|
||||||
onPressed: onMoveButtonPressed,
|
onPressed: onMoveButtonPressed,
|
||||||
icon: const Icon(FluentIcons.calendar_agenda_24_regular),
|
icon: const Icon(FluentIcons.calendar_agenda_24_regular),
|
||||||
label: Text(S.of(context).move_number(0)),
|
label: Text(S.of(context).move_number(0)),
|
||||||
);
|
);
|
||||||
|
|
||||||
final infoButton = ToolbarItem.icon(
|
final infoButton = ToolbarItem.icon(
|
||||||
key: const Key('infoButton'),
|
|
||||||
onPressed: onInfoButtonPressed,
|
onPressed: onInfoButtonPressed,
|
||||||
icon: const Icon(FluentIcons.book_information_24_regular),
|
icon: const Icon(FluentIcons.book_information_24_regular),
|
||||||
label: Text(S.of(context).info),
|
label: Text(S.of(context).info),
|
||||||
|
|
|
@ -22,13 +22,13 @@
|
||||||
class EnvironmentConfig {
|
class EnvironmentConfig {
|
||||||
const EnvironmentConfig._();
|
const EnvironmentConfig._();
|
||||||
|
|
||||||
/// Gets whether we build for Monkey/Appium testing
|
/// gets weather we build for a monkey test
|
||||||
static const test = bool.fromEnvironment('test');
|
static const monkeyTest = bool.fromEnvironment('monkey_test');
|
||||||
|
|
||||||
/// Gets whether we build for devMode
|
/// gets weather we build for devMode
|
||||||
static const devMode = bool.fromEnvironment('dev_mode');
|
static const devMode = bool.fromEnvironment('dev_mode');
|
||||||
|
|
||||||
/// Gets whether we want catcher to be enabled
|
/// gets weather we want catcher to be enabled
|
||||||
/// defaults to true
|
/// defaults to true
|
||||||
static const catcher = bool.fromEnvironment('catcher', defaultValue: true);
|
static const catcher = bool.fromEnvironment('catcher', defaultValue: true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,9 +45,6 @@ dependencies:
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
build_runner: ^2.1.5
|
build_runner: ^2.1.5
|
||||||
copy_with_extension_gen: ^2.0.3
|
copy_with_extension_gen: ^2.0.3
|
||||||
flutter_driver:
|
|
||||||
sdk: flutter
|
|
||||||
|
|
||||||
flutter_gen_runner: ^4.1.2
|
flutter_gen_runner: ^4.1.2
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
@ -58,7 +55,6 @@ dev_dependencies:
|
||||||
lint: ^1.7.2
|
lint: ^1.7.2
|
||||||
msix: ^2.6.2
|
msix: ^2.6.2
|
||||||
source_gen: ^1.1.1
|
source_gen: ^1.1.1
|
||||||
test: any
|
|
||||||
|
|
||||||
flutter_gen:
|
flutter_gen:
|
||||||
output: lib/generated/assets/
|
output: lib/generated/assets/
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
/package-lock.json
|
|
|
@ -1,49 +0,0 @@
|
||||||
# How to Test
|
|
||||||
|
|
||||||
## Environment configuration
|
|
||||||
|
|
||||||
### Install Node.js
|
|
||||||
|
|
||||||
Download and install [Node.js](https://nodejs.org).
|
|
||||||
|
|
||||||
### Install the dependencies
|
|
||||||
|
|
||||||
```shell
|
|
||||||
npm install -g appium
|
|
||||||
npm install -g appium-flutter-driver
|
|
||||||
npm install -g appium-flutter-finder
|
|
||||||
npm install -g cjs
|
|
||||||
npm install -g wd
|
|
||||||
npm install -g webdriverio
|
|
||||||
```
|
|
||||||
|
|
||||||
## Test
|
|
||||||
|
|
||||||
### Run Appium server
|
|
||||||
|
|
||||||
```shell
|
|
||||||
appium --base-path /
|
|
||||||
```
|
|
||||||
|
|
||||||
### Build debug apk
|
|
||||||
|
|
||||||
```shell
|
|
||||||
cd src/ui/flutter_app
|
|
||||||
flutter build apk --debug -v
|
|
||||||
```
|
|
||||||
|
|
||||||
### Start testing
|
|
||||||
|
|
||||||
```shell
|
|
||||||
cd tests/appium
|
|
||||||
npm start
|
|
||||||
```
|
|
||||||
|
|
||||||
### Known issues
|
|
||||||
|
|
||||||
You need to modify app's path in the test.js.
|
|
||||||
|
|
||||||
## Reference
|
|
||||||
|
|
||||||
[Getting Started - Appium](http://appium.io/docs/en/about-appium/getting-started)
|
|
||||||
[GitHub - appium-flutter-driver](https://github.com/appium-userland/appium-flutter-driver)
|
|
|
@ -1,20 +0,0 @@
|
||||||
{
|
|
||||||
"dependencies": {
|
|
||||||
"appium-flutter-finder": "^0.1.0",
|
|
||||||
"cjs": "^0.0.11",
|
|
||||||
"webdriverio": "^7.16.10"
|
|
||||||
},
|
|
||||||
"name": "appium",
|
|
||||||
"description": "https://nodejs.org/en/",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"main": "test.js",
|
|
||||||
"scripts": {
|
|
||||||
"start": "node test.js",
|
|
||||||
"ios": "APPIUM_OS=ios npm start",
|
|
||||||
"android": "APPIUM_OS=android npm start",
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
|
||||||
},
|
|
||||||
"keywords": [],
|
|
||||||
"author": "Calcitem <calcitem@outlook.com>",
|
|
||||||
"license": "GPLv3"
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
const wdio = require('webdriverio');
|
|
||||||
const assert = require('assert');
|
|
||||||
const find = require('appium-flutter-finder');
|
|
||||||
const { compileFunction } = require('vm');
|
|
||||||
|
|
||||||
const opts = {
|
|
||||||
port: 4723,
|
|
||||||
capabilities: {
|
|
||||||
deviceName: "PIXEL 5",
|
|
||||||
platformName: "Android",
|
|
||||||
platformVersion: "12",
|
|
||||||
app: "D:\\repos\\Sanmill\\src\\ui\\flutter_app\\build\\app\\outputs\\flutter-apk\\app-debug.apk",
|
|
||||||
automationName: "Flutter"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
(async () => {
|
|
||||||
const driver = await wdio.remote(opts);
|
|
||||||
await driver.elementClick(find.byValueKey('infoButton'));
|
|
||||||
await driver.elementClick(find.byValueKey('infoDialogOkButton'));
|
|
||||||
})();
|
|
Loading…
Reference in New Issue