Skip to content

Commit

Permalink
update test specs scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
wildone committed Jun 15, 2021
1 parent 898f56a commit fd802cb
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 12 deletions.
6 changes: 6 additions & 0 deletions aemdesign-testing/asciidoctor-convert-reports
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

#TESTING
#./asciidoctor-convert-reports -images ./images -root ./root -source source1 -base base1 -input ./input -output ./output -filter *.files -pdf -html
## Generate HTML
#./asciidoctor-convert-reports -images remote-seleniumhub-chrome/generated-docs/pdf -root . -source coderay -base . -input remote-seleniumhub-chrome/spock-reports -output remote-seleniumhub-chrome/generated-docs -filter *.ad -html
## Generate PDF
#./asciidoctor-convert-reports -images remote-seleniumhub-chrome/generated-docs/pdf -root remote-seleniumhub-chrome -source coderay -base ./ -input remote-seleniumhub-chrome/spock-reports -output remote-seleniumhub-chrome/generated-docs -filter *.ad -pdf
## Generate HTML and PDF
#./asciidoctor-convert-reports -images remote-seleniumhub-chrome/generated-docs/pdf -root remote-seleniumhub-chrome -source coderay -base ./ -input remote-seleniumhub-chrome/spock-reports -output remote-seleniumhub-chrome/generated-docs -filter *.ad -html -pdf

PATH_PDF="pdf"
PATH_HTML="html"
Expand Down
71 changes: 71 additions & 0 deletions aemdesign-testing/asciidoctor-convert-reports.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
Param(
[string]$LOG_PATH = "..\logs",
[string]$LOG_PEFIX = "asciidoctor",
[string]$LOG_SUFFIX = ".log",
[string]$DOCKER_LOGS_FOLDER = "..\logs\docker",
[switch]$SILENT = $false,
[string]$TEST_IMAGE = "aemdesign/centos-java-buildpack",
[switch]$TEST_OPEN_REPORT = $false,
[string]$TEST_REPORT_PATH = "generated-docs/summary.html",
[string]$TEST_DRIVER_NAME = "remote-seleniumhub-chrome",
[string]$DOCKER_SCRIPT = "cd ${TEST_DRIVER_NAME}/spock-reports && cd - && ./asciidoctor-convert-reports -images ${TEST_DRIVER_NAME}/generated-docs/pdf -root . -source coderay -base ./ -input ${TEST_DRIVER_NAME}/spock-reports -output ${TEST_DRIVER_NAME}/generated-docs -filter *.ad -html",
[string]$FUNCTIONS_URI = "https://github.com/aem-design/aemdesign-docker/releases/latest/download/functions.ps1"
)

$SKIP_CONFIG = $true
$PARENT_PROJECT_PATH = ".."

. ([Scriptblock]::Create((([System.Text.Encoding]::ASCII).getString((Invoke-WebRequest -Uri "${FUNCTIONS_URI}").Content))))

$script:LOG_PATH = $LOG_PATH

$LOG_FILENAME_DATE = "$(DateStamp)"
$LOG_FILENAME = "${LOG_PEFIX}-${DOCKER_NETWORK_NAME}-${LOG_FILENAME_DATE}${LOG_SUFFIX}"

printSectionBanner "Converting report to HTML"

$CURRENT_PATH = ${PWD}
$PROJECT_ROOT_DIR="$( Resolve-Path ${PARENT_PROJECT_PATH} )"
$MAVEN_DIR="$(Resolve-Path ~/.m2)"
$PARENT_PROJECT_WITH_GIT = $(getGitDir)
$PARENT_PROJECT_WITH_GIT = ( $PARENT_PROJECT_WITH_GIT -split "\.git" )[0]
$PARENT_PROJECT_WITH_GIT_NAME = $( Resolve-Path "${PARENT_PROJECT_WITH_GIT}" | Split-Path -Leaf )
$PARENT_PROJECT_LOCATION = $( Resolve-Path "${PWD}\.." )
$PARENT_PROJECT_NAME = $( Resolve-Path "$PARENT_PROJECT_LOCATION" | Split-Path -Leaf )
$PROJECT_NAME = $( Resolve-Path "${PWD}" | Split-Path -Leaf )

$DOCKER_COMMAND="docker run --rm --net=host --name ${TEST_DRIVER_NAME} -v ${PARENT_PROJECT_WITH_GIT}:/build/${PARENT_PROJECT_WITH_GIT_NAME} -v ${MAVEN_DIR}:/build/.m2 -w ""/build/${PARENT_PROJECT_WITH_GIT_NAME}/${PROJECT_NAME}"" ${TEST_IMAGE} bash -l -c '${DOCKER_SCRIPT} -Dmaven.repo.local=/build/.m2/repository' "


printSectionLine "Project Root: ${PROJECT_ROOT_DIR}"
printSectionLine "Maven Plugins Directory: ${MAVEN_DIR}"
printSectionLine "Parent Project with GIT Directory: ${PARENT_PROJECT_WITH_GIT}"
printSectionLine "Parent Project with GIT Directory Name: ${PARENT_PROJECT_WITH_GIT_NAME}"
printSectionLine "Parent Project Name: ${PARENT_PROJECT_NAME}"
printSectionLine "Current Project Name: ${PROJECT_NAME}"
printSectionLine "Testing Directory: ${CURRENT_PATH}"
printSectionLine "Testing Sub Directory: ${PARENT_PROJECT_LOCATION}"
printSectionLine "Docker Script:"
printSectionLine " ${DOCKER_SCRIPT}"
printSectionLine "Docker Command:"
printSectionLine " ${DOCKER_COMMAND}"

if ( -Not( $SILENT ) )
{
$START = Read-Host -Prompt "Do you want to start testing with these settings? (y/n)"

if ($START -ne "y")
{
Write-Output "Quiting..."
Exit
}
}

debug "${DOCKER_COMMAND}"

printSubSectionStart "Docker Command Execute"

Invoke-Expression "${DOCKER_COMMAND}"



21 changes: 9 additions & 12 deletions aemdesign-testing/test-spec.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ Param(
[string]$DOCKER_SELENIUMHUB_NODE_NAME = "selenium-hub-node-chrome",
[string]$DOCKER_SELENIUMHUB_NAME = "selenium-hub",
[string]$DOCKER_NETWORK_NAME = "selenium-grid",
[string]$LOG_PATH = "${PWD}\logs\testspec",
[string]$LOG_PEFIX = "",
[string]$LOG_PATH = "..\logs",
[string]$LOG_PEFIX = "test-spec",
[string]$LOG_SUFFIX = ".log",
[string]$DOCKER_LOGS_FOLDER = "${PWD}\logs\docker",
[string]$DOCKER_LOGS_FOLDER = "..\logs",
[string]$DRIVER_FOLDER = "${PWD}\drivers",
[switch]$LOGIN = $true,
[switch]$REPORT = $true,
Expand All @@ -21,7 +21,7 @@ Param(
[string]$TEST_REPORT_PATH = "generated-docs/summary.html",
[string]$TEST_DRIVER_NAME = "remote-seleniumhub-chrome",
[string]$AEM_SCHEME = "http",
[string]$AEM_HOST = "localhost",
[string]$AEM_HOST = "$( (Get-NetIPAddress | Where-Object {$_.AddressState -eq "Preferred" -and $_.ValidLifetime -lt "24:00:00"}).IPAddress)",
[string]$AEM_PORT = "4502",
[string]$AEM_USERNAME = "admin",
[string]$AEM_PASSWORD = "admin",
Expand All @@ -32,17 +32,14 @@ Param(
[switch]$TEST_DISPATCHER = $false,
[switch]$TEST_SKIP_CONVERT = $false,
[switch]$TEST_USING_MAVEN = $false,
[string]$TEST_VIEWPORTS = ""

[string]$FUNCTIONS_URI = "https://github.com/aem-design/aemdesign-docker/releases/latest/download/functions.ps1",
[string]$TEST_VIEWPORTS = "$( (Get-Content ".\test-viewports") -join ",")"
)

. "..\scripts\functions.ps1"
$SKIP_CONFIG = $true
$PARENT_PROJECT_PATH = ".."

$script:TEST_SELENIUMHUB_SCHEME = $SELENIUMHUB_SCHEME
$script:TEST_SELENIUMHUB_PORT = $SELENIUMHUB_PORT
$script:TEST_SELENIUMHUB_SERVICE = $SELENIUMHUB_SERVICE
$script:TEST_SELENIUMHUB_HOST = $SELENIUMHUB_HOST
$script:TEST_SELENIUM_URL="${TEST_SELENIUMHUB_SCHEME}://${TEST_SELENIUMHUB_HOST}:${TEST_SELENIUMHUB_PORT}${TEST_SELENIUMHUB_SERVICE}"
. ([Scriptblock]::Create((([System.Text.Encoding]::ASCII).getString((Invoke-WebRequest -Uri "${FUNCTIONS_URI}").Content))))

Function Get-MavenCommand
{
Expand Down
6 changes: 6 additions & 0 deletions aemdesign-testing/test-viewports
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
XS
SM
MD
LG
XLG
XXLG

0 comments on commit fd802cb

Please sign in to comment.