Skip to content

Commit

Permalink
WIP: Rewrite behat tests
Browse files Browse the repository at this point in the history
  • Loading branch information
David Bogner authored and David Bogner committed Jan 21, 2024
1 parent bea31d4 commit 752e41a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
3 changes: 1 addition & 2 deletions tests/behat/approve_entries.feature
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ Feature: Filter approved and not approved entries from multiple students
And I add to the "Datalynx Test Instance" datalynx the following fields:
| type | name | description | param1 | param2 | param3 |
| text | Text | | | | |
And I follow "More"
And I follow "Filters"
And I follow the datalynx "Filters" link
And I follow "Add a filter"
And I set the field "name" to "notapprovedfilter"
And I set the field "searchandor0" to "AND"
Expand Down
22 changes: 22 additions & 0 deletions tests/behat/behat_mod_datalynx.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,4 +292,26 @@ public function i_close_the_autocomplete_suggestions_list() {
$csstarget = ".col-form-label";
$this->execute('behat_general::i_click_on', [$csstarget, 'css_element']);
}

/**
* Follow the datalynx link of the elements matching the selector.
*
* @When /^I follow the datalynx "(?P<link_string>(?:[^"]|\\")*)" link$/
*/
public function i_follow_the_datalynx_link($linktext) {
$page = $this->getSession()->getPage();
switch ($linktext) {
case 'Filters':
// Code to handle the "Filters" case.
$link = $page->find('css', sprintf('.nav-item [title="Filters"]', $linktext));
break;
case 'Manage':
$link = $page->find('css', sprintf('.nav-item [title="Manage"]', $linktext));
break;
}
if (null === $link) {
throw new \RuntimeException(sprintf('The link "%s" was not found or is not visible', $linktext));
}
$link->click();
}
}
1 change: 0 additions & 1 deletion tests/behat/customfilter_multiselect.feature
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ Feature: Create entry, add multiselect and use customfilter

# Add me some fields.
When I follow "Browse"
And I wait "60" seconds
And I follow "Add a new entry"
And I fill in the entry form fields
| type | name | value |
Expand Down

0 comments on commit 752e41a

Please sign in to comment.