Skip to content

Commit

Permalink
Merged in feature/shibui-1743 (pull request #517)
Browse files Browse the repository at this point in the history
Feature/shibui 1743

Approved-by: Ryan Mathis
Approved-by: Jonathan Johnson
Approved-by: Bill Smith
  • Loading branch information
chasegawa authored and Jonathan Johnson committed Sep 28, 2021
2 parents 3c574a1 + 8d9f6f3 commit 6ecc5be
Show file tree
Hide file tree
Showing 138 changed files with 3,641 additions and 2,567 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ beacon/spring/out
*.project
*bin
/a.json
/testbed/authentication/.idea/workspace.xml

# macOS jenv
.java-version
.java-version
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
package edu.internet2.tier.shibboleth.admin.ui.controller

import edu.internet2.tier.shibboleth.admin.ui.domain.EntityDescriptor
import edu.internet2.tier.shibboleth.admin.ui.domain.Organization
import edu.internet2.tier.shibboleth.admin.ui.domain.OrganizationDisplayName
import edu.internet2.tier.shibboleth.admin.ui.domain.OrganizationName
import edu.internet2.tier.shibboleth.admin.ui.domain.OrganizationURL
import edu.internet2.tier.shibboleth.admin.ui.domain.frontend.EntityDescriptorRepresentation
import edu.internet2.tier.shibboleth.admin.ui.repository.EntityDescriptorRepository
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.boot.test.web.client.TestRestTemplate
import org.springframework.http.HttpEntity
import org.springframework.http.HttpHeaders
import org.springframework.http.HttpMethod
import org.springframework.http.MediaType
import org.springframework.test.annotation.DirtiesContext
import org.springframework.test.context.ActiveProfiles
import spock.lang.Specification

Expand Down Expand Up @@ -111,44 +100,9 @@ class EntityDescriptorControllerVersionEndpointsIntegrationTests extends Specifi
edv2.body.serviceProviderName == 'SP2'
}

@DirtiesContext(methodMode = DirtiesContext.MethodMode.AFTER_METHOD)
def 'SHIBUI-1414'() {
given:
def ed = new EntityDescriptor(entityID: 'testme', serviceProviderName: 'testme').with {
entityDescriptorRepository.save(it)
}.with {
it.setOrganization(new Organization().with {
it.organizationNames = [new OrganizationName(value: 'testme', XMLLang: 'en')]
it.organizationDisplayNames = [new OrganizationDisplayName(value: 'testme', XMLLang: 'en')]
it.organizationURLs = [new OrganizationURL(value: 'http://testme.org', XMLLang: 'en')]
it
})
entityDescriptorRepository.save(it)
}
when:
def headers = new HttpHeaders().with {
it.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
it
}

def allVersions = getAllEntityDescriptorVersions(ed.resourceId, List)
String edv1 = getEntityDescriptorForVersion(ed.resourceId, allVersions.body[0].id, String).body
def tedv2 = getEntityDescriptorForVersion(ed.resourceId, allVersions.body[1].id, EntityDescriptorRepresentation).body

def aedv1 = new JsonSlurper().parseText(edv1).with {
it.put('version', tedv2.version)
it
}.with {
JsonOutput.toJson(it)
}

def request = new HttpEntity(aedv1, headers)
def response = this.restTemplate.exchange("/api/EntityDescriptor/${ed.resourceId}", HttpMethod.PUT, request, String)

then:
response.statusCodeValue != 400
noExceptionThrown()
}
// Moved to its own test in the main testing package
// def 'SHIBUI-1414'() {
// }

private getAllEntityDescriptorVersions(String resourceId, responseType) {
this.restTemplate.getForEntity(resourceUriFor(ALL_VERSIONS_URI, resourceId), responseType)
Expand All @@ -165,4 +119,4 @@ class EntityDescriptorControllerVersionEndpointsIntegrationTests extends Specifi
private static resourceUriFor(String uriTemplate, String resourceId) {
String.format(uriTemplate, resourceId)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ class SeleniumSIDETest extends Specification {
'SHIBUI-1740: Verify nonadmin-owned resource visibility' | '/SHIBUI-1740-4.side'
'SHIBUI-1742: Verify enabler role allows enabling' | '/SHIBUI-1742-1.side'
'SHIBUI-1742: Verify role CRUD operations' | '/SHIBUI-1742-2.side'
'SHIBUI-1743: Verify group regex CRUD operations' | '/SHIBUI-1743-1.side'
'SHIBUI-1743: Verify nonadmin group regex validation' | '/SHIBUI-1743-2.side'
'SHIBUI-1744: Verify attribute bundle CRUD operations' | '/SHIBUI-1744-1.side'
'SHIBUI-1744: Verify attribute bundles in metadata sources' | '/SHIBUI-1744-2.side'
'SHIBUI-1744: Verify attribute bundles in entity attribute filters' | '/SHIBUI-1744-3.side'
Expand Down
270 changes: 270 additions & 0 deletions backend/src/integration/resources/SHIBUI-1743-1.side
Original file line number Diff line number Diff line change
@@ -0,0 +1,270 @@
{
"id": "3ac57a4d-2fe9-4904-b496-48105fcbf11e",
"version": "2.0",
"name": "SHIBUI-1743-1",
"url": "http://localhost:10101",
"tests": [{
"id": "aea7965a-db5c-47ec-b902-87e1bd318290",
"name": "SHIBUI-1743-1",
"commands": [{
"id": "035adf50-a869-4192-ad3d-435b6ca04ba1",
"comment": "",
"command": "open",
"target": "/login",
"targets": [],
"value": ""
}, {
"id": "ceb04e82-d01c-429e-b1ea-072acf584f09",
"comment": "",
"command": "type",
"target": "id=username",
"targets": [
["id=username", "id"],
["name=username", "name"],
["css=#username", "css:finder"],
["xpath=//input[@id='username']", "xpath:attributes"],
["xpath=//input", "xpath:position"]
],
"value": "admin"
}, {
"id": "c0ddf5d2-56a4-4d09-b822-f13aa9032266",
"comment": "",
"command": "type",
"target": "id=password",
"targets": [
["id=password", "id"],
["name=password", "name"],
["css=#password", "css:finder"],
["xpath=//input[@id='password']", "xpath:attributes"],
["xpath=//p[2]/input", "xpath:position"]
],
"value": "adminpass"
}, {
"id": "b2d4dcb0-95f2-480e-a8ba-6bcafc0e9414",
"comment": "",
"command": "sendKeys",
"target": "id=password",
"targets": [
["id=password", "id"],
["name=password", "name"],
["css=#password", "css:finder"],
["xpath=//input[@id='password']", "xpath:attributes"],
["xpath=//p[2]/input", "xpath:position"]
],
"value": "${KEY_ENTER}"
}, {
"id": "938e82d0-6e75-428a-9415-d2aa38003793",
"comment": "",
"command": "waitForElementEditable",
"target": "xpath=//button[contains(.,'Advanced')]",
"targets": [],
"value": "30000"
}, {
"id": "b2cef5a2-f0e1-4ca6-9ce5-e4a26314b4cd",
"comment": "",
"command": "open",
"target": "/api/heheheheheheheWipeout",
"targets": [],
"value": ""
}, {
"id": "34c76d5c-89e1-4e62-a424-2b1c845a01db",
"comment": "",
"command": "assertText",
"target": "css=body",
"targets": [],
"value": "yes, you did it"
}, {
"id": "07677e0d-e61d-4b65-ae09-9f3231532c72",
"comment": "",
"command": "open",
"target": "/dashboard",
"targets": [],
"value": ""
}, {
"id": "c3698856-333c-4ab9-b455-d72cb6d3dfe5",
"comment": "",
"command": "waitForElementEditable",
"target": "xpath=//button[contains(.,'Advanced')]",
"targets": [],
"value": "30000"
}, {
"id": "461caf72-51b6-44ff-a9f6-845c4f134f0d",
"comment": "",
"command": "click",
"target": "xpath=//button[contains(.,'Advanced')]",
"targets": [
["id=dropdown-basic", "id"],
["xpath=//button[@id='dropdown-basic']", "xpath:attributes"],
["xpath=//div[@id='basic-nav-dropdown']/button", "xpath:idRelative"],
["xpath=//div/button", "xpath:position"],
["xpath=//button[contains(.,'Advanced')]", "xpath:innerText"]
],
"value": ""
}, {
"id": "dc417d90-3574-460e-a8fc-1207e7824835",
"comment": "",
"command": "click",
"target": "linkText=Groups",
"targets": [
["linkText=Groups", "linkText"],
["css=.text-primary:nth-child(2)", "css:finder"],
["xpath=//a[contains(text(),'Groups')]", "xpath:link"],
["xpath=//div[@id='basic-nav-dropdown']/div/a[2]", "xpath:idRelative"],
["xpath=//a[contains(@href, '/groups')]", "xpath:href"],
["xpath=//a[2]", "xpath:position"],
["xpath=//a[contains(.,'Groups')]", "xpath:innerText"]
],
"value": ""
}, {
"id": "6e2a02bf-dcdb-4e00-ab4b-7a9d92ce5c7d",
"comment": "",
"command": "click",
"target": "css=tr:nth-child(2) .text-primary > .svg-inline--fa",
"targets": [
["css=tr:nth-child(1) .text-primary > .svg-inline--fa", "css:finder"]
],
"value": ""
}, {
"id": "a9de6741-0c08-4eae-b2a4-e1cef4c1326b",
"comment": "",
"command": "type",
"target": "id=root_validationRegex",
"targets": [],
"value": ""
}, {
"id": "8ab0b37b-3584-4e37-9154-ed766fe6546b",
"comment": "",
"command": "type",
"target": "id=root_validationRegex",
"targets": [],
"value": "foo.*"
}, {
"id": "e207cc31-d81c-4128-b029-88c8539d914f",
"comment": "",
"command": "click",
"target": "css=.fa-save > path",
"targets": [
["css=.fa-save > path", "css:finder"]
],
"value": ""
}, {
"id": "1d6fa603-2386-4c9d-86dd-66ed0b1b2727",
"comment": "",
"command": "click",
"target": "css=tr:nth-child(2) .text-primary path",
"targets": [
["css=tr:nth-child(1) .text-primary path", "css:finder"]
],
"value": ""
}, {
"id": "6de5933b-41ca-4e77-bdc3-24ffb1d2c87a",
"comment": "",
"command": "assertValue",
"target": "id=root_validationRegex",
"targets": [],
"value": "foo.*"
}, {
"id": "d00f2c01-9fdf-4112-a476-2b09fcf44fe1",
"comment": "",
"command": "type",
"target": "id=root_validationRegex",
"targets": [],
"value": ""
}, {
"id": "18a4f992-4776-47b0-a1be-8b9eab4201d4",
"comment": "",
"command": "type",
"target": "id=root_validationRegex",
"targets": [],
"value": "foo.*bar"
}, {
"id": "c135922a-ba8e-49e3-9e3c-e5d8fe181f39",
"comment": "",
"command": "click",
"target": "css=.btn-info",
"targets": [
["css=.btn-info", "css:finder"],
["xpath=(//button[@type='button'])[4]", "xpath:attributes"],
["xpath=//div[@id='root']/div/main/div/section/div[2]/div/div/button", "xpath:idRelative"],
["xpath=//div[2]/div/div/button", "xpath:position"],
["xpath=//button[contains(.,' Save')]", "xpath:innerText"]
],
"value": ""
}, {
"id": "5ceb11cd-a144-471f-b628-3c623876aac9",
"comment": "",
"command": "click",
"target": "css=tr:nth-child(2) .text-primary > .svg-inline--fa",
"targets": [
["css=tr:nth-child(1) .text-primary > .svg-inline--fa", "css:finder"]
],
"value": ""
}, {
"id": "b35bf5fc-6e88-4594-a2be-410a8cffa5b7",
"comment": "",
"command": "assertValue",
"target": "id=root_validationRegex",
"targets": [],
"value": "foo.*bar"
}, {
"id": "8196a13f-c609-48e7-9bf7-cf82baa92de3",
"comment": "",
"command": "type",
"target": "id=root_validationRegex",
"targets": [],
"value": ""
}, {
"id": "104a4b2d-4d7e-49e7-880e-5d5a3a3d0c6c",
"comment": "",
"command": "type",
"target": "id=root_validationRegex",
"targets": [],
"value": " "
}, {
"id": "bf4306b6-8daa-44c8-918b-0308facb1168",
"comment": "",
"command": "click",
"target": "css=.btn-info",
"targets": [
["css=.btn-info", "css:finder"],
["xpath=(//button[@type='button'])[4]", "xpath:attributes"],
["xpath=//div[@id='root']/div/main/div/section/div[2]/div/div/button", "xpath:idRelative"],
["xpath=//div[2]/div/div/button", "xpath:position"],
["xpath=//button[contains(.,' Save')]", "xpath:innerText"]
],
"value": ""
}, {
"id": "3cb986b0-40b0-4f40-a684-c1167c7f6165",
"comment": "",
"command": "click",
"target": "css=tr:nth-child(2) .text-primary > .svg-inline--fa",
"targets": [
["css=tr:nth-child(1) .text-primary > .svg-inline--fa", "css:finder"]
],
"value": ""
}, {
"id": "967fef94-832c-493c-83a2-92b174b00567",
"comment": "",
"command": "assertValue",
"target": "id=root_validationRegex",
"targets": [
["id=root_validationRegex", "id"],
["css=#root_validationRegex", "css:finder"],
["xpath=//input[@id='root_validationRegex']", "xpath:attributes"],
["xpath=//div[@id='root']/div/main/div/section/div[2]/div/div[2]/div/form/div/div/div/div[3]/div/div/div/div/input", "xpath:idRelative"],
["xpath=//div[3]/div/div/div/div/input", "xpath:position"]
],
"value": ""
}]
}],
"suites": [{
"id": "c5aa01a8-f302-4538-85f8-2f57971ea640",
"name": "Default Suite",
"persistSession": false,
"parallel": false,
"timeout": 300,
"tests": ["aea7965a-db5c-47ec-b902-87e1bd318290"]
}],
"urls": ["http://localhost:10101/"],
"plugins": []
}
Loading

0 comments on commit 6ecc5be

Please sign in to comment.