Skip to content

Commit

Permalink
Merged in feature/SHIBUI-1281-QA (pull request #335)
Browse files Browse the repository at this point in the history
Feature/SHIBUI-1281 QA

Approved-by: Ryan Mathis <rmathis@unicon.net>
  • Loading branch information
Bill Smith authored and rmathis committed Jul 29, 2019
2 parents 95e22a8 + ce72358 commit 5ff53ea
Show file tree
Hide file tree
Showing 56 changed files with 9,989 additions and 2,387 deletions.
20 changes: 20 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,25 @@ pipeline {
}
}
}

stage('Run Selenium tests') {
when {
expression {
return GIT_BRANCH.startsWith('PR')
}
}
steps {
sh '''
./gradlew integrationTest -Dselenium.host=jenkins
'''
}
post {
always {
junit 'backend/build/test-results/integrationTest/**/*.xml'
}
}
}

stage('Build Docker images') {
when {
expression {
Expand All @@ -27,6 +46,7 @@ pipeline {
'''
}
}

stage('Deploy') {
when {
expression {
Expand Down
79 changes: 42 additions & 37 deletions backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ plugins {
id 'io.franzbecker.gradle-lombok' version '1.13'
id 'com.palantir.docker' version '0.20.1'
id 'com.palantir.docker-run' version '0.20.1'
id 'com.avast.gradle.docker-compose' version '0.8.0'
}

apply plugin: 'io.spring.dependency-management'
Expand Down Expand Up @@ -38,11 +37,11 @@ configurations.all {

configurations {
integrationTestCompile {
extendsFrom testCompile
extendsFrom compile

}
integrationTestRuntime {
extendsFrom testRuntime
extendsFrom runtime
}
}

Expand All @@ -60,8 +59,6 @@ sourceSets {
integrationTest {
groovy {
srcDirs = ['src/integration/groovy']
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
}
resources {
srcDir 'src/integration/resources'
Expand Down Expand Up @@ -194,8 +191,15 @@ dependencies {
//JSON schema validator
compile 'org.sharegov:mjson:1.4.1'

integrationTestRuntime configurations.runtime
integrationTestCompile sourceSets.main.output
integrationTestCompile configurations.compile
integrationTestCompile 'com.saucelabs:sebuilder-interpreter:1.0.6'
integrationTestCompile 'jp.vmi:selenese-runner-java:3.19.2'
integrationTestCompile 'jp.vmi:selenese-runner-java:3.20.0'
integrationTestCompile "org.springframework.boot:spring-boot-starter-test"
integrationTestCompile "org.springframework.security:spring-security-test"
integrationTestCompile "org.spockframework:spock-core:1.1-groovy-2.4"
integrationTestCompile "org.spockframework:spock-spring:1.1-groovy-2.4"

// CSV file support
compile 'com.opencsv:opencsv:4.4'
Expand All @@ -214,11 +218,40 @@ dependencies {
enversTestRuntime configurations.testRuntime
}

sourceSets {
main {
groovy {
srcDirs = ['src/main/groovy', 'src/main/java', generatedSrcDir]
}
java {
srcDirs = []
}
resources {
srcDir new File(buildDir, 'generated/ui')
}
}
integrationTest {
groovy {
srcDirs = ['src/integration/groovy']
compileClasspath += main.output
runtimeClasspath += main.output
}
resources {
srcDir 'src/integration/resources'
srcDir new File(buildDir, 'generated/ui')
}
}
}

task copyUI(type: Copy) {
from tasks.findByPath(':ui:npm_run_buildProd').outputs
into new File(buildDir, 'generated/ui/static')
}

task integrationTest(type: Test) {
group = 'verification'
description = 'Run various integration tests'
dependsOn 'dockerRun', 'runChecker'
finalizedBy 'dockerStop'
dependsOn 'copyUI'
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
systemProperties = System.properties
Expand Down Expand Up @@ -343,34 +376,6 @@ dockerRun {
image 'unicon/shibui'
ports '10101:8080'
daemonize true
command '--spring.profiles.include=no-auth,very-dangerous'
command '--spring.profiles.include=very-dangerous,dev', '--shibui.default-password={noop}password'
clean true
}

task runChecker << {
def ready = false
while (!ready) {
try {
ready = 'http://localhost:10101'.toURL().text.length() > 0
} catch (IOException e) {
println 'cannot reach site'
sleep 5000
}
}
}

/*
* Docker Compose (gradle-docker-compose-plugin) settings.
* Used to start and stop docker containers before running tests.
*/
apply plugin: 'docker-compose'
dockerCompose {
useComposeFiles = ['./src/test/docker-files/docker-compose.yml']
captureContainersOutput = true
waitForTcpPorts = false
}

test {
dependsOn 'composeUp'
finalizedBy 'composeDown'
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,76 @@ package edu.internet2.tier.shibboleth.admin.ui
import jp.vmi.selenium.selenese.Main
import jp.vmi.selenium.selenese.Runner
import jp.vmi.selenium.selenese.config.DefaultConfig
import org.springframework.beans.factory.annotation.Value
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.test.annotation.DirtiesContext
import org.springframework.test.context.ActiveProfiles
import spock.lang.Ignore
import spock.lang.Specification
import spock.lang.Unroll

import java.nio.file.Paths

//TODO: make config configurable
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = [ShibbolethUiApplication])
@ActiveProfiles(['dev'])
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD, methodMode = DirtiesContext.MethodMode.AFTER_METHOD)
class SeleniumSIDETest extends Specification {
@Value('${local.server.port}')
int randomPort

@Ignore
def "Selenium: just run one"() {
setup:
def file = "/SHIBUI-1058_DelegatedAdmin_SubmitSource.side"
def main = new Main()
def config = new DefaultConfig([] as String[]).with {
if (System.properties.getProperty('webdriver.driver')) {
it.driver = System.properties.getProperty('webdriver.driver')
} else {
it.driver = 'remote'
it.remoteUrl = 'http://selenium-hub:4444/wd/hub'
it.remoteBrowser = 'firefox'
}
if (System.properties.getProperty('selenium.host')) {
it.baseurl = "http://${System.properties.getProperty('selenium.host')}:${this.randomPort}"
} else {
it.baseurl = "http://localhost:${this.randomPort}"
}
it
}
def runner = new Runner()
runner.varsMap.put('xmlUpload', Paths.get(this.class.getResource('/TestUpload.xml').toURI()).toString())
main.setupRunner(runner, config, [] as String[])

expect:
def result = runner.run(file, this.class.getResourceAsStream(file))
runner.finish()

assert result.level.exitCode == 0
}

@Unroll
def "#name"() {
setup:
def main = new Main()
def config = new DefaultConfig([] as String[]).with {
System.properties.contains('')
if (System.properties.getProperty('webdriver.driver')) {
it.driver = System.properties.getProperty('webdriver.driver')
} else {
it.driver = 'remote'
it.remoteUrl = 'http://selenium-hub:4444/wd/hub'
it.remoteBrowser = 'firefox'
}
if (System.properties.getProperty('selenium.host')) {
it.baseurl = "http://${System.properties.getProperty('selenium.host')}:${this.randomPort}"
} else {
it.baseurl = "http://localhost:${this.randomPort}"
}
it.baseurl = 'http://localhost:10101'
it
}
def runner = new Runner()
runner.varsMap.put('xmlUpload', Paths.get(this.class.getResource('/TestUpload.xml').toURI()).toString())
main.setupRunner(runner, config, [] as String[])

expect:
Expand All @@ -29,18 +82,30 @@ class SeleniumSIDETest extends Specification {
assert result.level.exitCode == 0

where:
name | file
'Create Dynamic HTTP Metadata Resolver' | '/dhmr.side' //passing
'Metadata Source Happy Path Save' | '/MetadataSourceHappyPathSAVE.side' //passing
// 'Metadata Provider Happy Path Save' | '/MetadataProviderHappyPathSAVE.side' // failing (decimal point bug)
// 'Create Filter Entity ID' | '/CreateFilterEntityID.side' // failing (decimal point bug)
// 'Create Filter REGEX' | '/CreateFilterREGEX.side' // failing (decimal point bug)
// 'Create Filter Script' | '/CreateFilterScript.side' // failing (decimal point bug)
// 'Create Metadata Source From XML' | '/CreateMetadataSourceFromXML.side' // failing (Failure: Cannot click <input type=file> elements)
'Create Metadata Source From Copy' | '/CreateMetadataSourceFromCopy.side' //passing
// 'Delete Entity ID Filter' | '/DeleteEntityIDFilter.side' // failing (decimal point bug, possibly also incomplete)
// 'Delete REGEX Filter' | '/DeleteREGEXFilter_Incomplete.side' // incomplete
'Create Metadata Source from URL' | '/CreateMetadataSourceFromURL.side' //passing
// 'Delete Incomplete Source' | '/DeleteIncompleteSource_Incomplete.side' // incomplete
//TODO: Update or delete where necessary
name | file
// 'Create Dynamic HTTP Metadata Resolver' | '/dhmr.side'
// 'Metadata Source Happy Path Save' | '/MetadataSourceHappyPathSAVE.side'
// 'Metadata Provider Happy Path Save' | '/MetadataProviderHappyPathSAVE.side'
// 'Create Filter Entity ID' | '/CreateFilterEntityID.side'
// 'Create Filter REGEX' | '/CreateFilterREGEX.side'
// 'Create Filter Script' | '/CreateFilterScript.side'
// 'Create Metadata Source From XML' | '/CreateMetadataSourceFromXML.side'
// 'Create Metadata Source From Copy' | '/CreateMetadataSourceFromCopy.side' // currently does not populate MDUI before copy (causes 400)
// 'Create Metadata Source from URL' | '/CreateMetadataSourceFromURL.side'
// 'Delete Entity ID Filter' | '/DeleteEntityIDFilter.side'
// 'Delete REGEX Filter' | '/DeleteREGEXFilter.side'
// 'Delete Incomplete Source' | '/DeleteIncompleteSource.side'
// 'Admin Login' | '/SHIBUI-1031_AdminLogin.side'
// 'Delegated Admin: SubmitSource' | '/SHIBUI-1058_DelegatedAdmin_SubmitSource.side'
// 'Create Filesystem Metadata Resolver' | '/CreateFilesystemMetadataResolver.side'
// 'Create Local Dynamic Metadata Resolver' | '/CreateLocalDynamicMetadataResolver.side'
// 'Delete Entity Attributes Script Filter' | '/DeleteScriptFilter.side'
// 'Create and Delete Name ID Format Entity ID Filter' | '/CreateAndDeleteNameIDFormatEntityIDFilter.side'
// 'Create and Delete Name ID Format Regex Filter' | '/CreateAndDeleteNameIDFormatRegexFilter.side'
// 'Create and Delete Name ID Format Script Filter' | '/CreateAndDeleteNameIDFormatScriptFilter.side'
// 'Create and Modify Filter Order' | '/ModifyFilterOrder.side'
'SHIBUI-1281: Metadata Source Dashboard' | '/SHIBUI-1281.side'
}
}

This file was deleted.

Loading

0 comments on commit 5ff53ea

Please sign in to comment.