diff --git a/Build/BuildConfig.json b/Build/BuildConfig.json index 2e7cd21b00..47ef1d60b2 100644 --- a/Build/BuildConfig.json +++ b/Build/BuildConfig.json @@ -1,3 +1,27 @@ { - "MaxAllowedObsoleteVersion": "24" + "MaxAllowedObsoleteVersion": "24", + "AppsNotToBePublished": [ + "AMC Banking 365 Fundamentals", + "AMC Banking 365 Fundamentals Test Automations", + "Automatic Account Codes", + "Automatic Account Codes Tests", + "Basic Experience", + "Basic Experience Tests", + "Dynamics GP History SmartLists", + "Dynamics GP Historical Data", + "Dynamics GP Historical Data Tests", + "Dynamics GP Intelligent Cloud", + "Dynamics GP Intelligent Cloud Tests", + "Image Analyzer", + "Image Analyzer Tests", + "Import of QuickBooks Payroll Files", + "Quickbooks Payroll File Import Tests", + "Send remittance advice by email Tests", + "AMC Banking 365 Fundamentals Test Automations", + "Tax Engine", + "Tax Engine Test", + "Transactions and Receipts Storage", + "WorldPay Payments Standard", + "WorldPay Payments Standard Tests" + ] } diff --git a/Build/Scripts/ImportTestDataInBcContainer.ps1 b/Build/Scripts/ImportTestDataInBcContainer.ps1 new file mode 100644 index 0000000000..d10ae30ad3 --- /dev/null +++ b/Build/Scripts/ImportTestDataInBcContainer.ps1 @@ -0,0 +1,44 @@ +Param( + [Parameter(ParameterSetName="ALGo")] + [Hashtable]$parameters, + [Parameter(ParameterSetName="Manual")] + [string]$containerName +) + +Import-Module "$PSScriptRoot\EnlistmentHelperFunctions.psm1" + +function Get-NavDefaultCompanyName +{ + return "CRONUS International Ltd." +} + +if ($PSCmdlet.ParameterSetName -eq 'ALGo') { + $containerName = $parameters.ContainerName +} + +# Unpublish apps that should not be published +$installedApps = Get-BcContainerAppInfo -containerName $parameters.ContainerName -tenantSpecificProperties -sort DependenciesLast +$appsToBeUnPublished = (Get-ConfigValue -ConfigType "BuildConfig" -Key "AppsNotToBePublished") +$installedApps | ForEach-Object { + if ($_.Name -in $appsToBeUnPublished) { + Write-Host "Unpublishing $($_.Name)" + Unpublish-BcContainerApp -containerName $parameters.ContainerName -name $_.Name -unInstall -doNotSaveData -doNotSaveSchema -force + } +} + +# Import test data +try { + $repoVersion = Get-ConfigValue -ConfigType "AL-GO" -Key "RepoVersion" + $DemoDataType = "EXTENDED" + + Write-Host "Initializing company" + Invoke-NavContainerCodeunit -Codeunitid 2 -containerName $containerName -CompanyName (Get-NavDefaultCompanyName) + + Write-Host "Importing configuration package" + Invoke-NavContainerCodeunit -Codeunitid 8620 -containerName $containerName -CompanyName (Get-NavDefaultCompanyName) -MethodName "ImportAndApplyRapidStartPackage" -Argument "C:\ConfigurationPackages\NAV$($repoVersion).W1.ENU.$($DemoDataType).rapidstart" +} catch { + Write-Host "Error while importing configuration package" + Write-Host $_.Exception.Message + Write-Host $_.Exception.StackTrace + exit 1 +} \ No newline at end of file diff --git a/Build/Scripts/RunTestsInBcContainer.ps1 b/Build/Scripts/RunTestsInBcContainer.ps1 index 59527309fe..bf5af9bcca 100644 --- a/Build/Scripts/RunTestsInBcContainer.ps1 +++ b/Build/Scripts/RunTestsInBcContainer.ps1 @@ -38,4 +38,12 @@ if ($disabledTests) $parameters["disabledTests"] = $disabledTests } -Run-TestsInBcContainer @parameters + +$installedApps = Get-BcContainerAppInfo -containerName $parameters.containerName | Select-Object -ExpandProperty AppId +$extensionId = $parameters.extensionId +if ($extensionId -in $installedApps) { + return Run-TestsInBcContainer @parameters +} else { + Write-Host "Extension $extensionId is not installed in container $containerName. Skipping tests." + return $true +} diff --git a/Build/projects/1st Party Apps Tests (W1)/.AL-Go/ImportTestDataInBcContainer.ps1 b/Build/projects/1st Party Apps Tests (W1)/.AL-Go/ImportTestDataInBcContainer.ps1 new file mode 100644 index 0000000000..4c5fa96d84 --- /dev/null +++ b/Build/projects/1st Party Apps Tests (W1)/.AL-Go/ImportTestDataInBcContainer.ps1 @@ -0,0 +1,6 @@ +Param( + [Hashtable]$parameters +) + +$script = Join-Path $PSScriptRoot "../../../scripts/ImportTestDataInBcContainer.ps1" -Resolve +. $script -parameters $parameters \ No newline at end of file diff --git a/Build/projects/1st Party Apps Tests (W1)/.AL-Go/settings.json b/Build/projects/1st Party Apps Tests (W1)/.AL-Go/settings.json index 9f742aef99..0301cbc8dc 100644 --- a/Build/projects/1st Party Apps Tests (W1)/.AL-Go/settings.json +++ b/Build/projects/1st Party Apps Tests (W1)/.AL-Go/settings.json @@ -6,5 +6,5 @@ "..\\..\\..\\Apps\\W1\\*\\*\\test", "..\\..\\..\\Apps\\W1\\*\\*\\test library" ], - "doNotRunTests": true + "doNotRunTests": false }