Skip to content

Commit

Permalink
Merge pull request #208 from PrestaShop/checkUITestUpdates
Browse files Browse the repository at this point in the history
`slack:notifier` : Check UI Test Updates
  • Loading branch information
Progi1984 committed Feb 14, 2024
2 parents 25ecf0f + 8690ad5 commit 163cbd1
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/App/Command/SlackNotifierCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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: <https://github.com/PrestaShop/PrestaShop/blob/develop/tests/UI/data/demo/modules.ts|' . $match . '>: 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: <https://github.com/PrestaShop/PrestaShop/blob/develop/tests/UI/commonTests/FO/hummingbird.ts|hummingbird>: 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;
Expand Down

0 comments on commit 163cbd1

Please sign in to comment.