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

Update Smoke Test to handle CAP #418

Merged
merged 2 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Testing/Functional/SmokeTest/SmokeTest001.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ Describe "Smoke Test: Generate Output" {
Context "Invoke Scuba for $Organization" {
BeforeAll {
if ($PSCmdlet.ParameterSetName -eq 'Manual'){
{ Invoke-SCuBA -ProductNames "*" -M365Environment $M365Environment } |
{ Invoke-SCuBA -ProductNames "*" -M365Environment $M365Environment -Quiet} |
Should -Not -Throw
}
else {
{ Invoke-SCuBA -CertificateThumbprint $Thumbprint -AppID $AppId -Organization $Organization -ProductNames "*" -M365Environment $M365Environment } |
{ Invoke-SCuBA -CertificateThumbprint $Thumbprint -AppID $AppId -Organization $Organization -ProductNames "*" -M365Environment $M365Environment -Quiet} |
Should -Not -Throw
}
$ReportFolders = Get-ChildItem . -directory -Filter "M365BaselineConformance*" | Sort-Object -Property LastWriteTime -Descending
Expand Down
26 changes: 24 additions & 2 deletions Testing/Functional/SmokeTest/SmokeTest002.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ param (
Import-Module Selenium

Describe -Tag "UI","Chrome" -Name "Test Report with <Browser> for $OrganizationName" -ForEach @(
@{ Browser = "Chrome"; Driver = Start-SeChrome -Headless -Arguments @('start-maximized') 2>$null }
@{ Browser = "Chrome"; Driver = Start-SeChrome -Headless -Arguments @('start-maximized', 'AcceptInsecureCertificates') 2>$null }
){
BeforeAll {
$ReportFolders = Get-ChildItem . -directory -Filter "M365BaselineConformance*" | Sort-Object -Property LastWriteTime -Descending
Expand Down Expand Up @@ -105,12 +105,34 @@ Describe -Tag "UI","Chrome" -Name "Test Report with <Browser> for $OrganizationN
$Rows = Get-SeElement -Element $Table -By TagName 'tr'
$Rows.Count | Should -BeGreaterThan 0

# First Table in report is generally tenant data
if ($Table.GetProperty("id") -eq "tenant-data"){
$Rows.Count | Should -BeExactly 2
$TenantDataColumns = Get-SeElement -Target $Rows[1] -By TagName "td"
$Tenant = $TenantDataColumns[0].Text
$Tenant | Should -Be $OrganizationName -Because "Tenant is $Tenant"
} else {
}
# AAD detailed report has a Conditional Access Policy table
elseif ($Table.GetAttribute("class") -eq "caps_table"){
ForEach ($Row in $Rows){
$RowHeaders = Get-SeElement -Element $Row -By TagName 'th'
$RowData = Get-SeElement -Element $Row -By TagName 'td'

($RowHeaders.Count -eq 0 ) -xor ($RowData.Count -eq 0) | Should -BeTrue -Because "Any given row should be homogenious"

# NOTE: Checking for 8 columns since first is 'expand' column
if ($RowHeaders.Count -gt 0){
$RowHeaders.Count | Should -BeExactly 8
$RowHeaders[1].text | Should -BeLikeExactly "Name"
}

if ($RowData.Count -gt 0){
$RowData.Count | Should -BeExactly 8
}
}
}
# Default is normal policy results table
else {
# Control report tables
ForEach ($Row in $Rows){
$RowHeaders = Get-SeElement -Element $Row -By TagName 'th'
Expand Down