Skip to content

Commit

Permalink
tidy up integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maxisme committed Sep 17, 2021
1 parent a11edc9 commit 214e2f9
Show file tree
Hide file tree
Showing 50 changed files with 59 additions and 21 deletions.
21 changes: 20 additions & 1 deletion .github/workflows/it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
branch: ["master", "develop"]
device: ["emulator-5554", "iPhone 12 Pro Max"]
device: ["emulator-5554", "iPhone 12 Pro Max", "macos"]
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -27,3 +27,22 @@ jobs:
arch: x86_64
profile: Nexus 6P
script: ./test_driver/test.sh "${{ matrix.device }}" "${{ matrix.branch }}" "${{ secrets.B64_ENV }}" "${{ secrets.B64_DEV_ENV }}"

tests-linux:
runs-on: ubuntu-latest
strategy:
matrix:
branch: ["master", "develop"]
device: ["linux"]
steps:
- uses: actions/checkout@v2
with:
ref: "refs/heads/${{ matrix.branch }}"
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- uses: subosito/flutter-action@v1
with:
channel: 'stable'
- name: Test
run: ./test_driver/test.sh "${{ matrix.device }}" "${{ matrix.branch }}" "${{ secrets.B64_ENV }}" "${{ secrets.B64_DEV_ENV }}"
12 changes: 6 additions & 6 deletions .github/workflows/ss.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ jobs:
<h3>iPad</h3>
<img src="https://raw.githubusercontent.com/maxisme/notifi/automated-screenshots-${{ steps.extract_branch.outputs.branch }}/ios/fastlane/screenshots/en-GB/0_APP_IPAD_PRO_129_0.png?raw=true" width="300">
<img src="https://raw.githubusercontent.com/maxisme/notifi/automated-screenshots-${{ steps.extract_branch.outputs.branch }}/ios/fastlane/screenshots/en-GB/1_APP_IPAD_PRO_129_1.png?raw=true" width="300">
<img src="https://raw.githubusercontent.com/maxisme/notifi/automated-screenshots-${{ steps.extract_branch.outputs.branch }}/ios/fastlane/screenshots/en-GB/2_APP_IPAD_PRO_129_1.png?raw=true" width="300">
<img src="https://raw.githubusercontent.com/maxisme/notifi/automated-screenshots-${{ steps.extract_branch.outputs.branch }}/ios/fastlane/screenshots/en-GB/2_APP_IPAD_PRO_129_2.png?raw=true" width="300">
<h3>55"</h3>
<img src="https://raw.githubusercontent.com/maxisme/notifi/automated-screenshots-${{ steps.extract_branch.outputs.branch }}/ios/fastlane/screenshots/en-GB/0_APP_IPHONE_55_0.png?raw=true" width="300">
<img src="https://raw.githubusercontent.com/maxisme/notifi/automated-screenshots-${{ steps.extract_branch.outputs.branch }}/ios/fastlane/screenshots/en-GB/1_APP_IPHONE_55_1.png?raw=true" width="300">
<img src="https://raw.githubusercontent.com/maxisme/notifi/automated-screenshots-${{ steps.extract_branch.outputs.branch }}/ios/fastlane/screenshots/en-GB/2_APP_IPHONE_55_1.png?raw=true" width="300">
<img src="https://raw.githubusercontent.com/maxisme/notifi/automated-screenshots-${{ steps.extract_branch.outputs.branch }}/ios/fastlane/screenshots/en-GB/2_APP_IPHONE_55_2.png?raw=true" width="300">
<h3>65"</h3>
<img src="https://raw.githubusercontent.com/maxisme/notifi/automated-screenshots-${{ steps.extract_branch.outputs.branch }}/ios/fastlane/screenshots/en-GB/0_APP_IPHONE_65_0.png?raw=true" width="300">
<img src="https://raw.githubusercontent.com/maxisme/notifi/automated-screenshots-${{ steps.extract_branch.outputs.branch }}/ios/fastlane/screenshots/en-GB/1_APP_IPHONE_65_1.png?raw=true" width="300">
<img src="https://raw.githubusercontent.com/maxisme/notifi/automated-screenshots-${{ steps.extract_branch.outputs.branch }}/ios/fastlane/screenshots/en-GB/2_APP_IPHONE_65_1.png?raw=true" width="300">
<img src="https://raw.githubusercontent.com/maxisme/notifi/automated-screenshots-${{ steps.extract_branch.outputs.branch }}/ios/fastlane/screenshots/en-GB/2_APP_IPHONE_65_2.png?raw=true" width="300">
<h3>MacOS</h3>
<img src="https://raw.githubusercontent.com/maxisme/notifi/automated-screenshots-${{ steps.extract_branch.outputs.branch }}/screenshots/macos/1_framed.png?raw=true" width="500">
<img src="https://raw.githubusercontent.com/maxisme/notifi/automated-screenshots-${{ steps.extract_branch.outputs.branch }}/screenshots/macos/2_framed.png?raw=true" width="500">
<img src="https://raw.githubusercontent.com/maxisme/notifi/automated-screenshots-${{ steps.extract_branch.outputs.branch }}/screenshots/macos/3_framed.png?raw=true" width="500">
<img src="https://raw.githubusercontent.com/maxisme/notifi/automated-screenshots-${{ steps.extract_branch.outputs.branch }}/screenshots/macos/framed/1.png?raw=true" width="500">
<img src="https://raw.githubusercontent.com/maxisme/notifi/automated-screenshots-${{ steps.extract_branch.outputs.branch }}/screenshots/macos/framed/2.png?raw=true" width="500">
<img src="https://raw.githubusercontent.com/maxisme/notifi/automated-screenshots-${{ steps.extract_branch.outputs.branch }}/screenshots/macos/framed/3.png?raw=true" width="500">
<h3>Android</h3>
<img src="https://raw.githubusercontent.com/maxisme/notifi/automated-screenshots-${{ steps.extract_branch.outputs.branch }}/android/fastlane/metadata/android/en-GB/images/phoneScreenshots/1_en-GB.png?raw=true" width="300">
<img src="https://raw.githubusercontent.com/maxisme/notifi/automated-screenshots-${{ steps.extract_branch.outputs.branch }}/android/fastlane/metadata/android/en-GB/images/phoneScreenshots/2_en-GB.png?raw=true" width="300">
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/fastlane/screenshots/en-GB/0_APP_IPAD_PRO_129_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/fastlane/screenshots/en-GB/0_APP_IPHONE_55_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/fastlane/screenshots/en-GB/0_APP_IPHONE_65_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/fastlane/screenshots/en-GB/0_APP_ipadPro129-3rd-gen_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/fastlane/screenshots/en-GB/1_APP_IPAD_PRO_129_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/fastlane/screenshots/en-GB/1_APP_IPHONE_55_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/fastlane/screenshots/en-GB/1_APP_IPHONE_65_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/fastlane/screenshots/en-GB/1_APP_ipadPro129-3rd-gen_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/fastlane/screenshots/en-GB/2_APP_IPAD_PRO_129_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/fastlane/screenshots/en-GB/2_APP_IPHONE_55_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/fastlane/screenshots/en-GB/2_APP_IPHONE_65_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/fastlane/screenshots/en-GB/2_APP_ipadPro129-3rd-gen_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import 'package:sqflite/sqflite.dart';
Future<void> main() => mainImpl();

Future<void> mainImpl({bool integration: false}) async {
Globals.isIntegration = integration;
WidgetsFlutterBinding.ensureInitialized();

// initialise db for linux & windows
Expand Down
8 changes: 7 additions & 1 deletion lib/notifications/notification.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ class NotificationUIState extends State<NotificationUI>
Timer timer;
SlideActionType mouseSliderAction;

@override
void setState(Function fn) {
if (mounted) {
super.setState(fn);
}
}

@override
void initState() {
super.initState();
Expand Down Expand Up @@ -416,7 +423,6 @@ class NotificationUIState extends State<NotificationUI>
}

widget.canExpand = canExpand;
if (!mounted) return;
setState(() {});
}

Expand Down
2 changes: 1 addition & 1 deletion lib/user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ class User with ChangeNotifier {
_tmpErr = hasErr;
Future<dynamic>.delayed(const Duration(seconds: 1), () {
if (_tmpErr == hasErr) {
if (_tmpErr) {
if (_tmpErr && !Globals.isIntegration) {
MenuBarIcon.setErr();
showAlertSnackBar(_snackContext, 'Network Error!');
} else {
Expand Down
6 changes: 5 additions & 1 deletion lib/utils/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ const String refKey = 'ref';
const String messageKey = 'msg';
final EmojiParser eParser = EmojiParser();

class Globals {
static bool isIntegration = false;
}

bool get isTest {
return Platform.environment.containsKey('FLUTTER_TEST');
}
Expand Down Expand Up @@ -109,7 +113,7 @@ void showToast(String msg, BuildContext context, {int duration, int gravity}) {
}

Future<String> getDeviceUUID() async {
if (Platform.isLinux) {
if (Platform.isLinux || Globals.isIntegration) {
Uuid uuid = Uuid();
return uuid.v4();
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/android/framed/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions screenshots/android/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ font_size=120

for filename in *.png; do
out=$(basename "$filename" | sed 's/.png//g')
framed="${out}_framed.png"
framed="framed/${out}.png"
convert "utils/Nexus 6P.png" \
"$filename" -geometry +59+330 -composite \
"$filename" -geometry +59+330 -composite -strip \
"$framed"

bash ../../test_driver/add-text.sh "../screenshots/android/$framed" "../android/fastlane/metadata/android/en-GB/images/phoneScreenshots/${out}_en-GB.png" $font_size $height $width
Expand Down
Binary file modified screenshots/ios/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/ios/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/ios/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/ios/framed/55/0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/ios/framed/55/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/ios/framed/55/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/ios/framed/65/0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/ios/framed/65/1.png
Binary file added screenshots/ios/framed/65/2.png
Binary file added screenshots/ios/framed/ipad/0.png
Binary file added screenshots/ios/framed/ipad/1.png
Binary file added screenshots/ios/framed/ipad/2.png
Binary file added screenshots/macos/1.png
Binary file added screenshots/macos/2.png
Binary file added screenshots/macos/3.png
Binary file added screenshots/macos/framed/1.png
Binary file added screenshots/macos/framed/2.png
Binary file added screenshots/macos/framed/3.png
6 changes: 3 additions & 3 deletions screenshots/macos/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cd "$(dirname "$0")"

for filename in *.png; do
out=$(basename "$filename" | sed 's/.png//g')
convert "template.png" \
\( "$filename" -resize x1245 \) -geometry +1203+80 -composite \
"${out}_framed.png"
convert "utils/template.png" \
\( "$filename" -resize x1245 \) -geometry +1203+80 -composite -strip \
"framed/${out}.png"
done
Binary file removed screenshots/macos/macos.png
Diff not rendered.
File renamed without changes
2 changes: 1 addition & 1 deletion test_driver/add-text.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ convert "$filename" \
-font "../fonts/Inconsolata-Bold.ttf" -pointsize $font_size -fill "#fff" -annotate "+0+$logo_h" 'notifi' \
-font "../fonts/Inconsolata.ttf" -pointsize "$font_size2" -fill "#fff" -annotate "+0+$desc_h" 'Receive push notifications' \
-font "../fonts/Inconsolata.ttf" -pointsize "$font_size2" -fill "#fff" -annotate "+0+$desc_h2" 'over HTTP.' \
-bordercolor "#bc2122" -border "${padding}x${padding}" \
-bordercolor "#bc2122" -border "${padding}x${padding}" -strip \
"$out"
1 change: 1 addition & 0 deletions test_driver/app_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ void main() {
'https://dev.notifi.it/api?credentials=$creds&title=${i}&message=Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.&link=https://notifi.it&image=https://notifi.it/images/logo.png'));
// ignore: avoid_print
print(req.statusCode);
await Future<Duration>.delayed(Duration(milliseconds: 600));
}

await driver.waitUntilNoTransientCallbacks(timeout: Duration(seconds: 5));
Expand Down
13 changes: 8 additions & 5 deletions test_driver/screenshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ mv ${SS_DIR}*.png "${SS_DIR}android/"
## iOS #
########
IOS_SS_DIR="../ios/fastlane/screenshots/en-GB/"
IOS_DEVICES=("iPhone 12 Pro Max" "iPad Pro (12.9-inch) (4th generation)" "iPhone 8 Plus")
IOS_DEVICE_PATHS=("IPHONE_65" "IPAD_PRO_129,ipadPro129-3rd-gen" "IPHONE_55")
IOS_DEVICES=("iPad Pro (12.9-inch) (4th generation)" "iPhone 12 Pro Max" "iPhone 8 Plus")
IOS_DEVICE_PATHS=("IPAD_PRO_129,ipadPro129-3rd-gen" "IPHONE_65" "IPHONE_55")

# print simulator IOS_DEVICES
xcrun simctl list
Expand Down Expand Up @@ -59,25 +59,28 @@ done
# wrap screenshot frames with text
for filename in "${IOS_SS_DIR}"*_framed.png; do

out=$(basename "$filename" | sed 's/_framed//g')
out="${IOS_SS_DIR}${out}"
num=$(basename "$filename" | sed 's/_framed//g')
out="${IOS_SS_DIR}${num}"

# calc positions
height=2732
width=2048
font_size=120
device="ipad"
if [[ "$filename" == *"IPHONE_65"* ]]; then
width=1284
height=2778
font_size=110
device="65"
elif [[ "$filename" == *"IPHONE_55"* ]]; then
width=1242
height=2208
font_size=100
device="55"
fi

bash add-text.sh "$filename" "$out" $font_size $height $width
mv "$filename" ../screenshots/ios/
mv "$filename" "${SS_DIR}ios/framed/$device/${num}.png"
done

# run macos screenshot setup
Expand Down
4 changes: 4 additions & 0 deletions test_driver/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ if [[ $device == *"iPhone"* ]]; then
if ! xcrun simctl boot "$device"; then
exit 1
fi
elif [[ $device == *"macos"* ]]; then
flutter config --enable-macos-desktop
elif [[ $device == *"linux"* ]]; then
flutter config --enable-linux-desktop
fi

flutter drive --target=test_driver/app.dart -d "$device"

0 comments on commit 214e2f9

Please sign in to comment.