From cb178e02f4b671b7caceecc8334e890ad52d836e Mon Sep 17 00:00:00 2001 From: Maria Zhelezova Date: Wed, 26 Nov 2025 15:51:30 +0100 Subject: [PATCH 1/4] Remove pull request creation and validation steps from end-to-end test script for BCApps --- e2eTests/scenarios/BCApps/runtest.ps1 | 42 --------------------------- 1 file changed, 42 deletions(-) diff --git a/e2eTests/scenarios/BCApps/runtest.ps1 b/e2eTests/scenarios/BCApps/runtest.ps1 index df016d9b6..6ef911029 100644 --- a/e2eTests/scenarios/BCApps/runtest.ps1 +++ b/e2eTests/scenarios/BCApps/runtest.ps1 @@ -90,45 +90,3 @@ $appCount = @(Get-ChildItem -Path '.artifacts/*-Apps-*/*.app' -Recurse).Count $testAppCount = @(Get-ChildItem -Path '.artifacts/*-TestApps-*/*.app' -Recurse).Count $appCount | Should -BeGreaterThan 0 $testAppCount | Should -BeGreaterThan 0 - -# Modify a file in the repository and create a Pull Request -$branch = "e2etest" -$title = "End 2 end test" -invoke-git checkout -b $branch - -$fileToChange = Join-Path $repoPath "src/Tools/Performance Toolkit/App/src/BCPTTestSuite.Codeunit.al" -$fileContent = Get-Content -Path $fileToChange -Encoding UTF8 -$fileContent[0] = $fileContent[0] + "// $title" -Set-Content -Path $fileToChange -Value $fileContent -Encoding UTF8 - -invoke-git add $fileToChange -invoke-git commit -m $title -invoke-git push --set-upstream origin $branch - -invoke-gh pr create --fill --head $branch --repo $repository --base main --body $title - -Start-Sleep -Seconds 60 - -$prs = @(invoke-gh -returnValue pr list --repo $repository | Where-Object { $_.Contains($title) }) -if ($prs.Count -eq 0) { - throw "No Pull Request was created" -} -elseif ($prs.Count -gt 1) { - throw "More than one Pull Request exists" -} - -$headers = GetHeaders -token $ENV:GH_TOKEN -repository $repository -$url = "https://api.github.com/repos/$repository/actions/runs" -$run = ((InvokeWebRequest -Method Get -Headers $headers -Uri $url).Content | ConvertFrom-Json).workflow_runs | Where-Object { $_.event -eq 'pull_request' } | Where-Object { $_.name -eq 'Pull Request Build' } -if (-not $run) { - throw "No Pull Request Build workflow run was found" -} -WaitWorkflow -repository $repository -runid $run.id - -# There should be only 1 app rebuilt -Test-ArtifactsFromRun -runid $run.id -folder '.prartifacts' -repoVersion '*.*' -appVersion '*.*' -$appCount = @(Get-ChildItem -Path '.prartifacts/*-Apps-*/*.app' -Recurse).Count -$appCount | Should -Be 1 - -Pop-Location -RemoveRepository -repository $repository -path $repoPath From e81a5176dec6a3e1423a03a3e69a02fa108f07a0 Mon Sep 17 00:00:00 2001 From: Maria Zhelezova Date: Wed, 26 Nov 2025 15:59:19 +0100 Subject: [PATCH 2/4] Revert "Remove pull request creation and validation steps from end-to-end test script for BCApps" This reverts commit cb178e02f4b671b7caceecc8334e890ad52d836e. --- e2eTests/scenarios/BCApps/runtest.ps1 | 42 +++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/e2eTests/scenarios/BCApps/runtest.ps1 b/e2eTests/scenarios/BCApps/runtest.ps1 index 6ef911029..df016d9b6 100644 --- a/e2eTests/scenarios/BCApps/runtest.ps1 +++ b/e2eTests/scenarios/BCApps/runtest.ps1 @@ -90,3 +90,45 @@ $appCount = @(Get-ChildItem -Path '.artifacts/*-Apps-*/*.app' -Recurse).Count $testAppCount = @(Get-ChildItem -Path '.artifacts/*-TestApps-*/*.app' -Recurse).Count $appCount | Should -BeGreaterThan 0 $testAppCount | Should -BeGreaterThan 0 + +# Modify a file in the repository and create a Pull Request +$branch = "e2etest" +$title = "End 2 end test" +invoke-git checkout -b $branch + +$fileToChange = Join-Path $repoPath "src/Tools/Performance Toolkit/App/src/BCPTTestSuite.Codeunit.al" +$fileContent = Get-Content -Path $fileToChange -Encoding UTF8 +$fileContent[0] = $fileContent[0] + "// $title" +Set-Content -Path $fileToChange -Value $fileContent -Encoding UTF8 + +invoke-git add $fileToChange +invoke-git commit -m $title +invoke-git push --set-upstream origin $branch + +invoke-gh pr create --fill --head $branch --repo $repository --base main --body $title + +Start-Sleep -Seconds 60 + +$prs = @(invoke-gh -returnValue pr list --repo $repository | Where-Object { $_.Contains($title) }) +if ($prs.Count -eq 0) { + throw "No Pull Request was created" +} +elseif ($prs.Count -gt 1) { + throw "More than one Pull Request exists" +} + +$headers = GetHeaders -token $ENV:GH_TOKEN -repository $repository +$url = "https://api.github.com/repos/$repository/actions/runs" +$run = ((InvokeWebRequest -Method Get -Headers $headers -Uri $url).Content | ConvertFrom-Json).workflow_runs | Where-Object { $_.event -eq 'pull_request' } | Where-Object { $_.name -eq 'Pull Request Build' } +if (-not $run) { + throw "No Pull Request Build workflow run was found" +} +WaitWorkflow -repository $repository -runid $run.id + +# There should be only 1 app rebuilt +Test-ArtifactsFromRun -runid $run.id -folder '.prartifacts' -repoVersion '*.*' -appVersion '*.*' +$appCount = @(Get-ChildItem -Path '.prartifacts/*-Apps-*/*.app' -Recurse).Count +$appCount | Should -Be 1 + +Pop-Location +RemoveRepository -repository $repository -path $repoPath From 6ea000f73f0c3518f5eb66df620ea2d85d0b487a Mon Sep 17 00:00:00 2001 From: Maria Zhelezova Date: Wed, 26 Nov 2025 16:00:27 +0100 Subject: [PATCH 3/4] Enhance artifact validation in end-to-end tests to ensure at least one app and one test app are generated --- e2eTests/scenarios/BCApps/runtest.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/e2eTests/scenarios/BCApps/runtest.ps1 b/e2eTests/scenarios/BCApps/runtest.ps1 index df016d9b6..fb68a83c4 100644 --- a/e2eTests/scenarios/BCApps/runtest.ps1 +++ b/e2eTests/scenarios/BCApps/runtest.ps1 @@ -128,7 +128,9 @@ WaitWorkflow -repository $repository -runid $run.id # There should be only 1 app rebuilt Test-ArtifactsFromRun -runid $run.id -folder '.prartifacts' -repoVersion '*.*' -appVersion '*.*' $appCount = @(Get-ChildItem -Path '.prartifacts/*-Apps-*/*.app' -Recurse).Count -$appCount | Should -Be 1 +$testAppCount = @(Get-ChildItem -Path '.prartifacts/*-TestApps-*/*.app' -Recurse).Count +$appCount | Should -BeGreaterThan 0 +$testAppCount | Should -BeGreaterThan 0 Pop-Location RemoveRepository -repository $repository -path $repoPath From 816f46c5f49993b6e5d9f45e4437a0746d61c384 Mon Sep 17 00:00:00 2001 From: Maria Zhelezova <43066499+mazhelez@users.noreply.github.com> Date: Wed, 26 Nov 2025 16:07:00 +0100 Subject: [PATCH 4/4] Update e2eTests/scenarios/BCApps/runtest.ps1 Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- e2eTests/scenarios/BCApps/runtest.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2eTests/scenarios/BCApps/runtest.ps1 b/e2eTests/scenarios/BCApps/runtest.ps1 index fb68a83c4..3eafd7552 100644 --- a/e2eTests/scenarios/BCApps/runtest.ps1 +++ b/e2eTests/scenarios/BCApps/runtest.ps1 @@ -125,7 +125,7 @@ if (-not $run) { } WaitWorkflow -repository $repository -runid $run.id -# There should be only 1 app rebuilt +# There should be at least 1 app and 1 test app rebuilt Test-ArtifactsFromRun -runid $run.id -folder '.prartifacts' -repoVersion '*.*' -appVersion '*.*' $appCount = @(Get-ChildItem -Path '.prartifacts/*-Apps-*/*.app' -Recurse).Count $testAppCount = @(Get-ChildItem -Path '.prartifacts/*-TestApps-*/*.app' -Recurse).Count