commit
58f4dbaba1
|
@ -134,7 +134,7 @@ Feature: Test basic usage of forum activity in app
|
||||||
When I press "Reply" in the app
|
When I press "Reply" in the app
|
||||||
And I set the field "Message" to "not sent reply" in the app
|
And I set the field "Message" to "not sent reply" in the app
|
||||||
And I press "Post to forum" in the app
|
And I press "Post to forum" in the app
|
||||||
And I press "Display options" near "not sent reply" in the app
|
And I press "Display options" within "not sent reply" "ion-card" in the app
|
||||||
Then I should find "Edit" in the app
|
Then I should find "Edit" in the app
|
||||||
|
|
||||||
When I press "Edit" in the app
|
When I press "Edit" in the app
|
||||||
|
@ -244,6 +244,8 @@ Feature: Test basic usage of forum activity in app
|
||||||
When I press "Reply" in the app
|
When I press "Reply" in the app
|
||||||
And I set the field "Message" to "test2" in the app
|
And I set the field "Message" to "test2" in the app
|
||||||
And I press "Post to forum" in the app
|
And I press "Post to forum" in the app
|
||||||
|
Then I should find "test2" "ion-card" in the app
|
||||||
|
|
||||||
When I enter the course "Course 1" as "teacher1" in the app
|
When I enter the course "Course 1" as "teacher1" in the app
|
||||||
And I press "Test forum name" in the app
|
And I press "Test forum name" in the app
|
||||||
And I press "Auto-test" in the app
|
And I press "Auto-test" in the app
|
||||||
|
|
|
@ -511,24 +511,41 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Press an element.
|
* Make sure that an element is visible and wait to trigger the callback.
|
||||||
*
|
*
|
||||||
* @param {HTMLElement} element Element to press.
|
* @param {HTMLElement} element Element.
|
||||||
|
* @param {Function} callback Callback called when the element is visible, passing bounding box parameter.
|
||||||
*/
|
*/
|
||||||
const pressElement = async function(element) {
|
const ensureElementVisible = function(element, callback) {
|
||||||
// Scroll the item into view.
|
|
||||||
const initialRect = element.getBoundingClientRect();
|
const initialRect = element.getBoundingClientRect();
|
||||||
|
|
||||||
element.scrollIntoView(false);
|
element.scrollIntoView(false);
|
||||||
|
|
||||||
await new Promise(resolve => requestAnimationFrame(resolve));
|
requestAnimationFrame(function () {
|
||||||
|
|
||||||
const rect = element.getBoundingClientRect();
|
const rect = element.getBoundingClientRect();
|
||||||
|
|
||||||
if (initialRect.y !== rect.y) {
|
if (initialRect.y !== rect.y) {
|
||||||
await new Promise(resolve => setTimeout(resolve, 300));
|
setTimeout(function () {
|
||||||
|
callback(rect);
|
||||||
|
}, 300);
|
||||||
|
addPendingDelay();
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
callback(rect);
|
||||||
|
});
|
||||||
|
|
||||||
|
addPendingDelay();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Press an element.
|
||||||
|
*
|
||||||
|
* @param {HTMLElement} element Element to press.
|
||||||
|
*/
|
||||||
|
const pressElement = function(element) {
|
||||||
|
ensureElementVisible(element, function(rect) {
|
||||||
// Simulate a mouse click on the button.
|
// Simulate a mouse click on the button.
|
||||||
const eventOptions = {
|
const eventOptions = {
|
||||||
clientX: rect.left + rect.width / 2,
|
clientX: rect.left + rect.width / 2,
|
||||||
|
@ -558,6 +575,7 @@
|
||||||
|
|
||||||
// Mark busy until the button click finishes processing.
|
// Mark busy until the button click finishes processing.
|
||||||
addPendingDelay();
|
addPendingDelay();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,17 +16,17 @@ Feature: It opens external links properly.
|
||||||
| forum | Test forum | Test forum | C1 | forum |
|
| forum | Test forum | Test forum | C1 | forum |
|
||||||
And the following forum discussions exist in course "Course 1":
|
And the following forum discussions exist in course "Course 1":
|
||||||
| forum | user | name | message |
|
| forum | user | name | message |
|
||||||
| Test forum | student1 | Forum topic | See <a href="https://moodle.org/">moodle.org</a> |
|
| Test forum | student1 | Forum topic | See <a href="https://moodle.org/">moodle.org external link</a> |
|
||||||
|
|
||||||
Scenario: Click an external link
|
Scenario: Click an external link
|
||||||
When I enter the course "Course 1" as "student1" in the app
|
When I enter the course "Course 1" as "student1" in the app
|
||||||
And I press "Test forum" in the app
|
And I press "Test forum" in the app
|
||||||
And I press "Forum topic" in the app
|
And I press "Forum topic" in the app
|
||||||
And I press "moodle.org" in the app
|
And I press "moodle.org external link" in the app
|
||||||
Then I should find "You are about to leave the app" in the app
|
Then I should find "You are about to leave the app" in the app
|
||||||
|
|
||||||
When I press "Cancel" in the app
|
When I press "Cancel" in the app
|
||||||
And I press "moodle.org" in the app
|
And I press "moodle.org external link" in the app
|
||||||
And I press "OK" in the app
|
And I press "OK" in the app
|
||||||
Then the app should have opened a browser tab with url "moodle.org"
|
Then the app should have opened a browser tab with url "moodle.org"
|
||||||
|
|
||||||
|
@ -39,9 +39,9 @@ Feature: It opens external links properly.
|
||||||
When I close the browser tab opened by the app
|
When I close the browser tab opened by the app
|
||||||
When I close the popup in the app
|
When I close the popup in the app
|
||||||
And I press "Forum topic" in the app
|
And I press "Forum topic" in the app
|
||||||
And I press "moodle.org" in the app
|
And I press "moodle.org external link" in the app
|
||||||
And I select "Don't show again." in the app
|
And I select "Don't show again." in the app
|
||||||
And I press "OK" in the app
|
And I press "OK" in the app
|
||||||
And I close the browser tab opened by the app
|
And I close the browser tab opened by the app
|
||||||
And I press "moodle.org" in the app
|
And I press "moodle.org external link" in the app
|
||||||
Then the app should have opened a browser tab with url "moodle.org"
|
Then the app should have opened a browser tab with url "moodle.org"
|
||||||
|
|
Loading…
Reference in New Issue