-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from SURFscz/feature-behave
Rewrite tests to behave features and scenarios
- Loading branch information
Showing
12 changed files
with
397 additions
and
473 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ pyvenv.cfg | |
config.yml | ||
prd.yml | ||
acc.yml | ||
browser | ||
./*.yml | ||
status/ | ||
venv/ | ||
screenshot.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,104 +1,140 @@ | ||
sbs_ci: | ||
start: 'https://changeit/landing' | ||
user: 'changeit' | ||
password: 'changeit' | ||
--- | ||
sbs: | ||
url: 'https://acc.sram.surf.nl/' | ||
|
||
sram_monitoring: | ||
'https://demo-sp.sram.surf.nl/rp/acc': | ||
user1.password: | ||
sub: [email protected] | ||
name: Student One | ||
eduperson_entitlement: | ||
- urn:mace:surf.nl:sram-acc:group:surf_demo:monitoringco | ||
- urn:mace:surf.nl:sram-acc:group:surf_demo:monitoringco:sram_demosp_acc-tweebob | ||
- urn:mace:surf.nl:sram-acc:group:surf_demo | ||
- urn:mace:surf.nl:sram-acc:group:surf_demo:monitoringco:testdienst-g2 | ||
- urn:geant:eduteams.org:acc.sram.eduteams.org:group:surf-ram#acc.sram.eduteams.org | ||
voperson_external_affiliation: | ||
- [email protected] | ||
- [email protected] | ||
user2.password: | ||
sub: [email protected] | ||
name: Employee One | ||
pam: | ||
token: 'xxx' | ||
|
||
monitoring: | ||
oidc_url: 'https://demo-sp.sram.surf.nl/rp/acc' | ||
saml_url: 'https://demo-sp.sram.surf.nl/auth/acc?format=json' | ||
|
||
accounts: | ||
student: | ||
name: 'Student One' | ||
password: 'xxx' | ||
employee: | ||
name: 'Employee One' | ||
password: 'xxx' | ||
|
||
user_data: | ||
student: | ||
oidc_url: | ||
sub: "[email protected]" | ||
name: "Student One" | ||
given_name: "Student" | ||
family_name: "One" | ||
email: "[email protected]" | ||
uid: | ||
- "sone" | ||
eduperson_entitlement: | ||
- urn:mace:surf.nl:sram-acc:group:surf_demo:monitoringco:sram_demosp_acc-tweebob | ||
- urn:mace:surf.nl:sram-acc:group:surf_demo:monitoringco | ||
- urn:mace:surf.nl:sram-acc:group:surf_demo | ||
- urn:mace:surf.nl:sram-acc:group:surf_demo:monitoringco:testdienst-g2 | ||
- urn:geant:eduteams.org:acc.sram.eduteams.org:group:surf-ram#acc.sram.eduteams.org | ||
- "urn:mace:surf.nl:sram-acc:group:sramadmin:samloidc_monitor" | ||
- "urn:mace:surf.nl:sram-acc:group:sramadmin" | ||
- "urn:geant:eduteams.org:acc.sram.eduteams.org:group:surf-ram#acc.sram.eduteams.org" | ||
eduperson_principal_name: | ||
- "[email protected]" | ||
eduperson_scoped_affiliation: | ||
- "[email protected]" | ||
voperson_external_affiliation: | ||
- [email protected] | ||
- [email protected] | ||
'https://demo-sp.sram.surf.nl/auth/acc?format=json': | ||
user1.password: | ||
- "[email protected]" | ||
- "[email protected]" | ||
voperson_external_id: | ||
- "[email protected]" | ||
voperson_id: | ||
- "[email protected]" | ||
|
||
saml_url: | ||
uid: | ||
- sone | ||
- "sone" | ||
schacHomeOrganization: | ||
- test-idp.sram.surf.nl | ||
- "test-idp.sram.surf.nl" | ||
voPersonExternalID: | ||
- [email protected] | ||
- "[email protected]" | ||
displayName: | ||
- Student One | ||
- "Student One" | ||
cn: | ||
- Student One | ||
- "Student One" | ||
sn: | ||
- One | ||
- "One" | ||
givenName: | ||
- Student | ||
- "Student" | ||
mail: | ||
- [email protected] | ||
- "[email protected]" | ||
eduPersonUniqueId: | ||
- [email protected] | ||
- "[email protected]" | ||
subject-id: | ||
- [email protected] | ||
- "[email protected]" | ||
voPersonID: | ||
- [email protected] | ||
- "[email protected]" | ||
voPersonExternalAffiliation: | ||
- [email protected] | ||
- [email protected] | ||
- "[email protected]" | ||
- "[email protected]" | ||
eduPersonEntitlement: | ||
- urn:mace:surf.nl:sram-acc:group:surf_demo:monitoringco | ||
- urn:mace:surf.nl:sram-acc:group:surf_demo:monitoringco:sram_demosp_acc-tweebob | ||
- urn:mace:surf.nl:sram-acc:group:surf_demo | ||
- urn:mace:surf.nl:sram-acc:group:surf_demo:monitoringco:testdienst-g2 | ||
- urn:geant:eduteams.org:acc.sram.eduteams.org:group:surf-ram#acc.sram.eduteams.org | ||
- "urn:mace:surf.nl:sram-acc:group:sramadmin" | ||
- "urn:mace:surf.nl:sram-acc:group:sramadmin:samloidc_monitor" | ||
- "urn:geant:eduteams.org:acc.sram.eduteams.org:group:surf-ram#acc.sram.eduteams.org" | ||
eduPersonPrincipalName: | ||
- [email protected] | ||
- "[email protected]" | ||
eduPersonScopedAffiliation: | ||
- [email protected] | ||
user2.password: | ||
- "[email protected]" | ||
|
||
employee: | ||
oidc_url: | ||
sub: "[email protected]" | ||
name: "Employee One" | ||
given_name: "Employee" | ||
family_name: "One" | ||
email: "[email protected]" | ||
uid: | ||
- "eone" | ||
eduperson_entitlement: | ||
- "urn:mace:surf.nl:sram-acc:group:sramadmin" | ||
- "urn:mace:surf.nl:sram-acc:group:sramadmin:samloidc_monitor" | ||
- "urn:geant:eduteams.org:acc.sram.eduteams.org:group:surf-ram#acc.sram.eduteams.org" | ||
eduperson_principal_name: | ||
- "[email protected]" | ||
eduperson_scoped_affiliation: | ||
- "[email protected]" | ||
voperson_external_affiliation: | ||
- "[email protected]" | ||
- "[email protected]" | ||
voperson_external_id: | ||
- "[email protected]" | ||
voperson_id: | ||
- "[email protected]" | ||
|
||
saml_url: | ||
uid: | ||
- eone | ||
- "eone" | ||
schacHomeOrganization: | ||
- test-idp.sram.surf.nl | ||
- "test-idp.sram.surf.nl" | ||
voPersonExternalID: | ||
- [email protected] | ||
- "[email protected]" | ||
displayName: | ||
- Employee One | ||
- "Employee One" | ||
cn: | ||
- Employee One | ||
- "Employee One" | ||
sn: | ||
- One | ||
- "One" | ||
givenName: | ||
- Employee | ||
- "Employee" | ||
mail: | ||
- [email protected] | ||
- "[email protected]" | ||
eduPersonUniqueId: | ||
- [email protected] | ||
- "[email protected]" | ||
subject-id: | ||
- [email protected] | ||
- "[email protected]" | ||
voPersonID: | ||
- [email protected] | ||
- "[email protected]" | ||
voPersonExternalAffiliation: | ||
- [email protected] | ||
- [email protected] | ||
- "[email protected]" | ||
- "[email protected]" | ||
eduPersonEntitlement: | ||
- urn:mace:surf.nl:sram-acc:group:surf_demo:monitoringco | ||
- urn:mace:surf.nl:sram-acc:group:surf_demo:monitoringco:testdienst-g2 | ||
- urn:mace:surf.nl:sram-acc:group:surf_demo | ||
- urn:mace:surf.nl:sram-acc:group:surf_demo:monitoringco:sram_demosp_acc-tweebob | ||
- urn:geant:eduteams.org:acc.sram.eduteams.org:group:surf-ram#acc.sram.eduteams.org | ||
- "urn:mace:surf.nl:sram-acc:group:sramadmin" | ||
- "urn:mace:surf.nl:sram-acc:group:sramadmin:samloidc_monitor" | ||
- "urn:geant:eduteams.org:acc.sram.eduteams.org:group:surf-ram#acc.sram.eduteams.org" | ||
eduPersonPrincipalName: | ||
- [email protected] | ||
- "[email protected]" | ||
eduPersonScopedAffiliation: | ||
- [email protected] | ||
- "[email protected]" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Feature: Monitoring | ||
Scenario Outline: Verifying End-to-End flow for user <user> | ||
Given SBS health UP | ||
and we visit monitoring <start> | ||
and we choose SRAM Monitoring IdP | ||
When we login as <user> | ||
Then test userdata for <user> in <start> | ||
|
||
Examples: Test | ||
| start | user | | ||
| oidc_url | student | | ||
| saml_url | student | | ||
| oidc_url | employee | | ||
| saml_url | employee | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Feature: SBS login | ||
Scenario Outline: Verifying SBS login user <user> | ||
Given SBS health UP | ||
and we visit profile | ||
and we choose SRAM Monitoring IdP | ||
When we login as <user> | ||
Then <user> name in profile | ||
|
||
Examples: Test | ||
| user | | ||
| student | | ||
| employee | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Feature: PAM weblogin | ||
Scenario Outline: Verifying PAM weblogin for user <user> | ||
Given SBS health UP | ||
and we call pam start | ||
and we use link to login | ||
and we choose SRAM Monitoring IdP | ||
When we login as <user> | ||
Then we use code to check pam check-pin | ||
|
||
Examples: Test | ||
| user | | ||
| student | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
from behave import fixture, use_fixture | ||
from selenium.webdriver import Remote, ChromeOptions, FirefoxOptions | ||
from selenium.webdriver.support.wait import WebDriverWait | ||
import yaml | ||
|
||
|
||
@fixture | ||
def selenium_browser(context, browser): | ||
if browser == 'chrome': | ||
options = ChromeOptions() | ||
else: | ||
options = FirefoxOptions() | ||
|
||
options.add_argument('--headless') | ||
# options.add_argument('--ignore-certificate-errors') | ||
# options.add_argument('--user-data-dir=/tmp/chrome-data') | ||
context.browser = Remote("http://127.0.0.1:4444", options=options) | ||
context.browser.implicitly_wait(5) | ||
context.wait = WebDriverWait(context.browser, timeout=5) | ||
|
||
# Halts all tests on error | ||
context.config.stop = True | ||
yield context.browser | ||
|
||
context.browser.quit() | ||
|
||
|
||
def before_all(context): | ||
env = context.config.userdata.get("ENV") | ||
|
||
with open(env, 'r') as f: | ||
try: | ||
config = yaml.load(f, Loader=yaml.FullLoader) | ||
except yaml.YAMLError as exc: | ||
print(exc) | ||
|
||
context.env = config | ||
|
||
|
||
def before_feature(context, feature): | ||
pass | ||
|
||
|
||
def before_scenario(context, scenario): | ||
browser = context.config.userdata.get("BROWSER") | ||
use_fixture(selenium_browser, context, browser) | ||
|
||
|
||
def after_scenario(context, scenario): | ||
pass | ||
|
||
|
||
def after_step(context, step): | ||
if step.status == "failed": | ||
print(context.browser.current_url) | ||
print(context.browser.page_source) | ||
context.browser.save_screenshot("screenshot.png") |
Oops, something went wrong.