Skip to content

Commit

Permalink
Fix behat tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dasistwas committed Jan 13, 2025
1 parent 6553fb1 commit 0ed3294
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 36 deletions.
2 changes: 1 addition & 1 deletion tests/behat/approve_entries.feature
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Feature: Filter approved and not approved entries from multiple students
| description | Behat grid |
And I follow "Set as default view"
And I follow "Set as edit view"
And I wait "300" seconds
And I wait until the page is ready
And I add to "Datalynx Test Instance" datalynx the view of "Tabular" type with:
| name | Approved view |
| description | Approved view |
Expand Down
67 changes: 33 additions & 34 deletions tests/behat/fieldgroup_field.feature
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ Feature: Create entry and add fieldgroups
And I click on "Datalynx field Team member select" item in the autocomplete list
And I press "Save changes"
When I follow "Views"
And I click on "//table/tbody/tr[1]/td[9]/a" "xpath_element"
Then I should see "Gridview"
And I click on "Edit Gridview" "link"
And I click on "Entry template" "link"
Then I should see "Field tags"
Then I add to "id_eparam2_editor" editor the text "[[Testfieldgroup1]] ##edit## ##delete##"
Expand All @@ -70,12 +69,14 @@ Feature: Create entry and add fieldgroups
And I click on "Student 1 ([email protected])" item in the autocomplete list
Then "Student 2 ([email protected])" "autocomplete_suggestions" should exist
And I click on "Student 2 ([email protected])" item in the autocomplete list
And I press the escape key

## Add teammembers to the second line as well.
And I click on "(//*[@class and contains(concat(' ', normalize-space(@class), ' '), ' form-autocomplete-downarrow ')])[2]" "xpath_element"
And I click on "(//ul[@class='form-autocomplete-suggestions']//*[contains(concat('|', string(.), '|'),'|Student 1 ([email protected])|')])[1]" "xpath_element"
And I click on "(//*[@class and contains(concat(' ', normalize-space(@class), ' '), ' form-autocomplete-downarrow ')])[2]" "xpath_element"
And I click on "(//ul[@class='form-autocomplete-suggestions']//*[contains(concat('|', string(.), '|'),'|Student 2 ([email protected])|')])[1]" "xpath_element"
And I press the escape key
And I press "Save changes"
Then I should see "updated"
And I press "Continue"
Expand Down Expand Up @@ -111,12 +112,10 @@ Feature: Create entry and add fieldgroups
And I press "Save changes"
Then I should see "Testfieldgroup1"
When I follow "Views"
And I follow "Gridview"
And I click on "Edit this view" "icon"

Then I should see "Gridview"
And I click on "Edit Gridview" "link"
And I click on "Entry template" "link"
Then I should see "Field tags"

## Add fieldgroup and remove all other fields.
Then I add to "id_eparam2_editor" editor the text "[[Testfieldgroup1]] ##edit## ##delete##"
And I press "Save changes"
Expand All @@ -127,12 +126,12 @@ Feature: Create entry and add fieldgroups
Then I should see "Datalynx field Text"
## Names do not work bc. iterator.

When I set the field with xpath "(//input[@type='text'])[2]" to "3"
When I set the field with xpath "(//input[@type='text'])[3]" to "Text 1 in the first line"
When I set the field with xpath "(//input[@type='text'])[4]" to "6"
When I set the field with xpath "(//input[@type='text'])[5]" to "Text 1 in the second line"
When I set the field with xpath "(//input[@type='text'])[6]" to "9"
When I set the field with xpath "(//input[@type='text'])[7]" to "Text 1 in the third line"
When I set the field with xpath "(//input[@type='text'])[1]" to "3"
When I set the field with xpath "(//input[@type='text'])[2]" to "Text 1 in the first line"
When I set the field with xpath "(//input[@type='text'])[3]" to "6"
When I set the field with xpath "(//input[@type='text'])[4]" to "Text 1 in the second line"
When I set the field with xpath "(//input[@type='text'])[5]" to "9"
When I set the field with xpath "(//input[@type='text'])[6]" to "Text 1 in the third line"

And I press "Save changes"
Then I should see "updated"
Expand All @@ -141,27 +140,27 @@ Feature: Create entry and add fieldgroups
## Add a second entry
When I follow "Add a new entry"

When I set the field with xpath "(//input[@type='text'])[2]" to "12"
When I set the field with xpath "(//input[@type='text'])[3]" to "Text 2 in the first line"
When I set the field with xpath "(//input[@type='text'])[4]" to "15"
When I set the field with xpath "(//input[@type='text'])[5]" to "Text 2 in the second line"
When I set the field with xpath "(//input[@type='text'])[6]" to "18"
When I set the field with xpath "(//input[@type='text'])[7]" to "Text 2 in the third line"
When I set the field with xpath "(//input[@type='text'])[1]" to "12"
When I set the field with xpath "(//input[@type='text'])[2]" to "Text 2 in the first line"
When I set the field with xpath "(//input[@type='text'])[3]" to "15"
When I set the field with xpath "(//input[@type='text'])[4]" to "Text 2 in the second line"
When I set the field with xpath "(//input[@type='text'])[5]" to "18"
When I set the field with xpath "(//input[@type='text'])[6]" to "Text 2 in the third line"

And I press "Save changes"
Then I should see "updated"
And I press "Continue"
## Add a third entry
When I follow "Add a new entry"

When I set the field with xpath "(//input[@type='text'])[2]" to "21"
When I set the field with xpath "(//input[@type='text'])[3]" to "Text 3 in the first line"
When I set the field with xpath "(//input[@type='text'])[4]" to "24"
When I set the field with xpath "(//input[@type='text'])[5]" to "Text 3 in the second line"
When I set the field with xpath "(//input[@type='text'])[6]" to "27"
When I set the field with xpath "(//input[@type='text'])[7]" to "Text 3 in the third line"
When I set the field with xpath "(//input[@type='text'])[8]" to "30"
When I set the field with xpath "(//input[@type='text'])[9]" to "Text 3 in the fourth line"
When I set the field with xpath "(//input[@type='text'])[1]" to "21"
When I set the field with xpath "(//input[@type='text'])[2]" to "Text 3 in the first line"
When I set the field with xpath "(//input[@type='text'])[3]" to "24"
When I set the field with xpath "(//input[@type='text'])[4]" to "Text 3 in the second line"
When I set the field with xpath "(//input[@type='text'])[5]" to "27"
When I set the field with xpath "(//input[@type='text'])[6]" to "Text 3 in the third line"
When I set the field with xpath "(//input[@type='text'])[7]" to "30"
When I set the field with xpath "(//input[@type='text'])[8]" to "Text 3 in the fourth line"

And I press "Save changes"
Then I should see "updated"
Expand All @@ -173,10 +172,10 @@ Feature: Create entry and add fieldgroups
And I click on "(//a/i[@title='Edit'])[2]" "xpath_element"

## Change some values.
When I set the field with xpath "(//input[@type='text'])[2]" to "33"
When I set the field with xpath "(//input[@type='text'])[3]" to "Second Text 2 in the first line"
When I set the field with xpath "(//input[@type='text'])[4]" to ""
When I set the field with xpath "(//input[@type='text'])[5]" to "Second Text 2 in the second line"
When I set the field with xpath "(//input[@type='text'])[1]" to "33"
When I set the field with xpath "(//input[@type='text'])[2]" to "Second Text 2 in the first line"
When I set the field with xpath "(//input[@type='text'])[3]" to ""
When I set the field with xpath "(//input[@type='text'])[4]" to "Second Text 2 in the second line"

## Save and check.
And I press "Save changes"
Expand All @@ -191,14 +190,14 @@ Feature: Create entry and add fieldgroups
## Edit the first entry and remove a whole line.
And I click on "(//a/i[@title='Edit'])[1]" "xpath_element"

When I set the field with xpath "(//input[@type='text'])[1]" to ""
When I set the field with xpath "(//input[@type='text'])[2]" to ""
When I set the field with xpath "(//input[@type='text'])[3]" to ""
When I set the field with xpath "(//input[@type='text'])[4]" to "36"
When I set the field with xpath "(//input[@type='text'])[5]" to "Second Text 1 in the second line"
When I set the field with xpath "(//input[@type='text'])[3]" to "36"
When I set the field with xpath "(//input[@type='text'])[4]" to "Second Text 1 in the second line"
When I set the field with xpath "(//input[@type='text'])[5]" to ""
When I set the field with xpath "(//input[@type='text'])[6]" to ""
When I set the field with xpath "(//input[@type='text'])[7]" to ""
When I set the field with xpath "(//input[@type='text'])[8]" to ""
When I set the field with xpath "(//input[@type='text'])[9]" to ""

And I press "Save changes"
Then I should see "updated"
Expand Down
5 changes: 4 additions & 1 deletion tests/behat/update_entrieswithfiles.feature
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Feature: In a datalynx instance create, update, and delete entries
| select | Select | Option Y |
| checkbox | Checkbox | Option 1=0,Option 3=1 |
| teammemberselect | Team member select | Student 2 (student2@example.com) |
And I upload "lib/tests/fixtures/empty.txt" file to "File" filemanager
#And I upload "lib/tests/fixtures/empty.txt" file to "File" filemanager
And I press "Save changes"
And I press "Continue"

Expand All @@ -89,6 +89,9 @@ Feature: In a datalynx instance create, update, and delete entries
Scenario: Delete one entry
When I set the field with xpath "(//input[@name='entryselector'])[1]" to "1"
And I press "multidelete"
And I wait until the page is ready
And I press "Continue"
And I should see "deleted"
And I press "Continue"
Then I should not see "This is 1"
But I should see "This is 2"

0 comments on commit 0ed3294

Please sign in to comment.