@@ -23,53 +23,56 @@ enum DeviceType { android, ios }
2323/// 4. Move processed screenshots to fastlane destination for upload to stores.
2424/// 5. Stop emulator/simulator.
2525Future <void > run ([String configPath = kConfigFileName]) async {
26- final _config = Config (configPath );
27- // validate config file
28- await _config. validate () ;
26+ final screens = await Screens ( );
27+ await screens. init ();
28+ // final Map screens = _screens.screens ;
2929
30- final Map config = _config.config;
31- final Map screens = await Screens ().init ();
30+ final config = Config (configPath);
31+ // validate config file
32+ await config.validate (screens);
33+ final Map configInfo = config.config;
3234
3335 // init
34- final stagingDir = config ['staging' ];
36+ final stagingDir = configInfo ['staging' ];
3537 await Directory (stagingDir + '/test' ).create (recursive: true );
3638 await resources.unpackScripts (stagingDir);
39+ await fastlane.clearFastlaneDirs (configInfo, screens);
3740
3841 // run integration tests in each android emulator for each locale and
3942 // process screenshots
40- if (config ['devices' ]['android' ] != null )
41- for (final emulatorName in config ['devices' ]['android' ]) {
42- for (final locale in config ['locales' ]) {
43+ if (configInfo ['devices' ]['android' ] != null )
44+ for (final emulatorName in configInfo ['devices' ]['android' ]) {
45+ for (final locale in configInfo ['locales' ]) {
4346 await emulator (emulatorName, true , stagingDir, locale);
44- await clearFastlaneDir (
45- screens, emulatorName, locale, DeviceType .android);
47+ // await clearFastlaneDir(
48+ // screens, emulatorName, locale, DeviceType.android);
4649
47- for (final testPath in config ['tests' ]) {
50+ for (final testPath in configInfo ['tests' ]) {
4851 print (
4952 'Capturing screenshots with test $testPath on emulator $emulatorName in locale $locale ...' );
5053 await screenshots (testPath, stagingDir);
5154 // process screenshots
5255 await processImages.process (
53- screens, config , DeviceType .android, emulatorName, locale);
56+ screens, configInfo , DeviceType .android, emulatorName, locale);
5457 }
5558 await emulator (emulatorName, false , stagingDir);
5659 }
5760 }
5861
5962 // run integration tests in each ios simulator for each locale and
6063 // process screenshots
61- if (config ['devices' ]['ios' ] != null )
62- for (final simulatorName in config ['devices' ]['ios' ]) {
63- for (final locale in config ['locales' ]) {
64+ if (configInfo ['devices' ]['ios' ] != null )
65+ for (final simulatorName in configInfo ['devices' ]['ios' ]) {
66+ for (final locale in configInfo ['locales' ]) {
6467 simulator (simulatorName, true , stagingDir, locale);
65- await clearFastlaneDir (screens, simulatorName, locale, DeviceType .ios);
66- for (final testPath in config ['tests' ]) {
68+ // await clearFastlaneDir(screens, simulatorName, locale, DeviceType.ios);
69+ for (final testPath in configInfo ['tests' ]) {
6770 print (
6871 'Capturing screenshots with test $testPath on simulator $simulatorName in locale $locale ...' );
6972 await screenshots (testPath, stagingDir);
7073 // process screenshots
7174 await processImages.process (
72- screens, config , DeviceType .ios, simulatorName, locale);
75+ screens, configInfo , DeviceType .ios, simulatorName, locale);
7376 }
7477 simulator (simulatorName, false );
7578 }
@@ -84,17 +87,6 @@ Future<void> run([String configPath = kConfigFileName]) async {
8487 print ('\n screenshots completed successfully.' );
8588}
8689
87- /// Clear image destination
88- Future clearFastlaneDir (
89- Map screens, deviceName, locale, DeviceType deviceType) async {
90- final Map screenProps = Screens ().screenProps (screens, deviceName);
91-
92- final dstDir = fastlane.path (deviceType, locale, '' , screenProps['destName' ]);
93-
94- print ('Clearing images in $dstDir ...' );
95- await utils.clearDirectory (dstDir);
96- }
97-
9890///
9991/// Run the screenshot integration test on current emulator or simulator.
10092///
0 commit comments