diff options
Diffstat (limited to 'plugins/TestRunner/Commands/SyncScreenshots.php')
-rw-r--r-- | plugins/TestRunner/Commands/SyncScreenshots.php | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/plugins/TestRunner/Commands/SyncScreenshots.php b/plugins/TestRunner/Commands/SyncScreenshots.php index a2930edbcf..fe032c1fe7 100644 --- a/plugins/TestRunner/Commands/SyncScreenshots.php +++ b/plugins/TestRunner/Commands/SyncScreenshots.php @@ -47,7 +47,7 @@ class SyncScreenshots extends ConsoleCommand $this->setName('tests:sync-ui-screenshots'); $this->setAliases(array('development:sync-ui-test-screenshots')); $this->setDescription('For Piwik core devs. Copies screenshots ' - . 'from travis artifacts to the tests/UI/expected-ui-screenshots/ folder'); + . 'from travis artifacts to the tests/UI/expected-screenshots/ folder'); $this->addArgument('buildnumber', InputArgument::REQUIRED, 'Travis build number you want to sync.'); $this->addArgument('screenshotsRegex', InputArgument::OPTIONAL, 'A regex to use when selecting screenshots to copy. If not supplied all screenshots are copied.', '.*'); @@ -147,15 +147,7 @@ git push"; if ($repository === 'piwik/piwik') { $commands .= " -cd .. -git pull -git add expected-ui-screenshots/ -git status -git commit -m 'UI tests: ...' # Copy paste the good commit message -echo -e \"\n--> Check the commit above is correct... <---\n\" -sleep 7 -git push -cd ../../"; +cd ../../../"; } else { $commands .= " cd ../../../../../"; @@ -169,18 +161,25 @@ cd ../../../../../"; $plugin = $this->getPluginName($repository); if (empty($plugin)) { - return PIWIK_DOCUMENT_ROOT . '/tests/UI/expected-ui-screenshots/'; + return PIWIK_DOCUMENT_ROOT . "/tests/UI/expected-screenshots/"; } - $downloadTo = PIWIK_DOCUMENT_ROOT . "/plugins/$plugin/tests/UI/expected-ui-screenshots/"; - if(is_dir($downloadTo)) { - return $downloadTo; - } + $possibleSubDirs = array( + 'expected-screenshots', + 'expected-ui-screenshots' + ); + + foreach ($possibleSubDirs as $subDir) { + $downloadTo = PIWIK_DOCUMENT_ROOT . "/plugins/$plugin/tests/UI/$subDir/"; + if (is_dir($downloadTo)) { + return $downloadTo; + } - // Maybe the plugin is using folder "Test/" instead of "tests/" - $downloadTo = str_replace("tests/", "Test/", $downloadTo); - if(is_dir($downloadTo)) { - return $downloadTo; + // Maybe the plugin is using folder "Test/" instead of "tests/" + $downloadTo = str_replace("tests/", "Test/", $downloadTo); + if (is_dir($downloadTo)) { + return $downloadTo; + } } throw new \Exception("Download to path could not be found: $downloadTo"); } |