diff --git a/local_moodleappbehat/tests/behat/behat_app.php b/local_moodleappbehat/tests/behat/behat_app.php index 47ff474bd..c5b4ccfa6 100644 --- a/local_moodleappbehat/tests/behat/behat_app.php +++ b/local_moodleappbehat/tests/behat/behat_app.php @@ -599,7 +599,10 @@ class behat_app extends behat_app_helper { */ public function the_app_has_the_following_config(TableNode $data) { foreach ($data->getRows() as $configrow) { - $this->appconfig[$configrow[0]] = json_decode($configrow[1]); + $name = $configrow[0]; + $value = $this->replace_wwwroot($configrow[1]); + + $this->appconfig[$name] = json_decode($value); } } diff --git a/local_moodleappbehat/tests/behat/behat_app_helper.php b/local_moodleappbehat/tests/behat/behat_app_helper.php index 7270abc27..50a905623 100644 --- a/local_moodleappbehat/tests/behat/behat_app_helper.php +++ b/local_moodleappbehat/tests/behat/behat_app_helper.php @@ -242,7 +242,7 @@ class behat_app_helper extends behat_base { // Assert initial page. $this->spin(function($context) { $page = $context->getSession()->getPage(); - $element = $page->find('xpath', '//page-core-login-site//input[@name="url"]'); + $element = $page->find('xpath', '//page-core-login-site'); if ($element) { // Login screen found. diff --git a/src/core/features/login/pages/site/site.html b/src/core/features/login/pages/site/site.html index b6833401a..186bbc4ce 100644 --- a/src/core/features/login/pages/site/site.html +++ b/src/core/features/login/pages/site/site.html @@ -120,7 +120,7 @@

{{site.title}}

-

{{site.noProtocolUrl}}

+

{{site.noProtocolUrl}}

{{site.location}}

diff --git a/src/core/features/login/tests/behat/basic_usage.feature b/src/core/features/login/tests/behat/basic_usage.feature index b0eb396ad..b1f4c57d6 100755 --- a/src/core/features/login/tests/behat/basic_usage.feature +++ b/src/core/features/login/tests/behat/basic_usage.feature @@ -37,9 +37,8 @@ Feature: Test basic usage of login in app | Username | student1 | | Password | student1 | And I press "Log in" near "Lost password?" in the app - Then I should find "Acceptance test site" in the app + Then the header should be "Acceptance test site" in the app And the UI should match the snapshot - But I should not find "Log in" in the app Scenario: Add a non existing account When I launch the app @@ -160,3 +159,21 @@ Feature: Test basic usage of login in app When I press "OK" in the app And I press "Lost password?" in the app Then I should find "Contact support" in the app + + Scenario: Shows sites list + Given the app has the following config: + | sites | [{"name":"Xavier's School for Gifted Youngsters","alias":"XSGY","imageurl":"https://x-school.campus.edu/logo.png","city":"North Salem","countrycode":"US","url":"https://x-school.campus.edu"},{"name":"Hogwarts", "url":"https://hogwarts.campus.edu"},{"name":"Acceptance test site","url":"$WWWROOT"}] | + When I launch the app + Then I should find "Xavier's School for Gifted Youngsters (XSGY)" in the app + + When I replace "/.*/" within "ion-list ion-item:last-of-type ion-label p:last-of-type" with "campus.example.edu" + Then the UI should match the snapshot + + When I press "Acceptance test site" in the app + Then I should find "Log in" in the app + + When I set the following fields to these values in the app: + | Username | student1 | + | Password | student1 | + And I press "Log in" near "Lost password?" in the app + Then the header should be "Acceptance test site" in the app diff --git a/src/core/features/login/tests/behat/snapshots/test-basic-usage-of-login-in-app-shows-sites-list_8.png b/src/core/features/login/tests/behat/snapshots/test-basic-usage-of-login-in-app-shows-sites-list_8.png new file mode 100644 index 000000000..497c8c333 Binary files /dev/null and b/src/core/features/login/tests/behat/snapshots/test-basic-usage-of-login-in-app-shows-sites-list_8.png differ