Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodle
moodle
Commits
5d3dece4
Commit
5d3dece4
authored
Jun 25, 2020
by
Andrew Nicols
Committed by
Adrian Greeve
Jul 22, 2020
Browse files
MDL-69138 behat: Update session->visit() to use visit step
parent
97abfe31
Changes
9
Hide whitespace changes
Inline
Side-by-side
auth/email/tests/behat/behat_auth_email.php
View file @
5d3dece4
...
@@ -49,6 +49,6 @@ class behat_auth_email extends behat_base {
...
@@ -49,6 +49,6 @@ class behat_auth_email extends behat_base {
$confirmationpath
=
$confirmationurl
->
out_as_local_url
(
false
);
$confirmationpath
=
$confirmationurl
->
out_as_local_url
(
false
);
$url
=
$confirmationpath
.
'?'
.
'data='
.
$secret
.
'/'
.
$username
;
$url
=
$confirmationpath
.
'?'
.
'data='
.
$secret
.
'/'
.
$username
;
$this
->
getSession
()
->
visit
(
$this
->
locate_path
(
$url
)
);
$this
->
execute
(
'behat_general::i_visit'
,
[
$url
]
);
}
}
}
}
auth/tests/behat/behat_auth.php
View file @
5d3dece4
...
@@ -58,7 +58,7 @@ class behat_auth extends behat_base {
...
@@ -58,7 +58,7 @@ class behat_auth extends behat_base {
}
}
// Visit login page.
// Visit login page.
$this
->
getSession
()
->
visit
(
$this
->
locate_path
(
$loginurl
->
out_as_local_url
())
);
$this
->
execute
(
'behat_general::i_visit'
,
[
$loginurl
]
);
// Enter username and password.
// Enter username and password.
$this
->
execute
(
'behat_forms::i_set_the_field_to'
,
array
(
'Username'
,
$this
->
escape
(
$username
)));
$this
->
execute
(
'behat_forms::i_set_the_field_to'
,
array
(
'Username'
,
$this
->
escape
(
$username
)));
...
...
backup/util/ui/tests/behat/behat_backup.php
View file @
5d3dece4
...
@@ -56,7 +56,7 @@ class behat_backup extends behat_base {
...
@@ -56,7 +56,7 @@ class behat_backup extends behat_base {
// table elements are used, and we need to catch exceptions contantly.
// table elements are used, and we need to catch exceptions contantly.
// Go to homepage.
// Go to homepage.
$this
->
getSession
()
->
visit
(
$this
->
locate_path
(
'/?redirect=0'
)
);
$this
->
execute
(
'behat_general::i_visit'
,
[
'/?redirect=0'
]
);
$this
->
execute
(
"behat_general::wait_until_the_page_is_ready"
);
$this
->
execute
(
"behat_general::wait_until_the_page_is_ready"
);
// Click the course link.
// Click the course link.
...
@@ -98,7 +98,7 @@ class behat_backup extends behat_base {
...
@@ -98,7 +98,7 @@ class behat_backup extends behat_base {
// table elements are used, and we need to catch exceptions contantly.
// table elements are used, and we need to catch exceptions contantly.
// Go to homepage.
// Go to homepage.
$this
->
getSession
()
->
visit
(
$this
->
locate_path
(
'/?redirect=0'
)
);
$this
->
execute
(
'behat_general::i_visit'
,
[
'/?redirect=0'
]
);
// Click the course link.
// Click the course link.
$this
->
execute
(
"behat_general::click_link"
,
$backupcourse
);
$this
->
execute
(
"behat_general::click_link"
,
$backupcourse
);
...
@@ -134,7 +134,7 @@ class behat_backup extends behat_base {
...
@@ -134,7 +134,7 @@ class behat_backup extends behat_base {
// table elements are used, and we need to catch exceptions contantly.
// table elements are used, and we need to catch exceptions contantly.
// Go to homepage.
// Go to homepage.
$this
->
getSession
()
->
visit
(
$this
->
locate_path
(
'/?redirect=0'
)
);
$this
->
execute
(
'behat_general::i_visit'
,
[
'/?redirect=0'
]
);
$this
->
execute
(
"behat_general::wait_until_the_page_is_ready"
);
$this
->
execute
(
"behat_general::wait_until_the_page_is_ready"
);
// Click the course link.
// Click the course link.
...
...
calendar/tests/behat/behat_calendar.php
View file @
5d3dece4
...
@@ -121,7 +121,7 @@ class behat_calendar extends behat_base {
...
@@ -121,7 +121,7 @@ class behat_calendar extends behat_base {
*/
*/
public
function
i_view_the_calendar_for
(
$month
,
$year
)
{
public
function
i_view_the_calendar_for
(
$month
,
$year
)
{
$time
=
make_timestamp
(
$year
,
$month
,
1
);
$time
=
make_timestamp
(
$year
,
$month
,
1
);
$this
->
getSession
()
->
visit
(
$this
->
locate_path
(
'/calendar/view.php?view=month&course=1&time='
.
$time
)
);
$this
->
execute
(
'behat_general::i_visit'
,
[
'/calendar/view.php?view=month&course=1&time='
.
$time
]
);
}
}
...
@@ -134,6 +134,6 @@ class behat_calendar extends behat_base {
...
@@ -134,6 +134,6 @@ class behat_calendar extends behat_base {
*/
*/
public
function
i_am_viewing_site_calendar
()
{
public
function
i_am_viewing_site_calendar
()
{
$url
=
new
moodle_url
(
'/calendar/view.php'
,
[
'view'
=>
'month'
]);
$url
=
new
moodle_url
(
'/calendar/view.php'
,
[
'view'
=>
'month'
]);
$this
->
getSession
()
->
visit
(
$this
->
locate_path
(
$url
->
out_as_local_url
(
false
))
);
$this
->
execute
(
'behat_general::i_visit'
,
[
$url
]
);
}
}
}
}
lib/tests/behat/behat_app.php
View file @
5d3dece4
...
@@ -283,7 +283,7 @@ class behat_app extends behat_base {
...
@@ -283,7 +283,7 @@ class behat_app extends behat_base {
global
$CFG
;
global
$CFG
;
// Visit the Ionic URL and wait for it to load.
// Visit the Ionic URL and wait for it to load.
$this
->
getSession
()
->
visit
(
$url
);
$this
->
execute
(
'behat_general::i_
visit
'
,
[
$url
]
);
$this
->
spin
(
$this
->
spin
(
function
(
$context
,
$args
)
{
function
(
$context
,
$args
)
{
$title
=
$context
->
getSession
()
->
getPage
()
->
find
(
'xpath'
,
'//title'
);
$title
=
$context
->
getSession
()
->
getPage
()
->
find
(
'xpath'
,
'//title'
);
...
...
lib/tests/behat/behat_general.php
View file @
5d3dece4
...
@@ -74,7 +74,7 @@ class behat_general extends behat_base {
...
@@ -74,7 +74,7 @@ class behat_general extends behat_base {
* @Given /^I am on homepage$/
* @Given /^I am on homepage$/
*/
*/
public
function
i_am_on_homepage
()
{
public
function
i_am_on_homepage
()
{
$this
->
getSession
()
->
visit
(
$this
->
locate_path
(
'/'
)
);
$this
->
execute
(
'behat_general::i_visit'
,
[
'/'
]
);
}
}
/**
/**
...
@@ -83,7 +83,7 @@ class behat_general extends behat_base {
...
@@ -83,7 +83,7 @@ class behat_general extends behat_base {
* @Given /^I am on site homepage$/
* @Given /^I am on site homepage$/
*/
*/
public
function
i_am_on_site_homepage
()
{
public
function
i_am_on_site_homepage
()
{
$this
->
getSession
()
->
visit
(
$this
->
locate_path
(
'/?redirect=0'
)
);
$this
->
execute
(
'behat_general::i_visit'
,
[
'/?redirect=0'
]
);
}
}
/**
/**
...
@@ -92,7 +92,7 @@ class behat_general extends behat_base {
...
@@ -92,7 +92,7 @@ class behat_general extends behat_base {
* @Given /^I am on course index$/
* @Given /^I am on course index$/
*/
*/
public
function
i_am_on_course_index
()
{
public
function
i_am_on_course_index
()
{
$this
->
getSession
()
->
visit
(
$this
->
locate_path
(
'/course/index.php'
)
);
$this
->
execute
(
'behat_general::i_visit'
,
[
'/course/index.php'
]
);
}
}
/**
/**
...
@@ -1005,7 +1005,7 @@ EOF;
...
@@ -1005,7 +1005,7 @@ EOF;
* @Given /^I trigger cron$/
* @Given /^I trigger cron$/
*/
*/
public
function
i_trigger_cron
()
{
public
function
i_trigger_cron
()
{
$this
->
getSession
()
->
visit
(
$this
->
locate_path
(
'/admin/cron.php'
)
);
$this
->
execute
(
'behat_general::i_visit'
,
[
'/admin/cron.php'
]
);
}
}
/**
/**
...
...
lib/tests/behat/behat_hooks.php
View file @
5d3dece4
...
@@ -496,7 +496,7 @@ EOF;
...
@@ -496,7 +496,7 @@ EOF;
// Again, this would be better in the BeforeSuite hook, but that does not have access to the selectors in
// Again, this would be better in the BeforeSuite hook, but that does not have access to the selectors in
// order to perform the necessary searches.
// order to perform the necessary searches.
$session
=
$this
->
getSession
();
$session
=
$this
->
getSession
();
$
session
->
visit
(
$this
->
locate_path
(
'/'
)
);
$
this
->
execute
(
'behat_general::i_visit'
,
[
'/'
]
);
// Checking that the root path is a Moodle test site.
// Checking that the root path is a Moodle test site.
if
(
self
::
is_first_scenario
())
{
if
(
self
::
is_first_scenario
())
{
...
...
lib/tests/behat/behat_navigation.php
View file @
5d3dece4
...
@@ -526,7 +526,7 @@ class behat_navigation extends behat_base {
...
@@ -526,7 +526,7 @@ class behat_navigation extends behat_base {
}
}
}
}
$this
->
getSession
()
->
visit
(
$this
->
locate_path
(
$url
->
out_as_local_url
())
);
$this
->
execute
(
'behat_general::i_visit'
,
[
$url
]
);
}
}
// Restore global user variable.
// Restore global user variable.
...
@@ -549,8 +549,7 @@ class behat_navigation extends behat_base {
...
@@ -549,8 +549,7 @@ class behat_navigation extends behat_base {
* @throws Exception if the specified page cannot be determined.
* @throws Exception if the specified page cannot be determined.
*/
*/
public
function
i_am_on_page
(
string
$page
)
{
public
function
i_am_on_page
(
string
$page
)
{
$this
->
getSession
()
->
visit
(
$this
->
locate_path
(
$this
->
execute
(
'behat_general::i_visit'
,
[
$this
->
resolve_page_helper
(
$page
)]);
$this
->
resolve_page_helper
(
$page
)
->
out_as_local_url
()));
}
}
/**
/**
...
@@ -629,8 +628,7 @@ class behat_navigation extends behat_base {
...
@@ -629,8 +628,7 @@ class behat_navigation extends behat_base {
* @throws Exception if the specified page cannot be determined.
* @throws Exception if the specified page cannot be determined.
*/
*/
public
function
i_am_on_page_instance
(
string
$identifier
,
string
$type
)
{
public
function
i_am_on_page_instance
(
string
$identifier
,
string
$type
)
{
$this
->
getSession
()
->
visit
(
$this
->
locate_path
(
$this
->
execute
(
'behat_general::i_visit'
,
[
$this
->
resolve_page_instance_helper
(
$identifier
,
$type
)]);
$this
->
resolve_page_instance_helper
(
$identifier
,
$type
)
->
out_as_local_url
()));
}
}
/**
/**
...
@@ -753,7 +751,7 @@ class behat_navigation extends behat_base {
...
@@ -753,7 +751,7 @@ class behat_navigation extends behat_base {
global
$DB
;
global
$DB
;
$course
=
$DB
->
get_record
(
"course"
,
array
(
"fullname"
=>
$coursefullname
),
'id'
,
MUST_EXIST
);
$course
=
$DB
->
get_record
(
"course"
,
array
(
"fullname"
=>
$coursefullname
),
'id'
,
MUST_EXIST
);
$url
=
new
moodle_url
(
'/course/view.php'
,
[
'id'
=>
$course
->
id
]);
$url
=
new
moodle_url
(
'/course/view.php'
,
[
'id'
=>
$course
->
id
]);
$this
->
getSession
()
->
visit
(
$this
->
locate_path
(
$url
->
out_as_local_url
(
false
))
);
$this
->
execute
(
'behat_general::i_visit'
,
[
$url
]
);
}
}
/**
/**
...
@@ -774,13 +772,13 @@ class behat_navigation extends behat_base {
...
@@ -774,13 +772,13 @@ class behat_navigation extends behat_base {
// Javascript is running so it is possible to grab the session ket and jump straight to editing mode.
// Javascript is running so it is possible to grab the session ket and jump straight to editing mode.
$url
->
param
(
'edit'
,
1
);
$url
->
param
(
'edit'
,
1
);
$url
->
param
(
'sesskey'
,
$sesskey
);
$url
->
param
(
'sesskey'
,
$sesskey
);
$this
->
getSession
()
->
visit
(
$this
->
locate_path
(
$url
->
out_as_local_url
(
false
))
);
$this
->
execute
(
'behat_general::i_visit'
,
[
$url
]
);
return
;
return
;
}
}
// Visit the course page.
// Visit the course page.
$this
->
getSession
()
->
visit
(
$this
->
locate_path
(
$url
->
out_as_local_url
(
false
))
);
$this
->
execute
(
'behat_general::i_visit'
,
[
$url
]
);
try
{
try
{
$this
->
execute
(
"behat_forms::press_button"
,
get_string
(
'turneditingon'
));
$this
->
execute
(
"behat_forms::press_button"
,
get_string
(
'turneditingon'
));
...
...
mod/forum/tests/behat/behat_mod_forum.php
View file @
5d3dece4
...
@@ -217,6 +217,6 @@ class behat_mod_forum extends behat_base {
...
@@ -217,6 +217,6 @@ class behat_mod_forum extends behat_base {
global
$DB
;
global
$DB
;
$post
=
$DB
->
get_record
(
"forum_posts"
,
array
(
"subject"
=>
$postsubject
),
'id'
,
MUST_EXIST
);
$post
=
$DB
->
get_record
(
"forum_posts"
,
array
(
"subject"
=>
$postsubject
),
'id'
,
MUST_EXIST
);
$url
=
new
moodle_url
(
'/mod/forum/post.php'
,
[
'reply'
=>
$post
->
id
]);
$url
=
new
moodle_url
(
'/mod/forum/post.php'
,
[
'reply'
=>
$post
->
id
]);
$this
->
getSession
()
->
visit
(
$this
->
locate_path
(
$url
->
out_as_local_url
(
false
))
);
$this
->
execute
(
'behat_general::i_visit'
,
[
$url
]
);
}
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment