mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 12:32:08 +02:00
MDL-73340 behat: add mobile and table size
This commit is contained in:
parent
72321cff3f
commit
81b0bbe8cb
@ -247,3 +247,24 @@ Feature: Course index depending on role
|
||||
And I should not see "Activity sample 3" in the "region-main" "region"
|
||||
And I click on "Activity sample 3" "link" in the "courseindex-content" "region"
|
||||
Then I should see "Activity sample 3" in the "region-main" "region"
|
||||
|
||||
@javascript
|
||||
Scenario Outline: Course index is displayed by default depending on the screen size.
|
||||
When I change window size to "<device>"
|
||||
And I am on the "C1" "Course" page logged in as "student1"
|
||||
Then "courseindex-content" "region" should <bydefault> visible
|
||||
And I reload the page
|
||||
And "courseindex-content" "region" should <bydefault> visible
|
||||
# Check whenever preferences are saved.
|
||||
And I click on "<action1> course index" "button"
|
||||
And I reload the page
|
||||
And "courseindex-content" "region" should <visible1> visible
|
||||
And I click on "<action2> course index" "button"
|
||||
And I reload the page
|
||||
And "courseindex-content" "region" should <visible2> visible
|
||||
|
||||
Examples:
|
||||
| device | bydefault | action1 | visible1 | action2 | visible2 |
|
||||
| large | be | Close | not be | Open | be |
|
||||
| tablet | not be | Open | not be | Open | not be |
|
||||
| mobile | not be | Open | not be | Open | not be |
|
||||
|
@ -739,8 +739,10 @@ trait behat_session_trait {
|
||||
|
||||
/**
|
||||
* Change browser window size.
|
||||
* - small: 640x480
|
||||
* - medium: 1024x768
|
||||
* - mobile: 425x750
|
||||
* - tablet: 768x1024
|
||||
* - small: 1024x768
|
||||
* - medium: 1366x768
|
||||
* - large: 2560x1600
|
||||
*
|
||||
* @param string $windowsize size of window.
|
||||
@ -756,6 +758,14 @@ trait behat_session_trait {
|
||||
}
|
||||
|
||||
switch ($windowsize) {
|
||||
case "mobile":
|
||||
$width = 425;
|
||||
$height = 750;
|
||||
break;
|
||||
case "tablet":
|
||||
$width = 768;
|
||||
$height = 1024;
|
||||
break;
|
||||
case "small":
|
||||
$width = 1024;
|
||||
$height = 768;
|
||||
|
@ -1250,16 +1250,24 @@ EOF;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change browser window size small: 640x480, medium: 1024x768, large: 2560x1600, custom: widthxheight
|
||||
* Change browser window size
|
||||
*
|
||||
* Allowed sizes:
|
||||
* - mobile: 425x750
|
||||
* - tablet: 768x1024
|
||||
* - small: 1024x768
|
||||
* - medium: 1366x768
|
||||
* - large: 2560x1600
|
||||
* - custom: widthxheight
|
||||
*
|
||||
* Example: I change window size to "small" or I change window size to "1024x768"
|
||||
* or I change viewport size to "800x600". The viewport option is useful to guarantee that the
|
||||
* browser window has same viewport size even when you run Behat on multiple operating systems.
|
||||
*
|
||||
* @throws ExpectationException
|
||||
* @Then /^I change (window|viewport) size to "(small|medium|large|\d+x\d+)"$/
|
||||
* @Then /^I change the (window|viewport) size to "(small|medium|large|\d+x\d+)"$/
|
||||
* @param string $windowsize size of the window (small|medium|large|wxh).
|
||||
* @Then /^I change (window|viewport) size to "(mobile|tablet|small|medium|large|\d+x\d+)"$/
|
||||
* @Then /^I change the (window|viewport) size to "(mobile|tablet|small|medium|large|\d+x\d+)"$/
|
||||
* @param string $windowsize size of the window (mobile|tablet|small|medium|large|wxh).
|
||||
*/
|
||||
public function i_change_window_size_to($windowviewport, $windowsize) {
|
||||
$this->resize_window($windowsize, $windowviewport === 'viewport');
|
||||
|
Loading…
x
Reference in New Issue
Block a user