Skip to content

Commit

Permalink
Upgraded Node & npm in /testing
Browse files Browse the repository at this point in the history
  • Loading branch information
alansemenov committed Dec 22, 2023
1 parent 491ced5 commit d33293e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 28 deletions.
51 changes: 27 additions & 24 deletions testing/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import com.enonic.uitest.server.ServerInstance
import org.codehaus.groovy.runtime.GStringImpl

plugins {
id 'java'
Expand All @@ -18,30 +19,30 @@ configurations {
}

ext {
unpackDir = "$buildDir/install"
distroDir = "$unpackDir/enonic-xp-generic-$version"
deployDir = "$distroDir/home/deploy"
appDir = "$projectDir/test-applications"
xpHome = "$distroDir/home"
configDir = "$xpHome/config"
unpackDir = "$buildDir/install" as GStringImpl
distroDir = "$unpackDir/enonic-xp-generic-$version" as GStringImpl
deployDir = "$distroDir/home/deploy" as GStringImpl
appDir = "$projectDir/test-applications" as GStringImpl
xpHome = "$distroDir/home" as GStringImpl
configDir = "$xpHome/config" as GStringImpl
xpServer = new ServerInstance()
appName = "app-applications"
appFile = "$distroDir/system/40/${appName}-${version}.jar"
appUrl = project.hasProperty( 'appUrl' ) ? appUrl : "file:///$projectDir/../build/libs/${appName}.jar"
appFile = "$distroDir/system/40/${appName}-${version}.jar" as GStringImpl
appUrl = project.hasProperty( 'appUrl' ) ? appUrl : "file:///$projectDir/../build/libs/${appName}.jar" as GStringImpl
}

dependencies {
distro "com.enonic.xp:enonic-xp-generic:$version@zip"
}

task unpackDistro( type: Copy ) {
tasks.register( 'unpackDistro', Copy ) {
from {
configurations.distro.collect { zipTree( it ) }
}
into file( unpackDir )
}

task copyConfig( type: Copy ) {
tasks.register( 'copyConfig', Copy ) {
println "$appDir/common-config"
from "$appDir/common-config"
include '**.*.cfg'
Expand All @@ -50,65 +51,67 @@ task copyConfig( type: Copy ) {
mustRunAfter unpackDistro
}

task copyApps( type: Copy ) {
tasks.register( 'copyApps', Copy ) {
println appDir
from file( appDir )
include '*.jar'
into file( deployDir )
mustRunAfter unpackDistro
}

task deployApp( type: DefaultTask ) {
tasks.register( 'deployApp', DefaultTask ) {
outputs.files( appFile )
outputs.upToDateWhen { false }
doLast {
def f = new File( appFile )
def f = new File(appFile as String)
println "Deleting ${appFile}. Exists ${f.exists()}"

f.delete()

println "Copying from ${appUrl} to ${appFile}"
new URL( appUrl ).withInputStream { i -> f.withOutputStream { it << i } }
new URL(appUrl as String).withInputStream { i -> f.withOutputStream { it << i } }
}
mustRunAfter unpackDistro
}

task startServer( dependsOn: unpackDistro ) {
tasks.register( 'startServer' ) {
dependsOn unpackDistro
doLast {
xpServer.installDir = file( distroDir )
xpServer.start()
}
}

task stopServer {
tasks.register( 'stopServer') {
doLast {
xpServer.stop()
}
}

task cleanup(type: Delete) {
tasks.register( 'cleanup', Delete ) {
delete './build/reports/allure'
}

task generateReportAndStopServer( type: NpmTask ) {
tasks.register( 'generateReportAndStopServer', NpmTask ) {
args = ['run-script', 'allure-report']
finalizedBy cleanup
finalizedBy stopServer
}


task testAppFirefox( type: NpmTask,
dependsOn: [npmInstall, unpackDistro, copyConfig, copyApps, deployApp, startServer] ) {
tasks.register( 'testAppFirefox', NpmTask ) {
dependsOn: [npmInstall, unpackDistro, copyConfig, copyApps, deployApp, startServer]
args = ['run-script', 'test:firefox']
finalizedBy generateReportAndStopServer
}

task w_testAppChrome( type: NpmTask,
dependsOn: [npmInstall, unpackDistro, copyConfig, copyApps, deployApp, startServer] ) {
tasks.register( 'w_testAppChrome', NpmTask) {
dependsOn: [npmInstall, unpackDistro, copyConfig, copyApps, deployApp, startServer]
args = ['run-script', 'test_apps:wdio_chrome']
finalizedBy generateReportAndStopServer
}
task w_testAppChromeLocal( type: NpmTask, dependsOn: [npmInstall] ) {

tasks.register( 'w_testAppChromeLocal', NpmTask ) {
dependsOn: [npmInstall]
args = ['run-script', 'test_apps:wdio_chrome']
}

Expand Down
4 changes: 2 additions & 2 deletions testing/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@wdio/concise-reporter": "^8.26.3"
},
"engines": {
"node": ">= 18.12.1",
"npm": ">= 8.19.2"
"node": ">= 20.10.0",
"npm": ">= 10.2.3"
}
}

0 comments on commit d33293e

Please sign in to comment.