Jdlrobson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/126174
Change subject: Story 1924: Tweaks to contributions page
......................................................................
Story 1924: Tweaks to contributions page
* Add some browser tests for contributions and the history page (which
it is based off of to ensure nothing gets broken)
* Add icon to left of username in heading
* Make heading on contributions page point to UserProfile
Change-Id: If50d45656cdb1a2f95ddb5873fee6deaa3f366e6
---
M includes/specials/MobileSpecialPageFeed.php
M includes/specials/SpecialMobileContributions.php
M includes/specials/SpecialMobileHistory.php
M less/specials/pagefeed.less
A tests/browser/features/special_contributions.feature
A tests/browser/features/special_history.feature
M tests/browser/features/step_definitions/common_article_steps.rb
A tests/browser/features/step_definitions/special_contributions_steps.rb
A tests/browser/features/step_definitions/special_history_steps.rb
A tests/browser/features/step_definitions/special_userprofile_steps.rb
M tests/browser/features/support/pages/article_page.rb
A tests/browser/features/support/pages/special_history_page.rb
A tests/browser/features/support/pages/special_userprofile_page.rb
13 files changed, 166 insertions(+), 10 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/74/126174/1
diff --git a/includes/specials/MobileSpecialPageFeed.php
b/includes/specials/MobileSpecialPageFeed.php
index 9a14a3e..37fe6eb 100644
--- a/includes/specials/MobileSpecialPageFeed.php
+++ b/includes/specials/MobileSpecialPageFeed.php
@@ -143,12 +143,15 @@
$html .= Html::element( 'h3', array(),
$title->getPrefixedText() );
}
- $html .= Html::element( 'p', array( 'class' => $usernameClass
), $username ) .
- Html::element(
- 'p', array( 'class' => 'component
truncated-text multi-line two-line' ), $comment
+ if ( $username ) {
+ $html .= Html::element( 'p', array( 'class' =>
$usernameClass ), $username );
+ }
+
+ $html .= Html::element(
+ 'p', array( 'class' => 'edit-summary component
truncated-text multi-line two-line' ), $comment
) .
Html::openElement( 'div', array( 'class' => 'listThumb'
) ) .
- Html::element( 'p', null, $lang->userTime( $ts, $user )
);
+ Html::element( 'p', array( 'class' => 'timestamp' ),
$lang->userTime( $ts, $user ) );
if ( $bytes !== 0 ) {
$html .= Html::element( 'p', array( 'class' =>
$bytesClass ), $formattedBytes );
diff --git a/includes/specials/SpecialMobileContributions.php
b/includes/specials/SpecialMobileContributions.php
index e581181..d8c76aa 100644
--- a/includes/specials/SpecialMobileContributions.php
+++ b/includes/specials/SpecialMobileContributions.php
@@ -8,6 +8,19 @@
/** @var MWTimestamp */
protected $lastDate;
+ /**
+ * Gets HTML to place in the header bar
+ * @param {Title} title: The page to link to
+ * @return string: HTML representing the link in the header bar
+ */
+ protected function getHeaderBarLink( $title ) {
+ return Html::element( 'a',
+ array(
+ 'href' => SpecialPage::getTitleFor(
'UserProfile/' . $title )->getLocalUrl(),
+ ),
+ $title->getText() );
+ }
+
public function executeWhenAvailable( $par = '' ) {
wfProfileIn( __METHOD__ );
if ( $par ) {
@@ -36,12 +49,12 @@
return $conds;
}
- protected function renderFeedItemHtml( $ts, $diffLink ='', $username =
'',
+ protected function renderFeedItemHtmlBeta( $ts, $diffLink ='',
$username = '',
$comment = '', $title = false, $isAnon = false, $bytes = 0
) {
// Stop username from being rendered
$username = false;
- parent::renderFeedItemHtml( $ts, $diffLink, $username,
$comment, $title, false, $bytes );
+ parent::renderFeedItemHtmlBeta( $ts, $diffLink, $username,
$comment, $title, false, $bytes );
}
}
diff --git a/includes/specials/SpecialMobileHistory.php
b/includes/specials/SpecialMobileHistory.php
index 30a9a77..f2b01f3 100644
--- a/includes/specials/SpecialMobileHistory.php
+++ b/includes/specials/SpecialMobileHistory.php
@@ -32,6 +32,17 @@
}
/**
+ * Gets HTML to place in the header bar
+ * @param {Title} title: The page to link to
+ * @return string: HTML representing the link in the header bar
+ */
+ protected function getHeaderBarLink( $title ) {
+ return Html::element( 'a',
+ array( 'href' => $title->getLocalUrl() ),
+ $title->getText() );
+ }
+
+ /**
* Adds HTML to render a header at the top of the feed
* @param {Title} title: The page to link to
*/
@@ -39,8 +50,7 @@
$this->getOutput()->addHtml(
Html::openElement( 'div', array( 'class' =>
'content-header' ) ) .
Html::openElement( 'h2', array() ) .
- Html::element( 'a', array( 'href' =>
$title->getLocalUrl() ),
- $title->getText() ) .
+ $this->getHeaderBarLink( $title ) .
Html::closeElement( 'h2' ) .
Html::closeElement( 'div' )
);
diff --git a/less/specials/pagefeed.less b/less/specials/pagefeed.less
index 227b4c5..2e29b35 100644
--- a/less/specials/pagefeed.less
+++ b/less/specials/pagefeed.less
@@ -75,9 +75,8 @@
.mw-mf-user {
padding: 1px 0 0 20px;
- min-height: 16px;
color: @grayMediumDark;
- background: url(images/user.png) 0 0 no-repeat;
+ background: url(images/user.png) left center no-repeat;
.background-size(16px, auto);
}
diff --git a/tests/browser/features/special_contributions.feature
b/tests/browser/features/special_contributions.feature
new file mode 100644
index 0000000..a851031
--- /dev/null
+++ b/tests/browser/features/special_contributions.feature
@@ -0,0 +1,20 @@
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login @test2.m.wikipedia.org
+Feature: Special:Contributions
+
+ Background:
+ Given I am logged into the mobile website
+ And I am in beta mode
+ And I am on my contributions page
+
+ Scenario: Check components in diff summary
+ When I click the link in the header bar
+ Then I am on my user profile page
+
+ Scenario: Check components in diff summary
+ Then I see a list of my contributions
+ And I see a summary of my last contribution
+ And The last contribution summary shows the title of the page edited
+ And The last contribution summary shows the edit summary
+ And The last contribution summary shows the time of the last edit
+ And The last contribution summary does not show the username
+
diff --git a/tests/browser/features/special_history.feature
b/tests/browser/features/special_history.feature
new file mode 100644
index 0000000..56f5288
--- /dev/null
+++ b/tests/browser/features/special_history.feature
@@ -0,0 +1,19 @@
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login @test2.m.wikipedia.org
+Feature: Special:History
+
+ Background:
+ Given I am in beta mode
+ And the page "Selenium diff test" exists
+ When I click on the history link in the last modified bar
+
+ Scenario: Check components in diff summary
+ When I click the link in the header bar
+ Then The text of the first heading is "Selenium diff test"
+
+ Scenario: Check components in diff summary
+ Then I see a list of page contributions
+ And I see a summary of the last contribution to the page
+ And The last contribution summary does not show the title of the page
edited
+ And The last contribution summary shows the edit summary
+ And The last contribution summary shows the time of the last edit
+ And The last contribution summary shows the username who made the last
edit
diff --git a/tests/browser/features/step_definitions/common_article_steps.rb
b/tests/browser/features/step_definitions/common_article_steps.rb
index a102285..b68fb2d 100644
--- a/tests/browser/features/step_definitions/common_article_steps.rb
+++ b/tests/browser/features/step_definitions/common_article_steps.rb
@@ -89,6 +89,10 @@
on(ArticlePage).edit_history_link_element.when_present.click
end
+When(/^I click on the history link in the last modified bar$/) do
+ on(ArticlePage).last_modified_bar_history_link_element.when_present.click
+end
+
Then /^I see drawer with message "(.+)"$/ do |text|
on(ArticlePage).drawer_element.when_present.text.should match text
end
diff --git
a/tests/browser/features/step_definitions/special_contributions_steps.rb
b/tests/browser/features/step_definitions/special_contributions_steps.rb
new file mode 100644
index 0000000..201ec63
--- /dev/null
+++ b/tests/browser/features/step_definitions/special_contributions_steps.rb
@@ -0,0 +1,23 @@
+Given(/^I am on my contributions page$/) do
+ visit(SpecialContributionsPage)
+end
+
+Then(/^I see a list of my contributions$/) do
+ on(SpecialContributionsPage).side_list_element.should exist
+end
+
+Then(/^I see a summary of my last contribution$/) do
+ on(SpecialContributionsPage).last_contribution_element.should exist
+end
+
+When(/^I click the link in the header bar$/) do
+ on(SpecialContributionsPage).content_header_bar_link_element.click
+end
+
+Then(/^The last contribution summary shows the title of the page edited$/) do
+ on(SpecialContributionsPage).last_contribution_title_element.should exist
+end
+
+Then(/^The last contribution summary does not show the username$/) do
+ on(SpecialHistoryPage).last_contribution_username_element.should_not exist
+end
diff --git a/tests/browser/features/step_definitions/special_history_steps.rb
b/tests/browser/features/step_definitions/special_history_steps.rb
new file mode 100644
index 0000000..f54a2dd
--- /dev/null
+++ b/tests/browser/features/step_definitions/special_history_steps.rb
@@ -0,0 +1,23 @@
+Then(/^I see a list of page contributions$/) do
+ on(SpecialHistoryPage).side_list_element.should exist
+end
+
+Then(/^I see a summary of the last contribution to the page$/) do
+ on(SpecialHistoryPage).last_contribution_element.should exist
+end
+
+Then(/^The last contribution summary shows the username who made the last
edit$/) do
+ on(SpecialHistoryPage).last_contribution_username_element.should exist
+end
+
+Then(/^The last contribution summary does not show the title of the page
edited$/) do
+ on(SpecialHistoryPage).last_contribution_title_element.should_not exist
+end
+
+Then(/^The last contribution summary shows the edit summary$/) do
+ on(SpecialHistoryPage).last_contribution_edit_summary_element.should exist
+end
+
+Then(/^The last contribution summary shows the time of the last edit$/) do
+ on(SpecialHistoryPage).last_contribution_timestamp_element.should exist
+end
diff --git
a/tests/browser/features/step_definitions/special_userprofile_steps.rb
b/tests/browser/features/step_definitions/special_userprofile_steps.rb
new file mode 100644
index 0000000..316dd88
--- /dev/null
+++ b/tests/browser/features/step_definitions/special_userprofile_steps.rb
@@ -0,0 +1,3 @@
+Then(/^I am on my user profile page$/) do
+ on(SpecialUserProfilePage).activity_heading_element.should exist
+end
diff --git a/tests/browser/features/support/pages/article_page.rb
b/tests/browser/features/support/pages/article_page.rb
index 2515159..a4586f8 100644
--- a/tests/browser/features/support/pages/article_page.rb
+++ b/tests/browser/features/support/pages/article_page.rb
@@ -17,6 +17,8 @@
a(:about_link, text: "About Wikipedia")
a(:disclaimer_link, text: "Disclaimers")
+ # last modified bar
+ a(:last_modified_bar_history_link, css: "#mw-mf-last-modified a", index: 0)
# page actions
## edit
li(:edit_button_holder, id: "ca-edit")
diff --git a/tests/browser/features/support/pages/special_history_page.rb
b/tests/browser/features/support/pages/special_history_page.rb
new file mode 100644
index 0000000..7b6d350
--- /dev/null
+++ b/tests/browser/features/support/pages/special_history_page.rb
@@ -0,0 +1,31 @@
+class SpecialHistoryPage < ArticlePage
+ include URL
+ page_url URL.url("Special:History")
+ include PageObject
+ div(:content_header_bar, css: ".content-header")
+ a(:content_header_bar_link) do |page|
+ page.content_header_bar_element.link_element(index: 0)
+ end
+
+ ul(:side_list, css: ".side-list", index: 0)
+ li(:last_contribution) do |page|
+ page.side_list_element.list_item_element(index: 0)
+ end
+ h3(:last_contribution_title) do |page|
+ page.last_contribution_element.h3_element(index: 0)
+ end
+ p(:last_contribution_timestamp) do |page|
+ page.last_contribution_element.paragraph_element(index: 0, css:
".timestamp")
+ end
+ p(:last_contribution_edit_summary) do |page|
+ page.last_contribution_element.paragraph_element(index: 0, css:
".edit-summary")
+ end
+ p(:last_contribution_username) do |page|
+ page.last_contribution_element.paragraph_element(index: 0, css:
".mw-mf-user")
+ end
+end
+
+class SpecialContributionsPage < SpecialHistoryPage
+ include URL
+ page_url URL.url("Special:Contributions/" + ENV["MEDIAWIKI_USER"])
+end
diff --git a/tests/browser/features/support/pages/special_userprofile_page.rb
b/tests/browser/features/support/pages/special_userprofile_page.rb
new file mode 100644
index 0000000..5b730d4
--- /dev/null
+++ b/tests/browser/features/support/pages/special_userprofile_page.rb
@@ -0,0 +1,6 @@
+class SpecialUserProfilePage < ArticlePage
+ include URL
+ include PageObject
+ page_url URL.url("Special:UserProfile/" + ENV["MEDIAWIKI_USER"])
+ h2(:activity_heading, text:"Recent activity")
+end
--
To view, visit https://gerrit.wikimedia.org/r/126174
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If50d45656cdb1a2f95ddb5873fee6deaa3f366e6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits