Skip to content

Commit

Permalink
YDA-5541: Tests for creating deposit group
Browse files Browse the repository at this point in the history
  • Loading branch information
claravox committed Jan 3, 2024
1 parent 585c21d commit 9d2bb22
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 2 deletions.
2 changes: 1 addition & 1 deletion terms/default.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h2>Terms and Conditions</h2>

<p>
There are no terms and comditions configured.
There are no terms and conditions configured.
Please contact your Yoda Administrators.
</p>

Expand Down
28 changes: 28 additions & 0 deletions tests/features/api/api_group.feature
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,20 @@ Feature: Group API
| technicaladmin | not-a-yoda-group |


@deposit
Scenario Outline: Deposit group creation
Given user <user> is authenticated
And the group "<group_name>" does not exist
And the user creates a new deposit group "<group_name>"
Then the response status code is "200"
And the group "<group_name>" is created

Examples:
| user | group_name |
| functionaladminpriv | deposit-api-test2 |
| technicaladmin | deposit-api-test3 |


Scenario Outline: Datamanager group creation
Given user <user> is authenticated
And the group "<group_name>" does not exist
Expand Down Expand Up @@ -169,3 +183,17 @@ Feature: Group API
| technicaladmin | datamanager-api-test1 |
| technicaladmin | research-csvtestgroup |
| technicaladmin | not-a-yoda-group |


@deposit
Scenario Outline: Group deposit delete
Given user <user> is authenticated
And the group "<group_name>" exists
And the user deletes group "<group_name>"
Then the response status code is "200"
And the group "<group_name>" no longer exists

Examples:
| user | group_name |
| functionaladminpriv | deposit-api-test2 |
| technicaladmin | deposit-api-test3 |
33 changes: 33 additions & 0 deletions tests/features/ui/ui_group.feature
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,25 @@ Feature: Group UI
| technicaladmin | test-datamanager1 | test-datamanager1 | test-datamanager1 |


@deposit
Scenario Outline: Group deposit create
Given user <user> is logged in
And module "group_manager" is shown
When user opens add group dialog
And group type is set to deposit
And category is set to <category>
And groupname is set to <group>
And subcategory is set to <subcategory>
When user submits new group data
And deposit group <group> is successfully created
And check whether deposit group properties <group>, <category> and <subcategory> for user <user>

Examples:
| user | category | subcategory | group |
| functionaladminpriv | test-automation | test-automation | ui-test2 |
| technicaladmin | test-automation | test-automation | ui-test3 |


Scenario Outline: Group remove
Given user <user> is logged in
And module "group_manager" is shown
Expand All @@ -179,6 +198,20 @@ Feature: Group UI
| technicaladmin | test-datamanager1 | test-datamanager1 | research-test-datamanager1 |


@deposit
Scenario Outline: Group deposit remove
Given user <user> is logged in
And module "group_manager" is shown
When user selects group <group> in subcategory <subcategory> and category <category>
And user clicks remove group
And user confirms group removal

Examples:
| user | category | subcategory | group |
| functionaladminpriv | test-automation | test-automation | deposit-ui-test2 |
| technicaladmin | test-automation | test-automation | deposit-ui-test3 |


Scenario Outline: Select group in tree view and check group properties are set and active in tree view
Given user researcher is logged in
And module "group_manager" is shown
Expand Down
16 changes: 16 additions & 0 deletions tests/step_defs/api/test_api_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,22 @@ def api_group_create(user, group_name):
)


@given(parsers.parse('the user creates a new deposit group "{group_name}"'), target_fixture="api_response")
def api_group_create_deposit(user, group_name):
cat_and_subcat = group_name.split("-", 1)[1]
return api_request(
user,
"group_create",
{"group_name": group_name,
"category": cat_and_subcat,
"subcategory": cat_and_subcat,
"schema_id": "default-3",
"expiration_date": "",
"description": "",
"data_classification": ""}
)


@given(parsers.parse('the user creates a new datamanager group "{group_name}"'), target_fixture="api_response")
def api_datamanager_group_create(user, group_name):
cat_and_subcat = group_name.split("-", 1)[1]
Expand Down
32 changes: 31 additions & 1 deletion tests/step_defs/ui/test_ui_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,15 @@ def ui_group_schema_set_groupname(browser, group):
browser.find_by_id('f-group-create-name').fill(group)


@when(parsers.parse("group type is set to deposit"))
def ui_group_set_group_type_deposit(browser):
browser.find_by_id('f-group-create-prefix-button').click()
time.sleep(2)
browser.find_by_css('#f-group-create-prefix-deposit a').click()


@when(parsers.parse("group type is set to datamanager"))
def ui_group_set_group_type(browser):
def ui_group_set_group_type_datamanager(browser):
browser.find_by_id('f-group-create-prefix-button').click()
browser.find_by_id('f-group-create-prefix-datamanager').click()

Expand Down Expand Up @@ -515,6 +522,11 @@ def ui_group_schema_assert_datamanager_group_created(browser, group):
assert browser.find_by_css('.alert-success').text == 'Created group datamanager-' + group + '.'


@when(parsers.parse("deposit group {group} is successfully created"))
def ui_group_schema_assert_deposit_group_created(browser, group):
assert browser.find_by_css('.alert-success').text == 'Created group deposit-' + group + '.'


@when(parsers.parse("check whether research group properties {group}, {category}, {subcategory}, {schema_id} and {expiration_date} are correct"))
def ui_group_schema_properties_schema_correct(browser, group, category, subcategory, schema_id, expiration_date):
assert browser.find_by_id('f-group-update-name').value == group
Expand Down Expand Up @@ -545,6 +557,24 @@ def ui_group_schema_properties_default_schema_correct(browser, group, category,
assert div.find_by_css('.select2-selection__rendered').text == subcategory


@when(parsers.parse("check whether deposit group properties {group}, {category} and {subcategory} for user {user}"), target_fixture="api_response")
def ui_group_schema_properties_deposit_default_schema_correct(browser, group, category, subcategory, user):
# Get the default_schema_id from the yoda configuration
result = api_request(
user,
"schema_get_schemas",
{}
)
default_schema_id = list(result)[1]['data']['schema_default']

assert browser.find_by_id('f-group-update-name').value == group
assert browser.find_by_id('f-group-update-schema-id').value == default_schema_id
div = browser.find_by_css('#f-group-update-category').find_by_xpath('..').find_by_css('span .select2-selection')
assert div.find_by_css('.select2-selection__rendered').text == category
div = browser.find_by_css('#f-group-update-subcategory').find_by_xpath('..').find_by_css('span .select2-selection')
assert div.find_by_css('.select2-selection__rendered').text == subcategory


@when(parsers.parse("check whether research group properties {category}, {subcategory} and {expiration_date} are correctly updated"))
def ui_group_schema_properties_update_correct(browser, category, subcategory, expiration_date):
assert browser.find_by_id('f-group-update-expiration-date').value == expiration_date
Expand Down

0 comments on commit 9d2bb22

Please sign in to comment.