-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Testing driver helper methods & platform auto platform detection
- Loading branch information
Showing
12 changed files
with
107 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import 'package:flutter_driver/flutter_driver.dart'; | ||
|
||
abstract class Actions { | ||
static FlutterDriver driver; | ||
|
||
static Future<void> tap(String key) async { | ||
await driver.tap(find.byValueKey(key)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,26 @@ | ||
import 'package:flutter_driver/driver_extension.dart'; | ||
import 'package:flutter_uis/io/io.dart'; | ||
import 'package:flutter_uis/main.dart' as app; | ||
|
||
void main() { | ||
// This line enables the extension. | ||
enableFlutterDriverExtension(); | ||
enableFlutterDriverExtension(handler: (data) async { | ||
if (data == "platform") { | ||
if (Platform.isLinux) { | ||
return "linux"; | ||
} else if (Platform.isAndroid) { | ||
return "android"; | ||
} else if (Platform.isIOS) { | ||
return "ios"; | ||
} else if (Platform.isWindows) { | ||
return "windows"; | ||
} else if (Platform.isMacOS) { | ||
return "macos"; | ||
} else { | ||
return "web"; | ||
} | ||
} | ||
return "enableFlutterDriverExtension"; | ||
}); | ||
|
||
// Call the `main()` function of the app, or call `runApp` with | ||
// any widget you are interested in testing. | ||
app.main(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import 'package:flutter_driver/flutter_driver.dart'; | ||
|
||
abstract class Screenshot { | ||
static String platform; | ||
static FlutterDriver driver; | ||
|
||
static Future<void> screenshot(String label) async { | ||
switch (platform) { | ||
case "linux": | ||
await screenshotLinux(label); | ||
break; | ||
default: | ||
} | ||
} | ||
|
||
static Future<void> screenshotLinux( | ||
String label, | ||
) async { | ||
try { | ||
print("screenName $label"); | ||
} catch (e) {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import 'package:flutter_driver/flutter_driver.dart'; | ||
|
||
abstract class Utils { | ||
static String platform; | ||
|
||
static bool isMobile; | ||
static bool isDesktop; | ||
static bool isWeb; | ||
|
||
static init(String newPlatform) { | ||
platform = newPlatform; | ||
isMobile = ["android", "ios"].contains(platform); | ||
isDesktop = ["linux", "windows", "macos"].contains(platform); | ||
isWeb = !isMobile && !isDesktop; | ||
} | ||
} |