diff --git a/src/App/Command/SlackNotifierCommand.php b/src/App/Command/SlackNotifierCommand.php index 9e41243..ba2766f 100644 --- a/src/App/Command/SlackNotifierCommand.php +++ b/src/App/Command/SlackNotifierCommand.php @@ -205,6 +205,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int // Check ToDo on JIRA (which should be closed after being solved) $slackMessageQAAutomation[] = $this->checkToDoJIRA(); + // Check updates to make on UI Tests + $slackMessageQAAutomation[] = $this->checkUITestUpdates(); + // Check QA Stats $slackMessageQAFunctional[] = $this->checkStatsQA(); @@ -336,6 +339,46 @@ protected function checkToDoJIRA(): string return $slackMessage; } + protected function checkUITestUpdates(): string + { + $slackMessage = ':scroll: UI Tests (Modules & Theme updates) :scroll:' . PHP_EOL; + + // Check modules + $content = $this->github->getClient()->api('repo')->contents()->download('PrestaShop', 'PrestaShop', 'tests/UI/data/demo/modules.ts', 'refs/heads/develop'); + // Search version in code + preg_match_all( + '/{\s+tag: \'([a-z_]+)\',\s+name: \'([A-za-z0-9\s]+)\',\s+releaseZip: \'([A-za-z_0-9:\/\.]+)\',\s+}/m', + $content, + $matches + ); + foreach ($matches[1] as $keyMatch => $match) { + preg_match('#https:\/\/github.com\/PrestaShop\/' . $match . '\/releases\/download\/([v\.0-9]+)\/' . $match . '.zip#', $matches[3][$keyMatch], $matchesVersion); + $curVersion = $matchesVersion[1]; + + // Search release in Github + $data = $this->github->getClient()->api('repo')->releases()->latest('PrestaShop', $match); + $emoji = $data['name'] === $curVersion ? ':white_check_mark:' : ':warning:'; + + $slackMessage .= ' • :gear: : Code (`' . $curVersion . '`) - Release (' . $emoji . ' `' . $data['name'] . '`)'; + $slackMessage .= PHP_EOL; + } + + // Check theme Hummingbird + $content = $this->github->getClient()->api('repo')->contents()->download('PrestaShop', 'PrestaShop', 'tests/UI/commonTests/FO/hummingbird.ts', 'refs/heads/develop'); + // Search version in code + preg_match('#https:\/\/github.com\/PrestaShop\/hummingbird\/releases\/download\/([v\.0-9]+)\/hummingbird.zip#m', $content, $matches); + $curVersion = $matches[1]; + + // Search release in Github + $data = $this->github->getClient()->api('repo')->releases()->latest('PrestaShop', 'hummingbird'); + $emoji = $data['name'] === $curVersion ? ':white_check_mark:' : ':warning:'; + + $slackMessage .= ' • :bird: : Code (`' . $curVersion . '`) - Release (' . $emoji . ' `' . $data['name'] . '`)'; + $slackMessage .= PHP_EOL; + + return $slackMessage; + } + protected function checkStatusNightly(): string { $slackMessage = ':notebook_with_decorative_cover: Nightly Board :notebook_with_decorative_cover:' . PHP_EOL;