From 4dd058deb200c72fa2b86648bb8d9d410f859835 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Wed, 9 Feb 2022 11:46:27 -0500 Subject: [PATCH] tweaks to run-tests.sh ro run on mac; wiring in gherkin ui tests to drone --- .drone.yml | 37 ++++++++++++++++++++++++++++--------- .gitignore | 6 ++++++ run-tests.sh | 28 ++++++++++++++++++++++------ 3 files changed, 56 insertions(+), 15 deletions(-) diff --git a/.drone.yml b/.drone.yml index 71e49b10..fb14e2a0 100644 --- a/.drone.yml +++ b/.drone.yml @@ -60,6 +60,25 @@ steps: - tar -czf cwtch-`cat ../VERSION`.tar.gz cwtch - rm -r cwtch + - name: widget-tests + image: cirrusci/flutter:2.8.0 + volumes: + - name: deps + path: /root/.pub-cache + commands: + # - flutter config --enable-linux-desktop + - flutter test --coverage + - genhtml coverage/lcov.info -o coverage/html + + - name: ui-tests + image: openpriv/flutter-desktop:linux-fstable-2.8.0 + volumes: + - name: deps + path: /root/.pub-cache + commands: + - ./run-tests.sh + - cp integration_test/gherkin/reports/cucumber_report.html deploy/linux_cucumber_report.html + - name: test-build-android image: cirrusci/flutter:2.8.0 when: @@ -94,15 +113,6 @@ steps: - cp build/app/outputs/apk/release/app-release.apk deploy/ #- cp build/app/outputs/flutter-apk/app-debug.apk deploy/android - - name: widget-tests - image: cirrusci/flutter:2.8.0 - volumes: - - name: deps - path: /root/.pub-cache - commands: - # - flutter config --enable-linux-desktop - - flutter test --coverage - - genhtml coverage/lcov.info -o coverage/html - name: deploy-buildfiles image: kroniak/ssh-client @@ -336,6 +346,15 @@ steps: - mkdir -p deploy - mv Cwtch.dmg deploy + - name: ui-tests + commands: + - export PATH=$PATH:/Users/Dan/development/flutter/bin + - export GEM_HOME=$HOME/.gem + - export PATH=$GEM_HOME/ruby/2.6.0/bin:$PATH + - flutter doctor + - ./run-tests.sh + - cp integration_test/gherkin/reports/cucumber_report.html deploy/macos_cucumber_report.html + - name: deploy-buildfiles environment: BUILDFILES_KEY: diff --git a/.gitignore b/.gitignore index c2dfc6e5..34f777bf 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,12 @@ app.*.symbols # Obfuscation related app.*.map.json +# Gherkin +run-tests.env +test1 +test2 +testHome + linux/tor linux/libCwtch.so android/cwtch/cwtch.aar diff --git a/run-tests.sh b/run-tests.sh index bb6e046e..ee881e91 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -1,18 +1,34 @@ #!/bin/bash +OS=$(uname) + +DEVICE=linux +if [ "$OS" == "Darwin" ]; then + DEVICE=macos +fi + if [ ! -e run-tests.env ]; then echo "#!/bin/bash" > run-tests.env - echo "LDPATH=./linux/" >> run-tests.env - echo "HEADLESS=false" >> run-tests.env + if [ "$OS" == "Linux" ]; then + echo "LDPATH=./linux/" >> run-tests.env + else + echo "LDPATH=./" >> run-tests.env + fi + if [ -z $DRONE ]; then + echo "HEADLESS=false" >> run-tests.env + else + echo "HEADLESS=true" >> run-tests.env + fi fi source run-tests.env -paths=$(find . -wholename "./integration_test/features/*/$1*.feature" | sort | sed -z "s/\\n/','/g;s/,'$//;s/^/'/") +#paths=$(find . -wholename "./integration_test/features/*/$1*.feature" | sort | sed -z "s/\\n/','/g;s/,'$//;s/^/'/") +# macos sed doesn't have -z +paths=$(find . -wholename "./integration_test/features/*/$1*.feature" | sort | awk '!/0$/{printf $0}/0$/' | sed "s/\.\//','\.\//g;s/^','/'/g;s/$/'/g") sed "s|featurePaths: REPLACED_BY_SCRIPT|featurePaths: [$paths]|" integration_test/gherkin_suite_test.editable.dart > integration_test/gherkin_suite_test.dart -flutter pub run build_runner clean +# flutter pub run build_runner clean flutter pub run build_runner build --delete-conflicting-outputs -pkill tor -LD_LIBRARY_PATH=$LDPATH CWTCH_HOME=./integration_test/env/temp/ flutter drive --headless --dart-define TEST_MODE=true --driver=test_driver/integration_test_driver.dart --target=integration_test/gherkin_suite_test.dart +LD_LIBRARY_PATH=$LDPATH DYLD_LIBRARY_PATH=$LDPATH CWTCH_HOME=./integration_test/env/temp/ flutter drive --headless --dart-define TEST_MODE=true --driver=test_driver/integration_test_driver.dart --target=integration_test/gherkin_suite_test.dart -d $DEVICE node index2.js if [ "$HEADLESS" = "false" ]; then xdg-open integration_test/gherkin/reports/cucumber_report.html