Skip to content

Commit

Permalink
Merge branch 'master' into feature/SHIBUI-1029
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Jan 11, 2019
2 parents 8bec618 + f1a96cf commit 702181a
Show file tree
Hide file tree
Showing 46 changed files with 12,233 additions and 38 deletions.
69 changes: 67 additions & 2 deletions backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plugins {
id 'net.researchgate.release' version '2.6.0'
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'
}

apply plugin: 'io.spring.dependency-management'
Expand All @@ -20,11 +21,28 @@ repositories {
url 'https://build.shibboleth.net/nexus/content/groups/public'
artifactUrls = ['https://build.shibboleth.net/nexus/content/repositories/thirdparty-snapshots']
}
mavenLocal()
}

configurations.all {
resolutionStrategy {
force 'org.cryptacular:cryptacular:1.1.3'

eachDependency { details ->
if (details.requested.group == 'org.seleniumhq.selenium' && details.requested.name != 'htmlunit-driver') {
details.useVersion '3.141.59'
}
}
}
}

configurations {
integrationTestCompile {
extendsFrom testCompile

}
integrationTestRuntime {
extendsFrom testRuntime
}
}

Expand Down Expand Up @@ -70,8 +88,9 @@ springBoot {
}

lombok {
version = "1.16.20"
sha256 = "c5178b18caaa1a15e17b99ba5e4023d2de2ebc18b58cde0f5a04ca4b31c10e6d"
version = "1.18.4"
//TODO: get new sha256
sha256 = ""
}

dependencies {
Expand Down Expand Up @@ -139,6 +158,9 @@ dependencies {

//JSON schema validator
compile 'org.sharegov:mjson:1.4.1'

integrationTestCompile 'com.saucelabs:sebuilder-interpreter:1.0.6'
integrationTestCompile 'jp.vmi:selenese-runner-java:3.19.2'

// CSV file support
compile 'com.opencsv:opencsv:4.4'
Expand All @@ -155,6 +177,27 @@ sourceSets {
srcDirs = []
}
}
integrationTest {
groovy {
srcDirs = ['src/integration/groovy']
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
}
resources {
srcDir 'src/integration/resources'
}
}
}

task integrationTest(type: Test) {
group = 'verification'
description = 'Run various integration tests'
dependsOn 'dockerRun', 'runChecker'
finalizedBy 'dockerStop'
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
systemProperties = System.properties
systemProperties['user.dir'] = workingDir
}

task generateSources {
Expand Down Expand Up @@ -248,4 +291,26 @@ docker {
files tasks.bootJar.outputs
files 'src/main/docker-files/loader.properties'
buildArgs(['JAR_FILE': "shibui-${version}.jar"])
}

tasks.dockerRun.dependsOn tasks.docker
dockerRun {
name 'shibuiint'
image 'unicon/shibui'
ports '10101:8080'
daemonize true
command '--spring.profiles.include=no-auth,very-dangerous'
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
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright 2012 Sauce Labs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.sebuilder.interpreter.webdriverfactory;

import java.io.File;
import java.util.HashMap;
import org.openqa.selenium.firefox.FirefoxBinary;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;

public class Firefox implements WebDriverFactory {
/**
* @param config Key/value pairs treated as required capabilities, with the exception of:
* <ul>
* <li>binary: path to Firefox binary to use</li>
* <li>profile: path to Firefox profile to use</li>
* </ul>
* @return A FirefoxDriver.
*/
@Override
public RemoteWebDriver make(HashMap<String, String> config) {
FirefoxBinary fb = config.containsKey("binary")
? new FirefoxBinary(new File(config.get("binary")))
: new FirefoxBinary();
FirefoxProfile fp = config.containsKey("profile")
? new FirefoxProfile(new File(config.get("profile")))
: new FirefoxProfile();
HashMap<String, String> caps = new HashMap<String, String>(config);
caps.remove("binary");
caps.remove("profile");
FirefoxOptions options = new FirefoxOptions(new DesiredCapabilities(caps));
options.setProfile(fp);
options.setBinary(fb);
return new FirefoxDriver(options);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
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 spock.lang.Specification
import spock.lang.Unroll

class SeleniumSIDETest extends Specification {
@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')
}
it.baseurl = 'http://localhost:10101'
it
}
def runner = new Runner()
main.setupRunner(runner, config, [] as String[])

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

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
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package edu.internet2.tier.shibboleth.admin.ui

import com.sebuilder.interpreter.Script
import com.sebuilder.interpreter.factory.ScriptFactory
import com.sebuilder.interpreter.factory.StepTypeFactory
import com.sebuilder.interpreter.factory.TestRunFactory
import spock.lang.Ignore
import spock.lang.Specification
import spock.lang.Unroll

class SeleniumTest extends Specification {
@Unroll
@Ignore
def "#name"() {
expect:
ScriptFactory scriptFactory = new ScriptFactory().with {
it.stepTypeFactory = new StepTypeFactory()
it.testRunFactory = new TestRunFactory()
it
}
def x = this.class.getResource(file)
def scripts = scriptFactory.parse(new File(this.class.getResource(file).toURI()))
for (Script script : scripts) {
def lastRun = scriptFactory.testRunFactory.createTestRun(script)
assert lastRun.finish()
}

where:
name | file
'Create metadata source from url' | '/CreateMetaDataSourceFromURL.json'
'Create filter entity ID' | '/CreateFilterEntityID.json'
}
}
Loading

0 comments on commit 702181a

Please sign in to comment.