Skip to content

Commit

Permalink
Endpoint reports/{id} : Fixed import Playwright
Browse files Browse the repository at this point in the history
  • Loading branch information
Progi1984 committed Feb 22, 2024
1 parent 3a74964 commit 4825ec5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tests/Command/ImportPlaywrightCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function testImportBlockwislist(): void
$command = $application->find('nightly:import:playwright');
$commandTester = new CommandTester($command);
$commandTester->execute([
'--platform' => 'cli',
'--platform' => 'chromium',
'--campaign' => 'blockwishlist',
'filename' => 'blockwishlist_2024-01-25-develop.json',
]);
Expand Down
30 changes: 25 additions & 5 deletions tests/Controller/ReportControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ public static function dataProviderReportFilters(): array
return [
[[], 6],
[['filter_campaign[0]' => 'functional'], 2],
[['filter_platform' => 'chromium'], 3],
[['filter_browser' => 'chromium'], 3],
[['filter_platform' => 'chromium'], 4],
[['filter_browser' => 'chromium'], 4],
[['filter_version' => 'develop'], 6],
];
}
Expand Down Expand Up @@ -149,10 +149,15 @@ public function testCorsReportID(): void
$this->assertEquals($response->headers->get('access-control-allow-origin'), '*');
}

public function testReportID(): void
/**
* @dataProvider dataProviderReportID
*
* @param array<string> $campaigns
*/
public function testReportID(int $reportId, array $campaigns): void
{
$client = static::createClient();
$client->request('GET', '/reports/2');
$client->request('GET', '/reports/' . $reportId);
$response = $client->getResponse();

$this->assertEquals(200, $response->getStatusCode());
Expand All @@ -167,7 +172,7 @@ public function testReportID(): void
$this->assertArrayHasKey('date', $content);
$this->assertArrayHasKey('version', $content);
$this->assertArrayHasKey('campaign', $content);
$this->assertContains($content['campaign'], ReportMochaImporter::FILTER_CAMPAIGNS);
$this->assertContains($content['campaign'], $campaigns);
$this->assertArrayHasKey('browser', $content);
$this->assertContains($content['browser'], ReportMochaImporter::FILTER_PLATFORMS);
$this->assertArrayHasKey('platform', $content);
Expand Down Expand Up @@ -200,6 +205,21 @@ public function testReportID(): void
}
}

/**
* @return array<array<int>>
*/
public static function dataProviderReportID(): array
{
return [
// autoupgrade
[1, ReportMochaImporter::FILTER_CAMPAIGNS],
// functional
[2, ReportMochaImporter::FILTER_CAMPAIGNS],
// blockwishlist
[3, ReportPlaywrightImporter::FILTER_CAMPAIGNS],
];
}

public function testReportIDSuiteID(): void
{
$client = static::createClient();
Expand Down

0 comments on commit 4825ec5

Please sign in to comment.