MOBILE-4047 behat: Implement Pull to refresh
parent
889e4cb63a
commit
7aa6eb48f1
|
@ -574,7 +574,7 @@ class behat_app extends behat_app_helper {
|
|||
/**
|
||||
* Performs a pull to refresh gesture.
|
||||
*
|
||||
* @When /^I pull to refresh in the app$/
|
||||
* @When I pull to refresh in the app
|
||||
* @throws DriverException If the gesture is not available
|
||||
*/
|
||||
public function i_pull_to_refresh_in_the_app() {
|
||||
|
|
|
@ -79,6 +79,7 @@ Feature: Test basic usage of assignment activity in app
|
|||
|
||||
# Submit second attempt as a student
|
||||
Given I entered the assign activity "assignment1" on course "Course 1" as "student1" in the app
|
||||
When I pull to refresh in the app
|
||||
Then I should find "Reopened" in the app
|
||||
And I should find "2 out of Unlimited" in the app
|
||||
And I should find "Add a new attempt based on previous submission" in the app
|
||||
|
@ -97,6 +98,7 @@ Feature: Test basic usage of assignment activity in app
|
|||
# View second attempt as a teacher
|
||||
Given I entered the assign activity "assignment1" on course "Course 1" as "teacher1" in the app
|
||||
When I press "Participants" in the app
|
||||
And I pull to refresh in the app
|
||||
And I press "Student student" near "assignment1" in the app
|
||||
Then I should find "Online text submissions" in the app
|
||||
And I should find "Submission test 2nd attempt" in the app
|
||||
|
|
|
@ -34,6 +34,9 @@ Feature: Test basic usage of chat in app
|
|||
And I press "Send" in the app
|
||||
Then I should find "Hi!" in the app
|
||||
And I should find "I am David" in the app
|
||||
# Confirm leave the page
|
||||
And I press the back button in the app
|
||||
And I press "OK" in the app
|
||||
|
||||
# Read messages, view connected users, send beep and reply as student2
|
||||
Given I entered the chat activity "Test chat name" on course "Course 1" as "student2" in the app
|
||||
|
@ -62,6 +65,9 @@ Feature: Test basic usage of chat in app
|
|||
When I set the field "New message" to "I am David" in the app
|
||||
And I press "Send" in the app
|
||||
Then I should find "I am David" in the app
|
||||
# Confirm leave the page
|
||||
And I press the back button in the app
|
||||
And I press "OK" in the app
|
||||
|
||||
# Read messages from past sessions as student2
|
||||
Given I entered the chat activity "Test chat name" on course "Course 1" as "student2" in the app
|
||||
|
|
|
@ -23,6 +23,9 @@ Feature: Test chat navigation
|
|||
And I set the field "New message" to "Test message" in the app
|
||||
And I press "Send" in the app
|
||||
Then I should find "Test message" in the app
|
||||
# Confirm leave the page
|
||||
And I press the back button in the app
|
||||
And I press "OK" in the app
|
||||
|
||||
Scenario: Tablet navigation on chat
|
||||
Given I entered the course "Course 1" as "student2" in the app
|
||||
|
|
|
@ -100,6 +100,7 @@ Feature: Test basic usage of glossary in app
|
|||
# View comments as a student
|
||||
Given I entered the glossary activity "Test glossary" on course "Course 1" as "student1" in the app
|
||||
And I press "Eggplant" in the app
|
||||
When I pull to refresh in the app
|
||||
Then I should find "Comments (2)" in the app
|
||||
|
||||
When I press "Comments" in the app
|
||||
|
|
|
@ -36,8 +36,8 @@ Feature: Test basic usage of comments in app
|
|||
| Field description | Test field description |
|
||||
And I press "Save"
|
||||
And I close the browser tab opened by the app
|
||||
When I entered the course "Course 1" as "teacher1" in the app
|
||||
And I press "Data" in the app
|
||||
|
||||
When I pull to refresh in the app
|
||||
And I press "Add entries" in the app
|
||||
And I set the field "Test field name" to "Test" in the app
|
||||
And I press "Save" in the app
|
||||
|
@ -75,7 +75,7 @@ Feature: Test basic usage of comments in app
|
|||
|
||||
Scenario: Add comments offline & Delete comments offline & Sync comments (database)
|
||||
Given I entered the data activity "Data" on course "Course 1" as "teacher1" in the app
|
||||
When I press "Information" in the app
|
||||
And I press "Information" in the app
|
||||
And I press "Open in browser" in the app
|
||||
And I switch to the browser tab opened by the app
|
||||
And I log in as "teacher1"
|
||||
|
@ -85,8 +85,8 @@ Feature: Test basic usage of comments in app
|
|||
And I press "Save"
|
||||
And I close the browser tab opened by the app
|
||||
|
||||
Given I entered the data activity "Data" on course "Course 1" as "teacher1" in the app
|
||||
Then I press "Add entries" in the app
|
||||
When I pull to refresh in the app
|
||||
And I press "Add entries" in the app
|
||||
And I set the field "Test field name" to "Test" in the app
|
||||
And I press "Save" in the app
|
||||
And I press "More" in the app
|
||||
|
|
|
@ -411,6 +411,7 @@ Feature: Test basic usage of one course in app
|
|||
And I select "Enrolment methods" from the "jump" singleselect
|
||||
And I click on "Enable" "icon" in the "Self enrolment (Student)" "table_row"
|
||||
And I close the browser tab opened by the app
|
||||
|
||||
Given I entered the app as "student2"
|
||||
When I press "Site home" in the app
|
||||
And I press "Available courses" in the app
|
||||
|
|
|
@ -148,9 +148,12 @@ Feature: Test basic usage of courses in app
|
|||
|
||||
# Grade assignment as teacher
|
||||
Given I entered the app as "teacher1"
|
||||
When I press "Grade" in the app
|
||||
When I pull to refresh in the app
|
||||
And I press "Grade" in the app
|
||||
Then the header should be "assignment" in the app
|
||||
And I should find "Test assignment description" in the app
|
||||
|
||||
When I pull to refresh in the app
|
||||
Then I should find "Test assignment description" in the app
|
||||
And I should find "Time remaining" in the app
|
||||
|
||||
When I press "Needs grading" in the app
|
||||
|
|
|
@ -25,8 +25,6 @@ import { CoreCronDelegate, CoreCronDelegateService } from '@services/cron';
|
|||
import { CoreLoadingComponent } from '@components/loading/loading';
|
||||
import { CoreComponentsRegistry } from '@singletons/components-registry';
|
||||
import { CoreDom } from '@singletons/dom';
|
||||
import { IonRefresher } from '@ionic/angular';
|
||||
import { CoreCoursesDashboardPage } from '@features/courses/pages/dashboard/dashboard';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CoreSites, CoreSitesProvider } from '@services/sites';
|
||||
|
||||
|
@ -353,23 +351,17 @@ export class TestingBehatRuntimeService {
|
|||
this.log('Action - pullToRefresh');
|
||||
|
||||
try {
|
||||
// TODO We should generalize this to work with other pages. It's not possible to use
|
||||
// an IonRefresher instance because it doesn't expose any methods to trigger refresh,
|
||||
// so we'll have to find another way.
|
||||
|
||||
const dashboard = this.getAngularInstance<CoreCoursesDashboardPage>(
|
||||
'page-core-courses-dashboard',
|
||||
'CoreCoursesDashboardPage',
|
||||
// 'el' is protected, but there's no other way to trigger refresh programatically.
|
||||
const ionRefresher = this.getAngularInstance<{ el: HTMLIonRefresherElement }>(
|
||||
'ion-refresher',
|
||||
'IonRefresher',
|
||||
);
|
||||
|
||||
if (!dashboard) {
|
||||
return 'ERROR: It\'s not possible to pull to refresh the current page '
|
||||
+ '(the dashboard page is the only one supported at the moment).';
|
||||
if (!ionRefresher) {
|
||||
return 'ERROR: It\'s not possible to pull to refresh the current page.';
|
||||
}
|
||||
|
||||
await new Promise(resolve => {
|
||||
dashboard.refreshDashboard({ complete: resolve } as IonRefresher);
|
||||
});
|
||||
ionRefresher.el.dispatchEvent(new CustomEvent('ionRefresh'));
|
||||
|
||||
return 'OK';
|
||||
} catch (error) {
|
||||
|
|
Loading…
Reference in New Issue