Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slack:notifier : Check UI Test Updates #208

Merged
merged 2 commits into from
Feb 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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