Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
56d952e3
Commit
56d952e3
authored
Feb 13, 2018
by
Niranjan Bandi
Committed by
Robert Lyon
Feb 28, 2018
Browse files
Bug 1719216: Participation report to show pages in a collection
Change-Id: Ib0e883b573e672a33828f1452643c3d0a3c36655
parent
873bfc73
Changes
3
Hide whitespace changes
Inline
Side-by-side
htdocs/testing/frameworks/behat/classes/BehatGeneral.php
View file @
56d952e3
...
...
@@ -409,6 +409,34 @@ class BehatGeneral extends BehatBase {
$node
->
click
();
}
/**
* Checks the list/table row containing the specified text.
*
* @Then I should see :text in the :rowtext row
* @param string $text we look for
* @param string $rowtext The list/table row text
* @throws ElementNotFoundException
*/
public
function
i_find_in_row
(
$text
,
$rowtext
)
{
// The table row container.
$rowtextliteral
=
$this
->
escaper
->
escapeLiteral
(
$rowtext
);
$exception
=
new
ElementNotFoundException
(
$this
->
getSession
(),
'text'
,
null
,
'the row containing the text "'
.
$rowtext
.
'"'
);
$xpath
=
"//div[(contains(concat(' ', normalize-space(@class), ' '), concat(' ', 'listrow', ' '))"
.
" or contains(concat(' ', normalize-space(@class), ' '), concat(' ', 'list-group-item', ' ')))"
.
" and contains(normalize-space(.), "
.
$rowtextliteral
.
")]"
.
"|"
.
"//tr[contains(normalize-space(.), "
.
$rowtextliteral
.
")]"
.
"|"
.
"//li[(contains(concat(' ', normalize-space(@class), ' '), concat(' ', 'list-group-item', ' ')))"
.
" and contains(normalize-space(.), "
.
$rowtextliteral
.
")]"
;
$rownode
=
$this
->
find
(
'xpath'
,
$xpath
,
$exception
);
// Looking for the element DOM node inside the specified row.
$elementnode
=
$this
->
find
(
'named'
,
array
(
'content'
,
$text
));
$this
->
ensure_node_is_visible
(
$elementnode
);
}
/**
* Click on the link or button inside a list/table row containing the specified text.
*
...
...
@@ -523,6 +551,28 @@ class BehatGeneral extends BehatBase {
$this
->
getSession
()
->
executeScript
(
$jscode
);
}
/**
* Click on the link or button inside a panel access menu containing the specified text.
*
* @When /^I click on "(?P<link_or_button>(?:[^"]|\\")*)" in "(?P<row_text_string>(?:[^"]|\\")*)" panel access menu$/
* @param string $link_or_button we look for
* @param string $rowtext The panel menu text
* @throws ElementNotFoundException
*/
public
function
i_click_on_in_panel_access_menu
(
$link_or_button
,
$rowtext
)
{
// The panel container.
$rowtextliteral
=
$this
->
escaper
->
escapeLiteral
(
$rowtext
);
$exception
=
new
ElementNotFoundException
(
$this
->
getSession
(),
'text'
,
null
,
'the panel access containing the text "'
.
$rowtext
.
'"'
);
$xpath
=
"//div[contains(concat(' ', normalize-space(@class), ' '), concat(' ', 'panel', ' '))"
.
" and contains(normalize-space(.), "
.
$rowtextliteral
.
")]"
;
$rownode
=
$this
->
find
(
'xpath'
,
$xpath
,
$exception
);
// Click on the elipsis button for the panel
$jscode
=
"jQuery(
\"
div.panel h3:contains("
.
$this
->
escapeDoubleQuotes
(
$rowtextliteral
)
.
")
\"
).siblings('.panel-footer').find('.page-access a:contains("
.
$this
->
escapeDoubleQuotes
(
$link_or_button
)
.
")')[0].click();"
;
$this
->
getSession
()
->
executeScript
(
$jscode
);
}
/**
* Click on the link or button inside a panel collection list containing the specified text.
*
...
...
htdocs/testing/frameworks/behat/classes/properties.php
View file @
56d952e3
...
...
@@ -47,11 +47,17 @@ define ("LOCATOR_CONSTANTS", json_encode(array(
'Members without a submission to the group'
=>
array
(
"#nosubmissionslist"
,
"css_element"
),
'Collections shared with this group'
=>
array
(
"#sharedcollectionlist"
,
"css_element"
),
'Pages shared with this group'
=>
array
(
"#sharedviewlist"
,
"css_element"
),
'Shared with this group report'
=>
array
(
"#sharedviewsreport"
,
"css_element"
),
'Matrix table'
=>
array
(
"#tablematrix"
,
"css_element"
),
'Toolbar buttons'
=>
array
(
"#toolbar-buttons"
,
"css_element"
),
#xpath_elements
'Secret urls - table row 1'
=>
array
(
"//table/tbody/tr[1]/td[4]/a"
,
"xpath_element"
),
'Multirecipientnotification'
=>
array
(
"//li[@id='module.multirecipientnotification']"
,
"xpath_element"
),
// xpath related to participation report
'Group views report tr1 tc1'
=>
array
(
"//*[@id='groupviewsreport']/tbody/tr[1]/td[1]"
,
"xpath_element"
),
'Group views report tr1 tc2'
=>
array
(
"//*[@id='groupviewsreport']/tbody/tr[1]/td[2]"
,
"xpath_element"
),
'Group views report tr1 tc3'
=>
array
(
"//*[@id='groupviewsreport']/tbody/tr[1]/td[3]"
,
"xpath_element"
),
'Group views report tr3 tc1'
=>
array
(
"//*[@id='groupviewsreport']/tbody/tr[3]/td[1]"
,
"xpath_element"
),
)));
/**
...
...
test/behat/features/social/participation_report.feature
0 → 100644
View file @
56d952e3
@javascript
@core
Feature
:
Participation report to show pages in a collection
In a participation to see pages in a collection
As an normal user I need to make changes in the group settings
So that I can see the pages in a collection of that group
Background
:
Given the following "users" exist
:
|
username
|
password
|
email
|
firstname
|
lastname
|
institution
|
authname
|
role
|
|
UserA
|
Kupuhipa1
|
UserA@example.org
|
Angela
|
User
|
mahara
|
internal
|
member
|
|
UserB
|
Kupuhipa1
|
UserB@example.org
|
Bob
|
User
|
mahara
|
internal
|
member
|
|
UserC
|
Kupuhipa1
|
UserC@example.org
|
Cecilia
|
User
|
mahara
|
internal
|
member
|
And the following "groups" exist
:
|
name
|
owner
|
description
|
grouptype
|
open
|
invitefriends
|
editroles
|
submittableto
|
allowarchives
|
members
|
staff
|
|
Group
one
|
UserA
|
GroupA
owned
by
UserA
|
standard
|
ON
|
OFF
|
all
|
ON
|
OFF
|
UserB
|
|
And the following "pages" exist
:
|
title
|
description
|
ownertype
|
ownername
|
|
Page
01
|
This
is
Page
01
|
user
|
UserA
|
|
Page
02
|
This
is
Page
02
|
user
|
UserA
|
|
Page
03
|
This
is
Page
03
|
user
|
UserA
|
|
Page
04
|
This
is
Page
03
|
user
|
UserA
|
|
Group
page
01
|
This
is
Group
page
01
|
group
|
Group
one
|
|
Group
page
02
|
This
is
Group
page
02
|
group
|
Group
one
|
|
Group
page
03
|
This
is
Group
page
03
|
group
|
Group
one
|
|
Group
page
04
|
This
is
Group
page
04
|
group
|
Group
one
|
And the following "collections" exist
:
|
title
|
description
|
ownertype
|
ownername
|
pages
|
|
Collection
01
|
This
is
Collection
|
user
|
UserA
|
Page
01,
Page
02
|
|
Group
collection
01
|
This
is
group
collection
|
group
|
Group
one
|
Group
page
01,
Group
page
02
|
Scenario
:
In
the participation report pages should be seen in a collection
# Log in as a normal userA
Given
I log in as
"UserA"
with password
"Kupuhipa1"
# Edit access for Page 03
And
I choose
"Shared by me"
in
"Portfolio"
from main menu
And
I follow
"Pages"
And
I click on
"Edit access"
in
"Page 03"
row
And
I select
"Group one"
from
"accesslist[0][searchtype]"
And I fill in "accesslist[0][startdate]" with "2015/06/15 03
:
00"
And
I press
"Save"
# Edit access for Collection 01
And
I click on
"Edit access"
in
"Collection 01"
row
And
I set the select2 value
"Collection 01"
for
"editaccess_collections"
And
I select
"Group one"
from
"accesslist[0][searchtype]"
And I fill in "accesslist[0][startdate]" with "2015/06/15 03
:
00"
And
I press
"Save"
# Enable the participation report and make the group public
And
I choose
"Groups"
from main menu
And
I click on
"Settings"
in
"Group one"
row
And
I enable the switch
"Participation report"
And
I enable the switch
"Publicly viewable group"
And
I press
"Save group"
# Making group page 01 public
When
I click on
"Group one"
And
I click on
"Pages and collections"
in the
"Arrow-bar nav"
property
And
I click on
"Manage access"
in
"Group collection 01"
panel access menu
And
I select
"Public"
from
"accesslist[0][searchtype]"
And
I press
"Save"
# Making group page 03 public
When
I click on
"Pages and collections"
in the
"Arrow-bar nav"
property
And
I click on
"Manage access"
in
"Group page 03"
panel access menu
And
I select
"Public"
from
"accesslist[0][searchtype]"
And
I press
"Save"
# Making group page 04 public
When
I click on
"Pages and collections"
in the
"Arrow-bar nav"
property
And
I click on
"Manage access"
in
"Group page 04"
panel access menu
And
I select
"Public"
from
"accesslist[0][searchtype]"
And
I press
"Save"
# UserA comments on group page 01
When
I click on
"Pages and collections"
in the
"Arrow-bar nav"
property
And
I follow
"Group collection 01"
And
I fill in
"Adding a comment to group page 01!"
in editor
"Comment"
And
I enable the switch
"Make comment public"
And
I press
"Comment"
# UserA comments on group page 02
And
I press
"Next page"
And
I fill in
"Adding a comment to group page 02!"
in editor
"Comment"
And
I enable the switch
"Make comment public"
And
I press
"Comment"
# UserA comments on group page 03
And
I choose
"Groups"
from main menu
And
I follow
"Group one"
And
I click on
"Pages and collections"
in the
"Arrow-bar nav"
property
And
I follow
"Group page 03"
And
I fill in
"Adding a comment to group page 03!"
in editor
"Comment"
And
I enable the switch
"Make comment public"
And
I press
"Comment"
# UserA comments on group page 04
And
I choose
"Groups"
from main menu
And
I follow
"Group one"
And
I click on
"Pages and collections"
in the
"Arrow-bar nav"
property
And
I follow
"Group page 04"
And
I fill in
"Adding a comment to group page 04!"
in editor
"Comment"
And
I enable the switch
"Make comment public"
And
I press
"Comment"
# Log out as UserA
And
I log out
# Log in as UserB
Given
I log in as
"UserB"
with password
"Kupuhipa1"
# UserB comments on the group page 01
And
I choose
"Groups"
from main menu
And
I follow
"Group one"
And
I follow
"Pages and collections (tab)"
And
I follow
"Group collection 01"
And
I fill in
"Adding a comment as UserB to group page 01!"
in editor
"Comment"
And
I enable the switch
"Make comment public"
And
I press
"Comment"
# UserB comments on group page 02
And
I press
"Next page"
And
I fill in
"Adding a comment as UserB to group page 02!"
in editor
"Comment"
And
I enable the switch
"Make comment public"
And
I press
"Comment"
# UserB comments on group page 03
And
I choose
"Groups"
from main menu
And
I follow
"Group one"
And
I follow
"Pages and collections (tab)"
And
I follow
"Group page 03"
And
I fill in
"Adding a comment as UserB to group page 03!"
in editor
"Comment"
And
I enable the switch
"Make comment public"
And
I press
"Comment"
# UserB comments on group page 04
And
I choose
"Groups"
from main menu
And
I follow
"Group one"
And
I follow
"Pages and collections (tab)"
And
I follow
"Group page 04"
And
I fill in
"Adding a comment as UserB to group page 04!"
in editor
"Comment"
And
I enable the switch
"Make comment public"
And
I press
"Comment"
# Log out as USer B
And
I log out
# UserC comments on group page 01
Given
I log in as
"UserC"
with password
"Kupuhipa1"
And
I choose
"Groups"
from main menu
And
I follow
"searching for groups"
And
I follow
"Group one"
And
I follow
"Pages and collections (tab)"
And
I follow
"Group collection 01"
And
I fill in
"Adding a comment as UserC to group page 01!"
in editor
"Comment"
And
I enable the switch
"Make comment public"
And
I press
"Comment"
# UserC comments on group page 02
And
I press
"Next page"
And
I fill in
"Adding a comment to group page 02!"
in editor
"Comment"
And
I enable the switch
"Make comment public"
And
I press
"Comment"
# UserC comments on group page 03
And
I choose
"Groups"
from main menu
And
I follow
"searching for groups"
And
I follow
"Group one"
And
I follow
"Pages and collections (tab)"
And
I follow
"Group page 03"
And
I fill in
"Adding a comment as UserC to group page 03!"
in editor
"Comment"
And
I enable the switch
"Make comment public"
And
I press
"Comment"
# UserC comments on group page 04
And
I choose
"Groups"
from main menu
And
I follow
"searching for groups"
And
I follow
"Group one"
And
I follow
"Pages and collections (tab)"
And
I follow
"Group page 04"
And
I fill in
"Adding a comment as UserC to group page 04!"
in editor
"Comment"
And
I enable the switch
"Make comment public"
And
I press
"Comment"
# Log out as User C
And
I log out
# Log in as UserA
Given
I log in as
"UserA"
with password
"Kupuhipa1"
And
I choose
"Groups"
from main menu
And
I follow
"Group one"
And
I click on
"Report"
in the
"Arrow-bar nav"
property
# Check elements in Pages and collections shared with this group table
And
I should see
"Collection 01"
in the
"Shared with this group report"
property
And
I should see
"Page 03"
in the
"Shared with this group report"
property
# Check elements in Group pages and collections table
# the following works, but is inelegant. It would be nice to have a step to specify table then row and column by text @TODO
And
I should see
"Group collection 01"
in the
"Group views report tr1 tc1"
property
Then
I should see
"4 comments"
in the
"Group collection 01"
row
And
I should see
"Angela User (2)"
in the
"Group views report tr1 tc2"
property
And
I should see
"Cecilia User (2)"
in the
"Group views report tr1 tc3"
property
And
I should see
"Group page 03"
in the
"Group views report tr3 tc1"
property
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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