mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-25 08:15:35 +00:00
92ee69b92d
Also adds browser tests for the behaviour of the mark all as read button to ensure it only clears message notifications. Dependency: Ifb7b1b7b7feb4a5af65c79bb16b91a5a9c70166c Change-Id: I46e1de229e32d705e67cebde678ecea3f3633906
55 lines
1.9 KiB
Ruby
55 lines
1.9 KiB
Ruby
def make_page_with_user( title, text, username )
|
|
client = on(APIPage).client
|
|
client.log_in(username, ENV["MEDIAWIKI_PASSWORD"])
|
|
client.create_page(title, text)
|
|
end
|
|
|
|
def make_page_with_user_b( title, text )
|
|
username = get_session_username_b()
|
|
step 'the user "' + username + '" exists'
|
|
make_page_with_user( title, text, username )
|
|
end
|
|
|
|
def make_page_with_user_a( title, text )
|
|
make_page_with_user( title, text, get_session_username() )
|
|
end
|
|
|
|
Given(/^another user writes on my talk page$/) do
|
|
make_page_with_user_b("User talk:" + get_session_username(),
|
|
"== Barnstar ==\nHello Selenium, here is a barnstar for all your testing! " + @random_string + "~~~~\n")
|
|
end
|
|
|
|
Given(/^another user @s me on "(.*?)"$/) do |title|
|
|
username = get_session_username().sub( '_', ' ' )
|
|
text = "@" + username + " Cho cho cho. ~~~~"
|
|
make_page_with_user_b(title, text)
|
|
end
|
|
|
|
Given(/^I come back from grabbing a cup of coffee$/) do
|
|
# Notifications can be extremely slow to trickle into beta labs so go to sleep for a bit
|
|
sleep 7
|
|
end
|
|
|
|
Given(/^another user mentions me on the wiki$/) do
|
|
title = 'Selenium Echo mention test ' + @random_string
|
|
username = get_session_username().sub( '_', ' ' )
|
|
text = "== The walrus ==\n[[User:" + username + "]]: Cho cho cho. ~~~~\n"
|
|
make_page_with_user_b(title, text)
|
|
end
|
|
|
|
Given(/^I am logged in with no notifications$/) do
|
|
# Mark all messages as read
|
|
client = on(APIPage).client
|
|
username = get_session_username()
|
|
step 'the user "' + username + '" exists'
|
|
client.log_in(username, ENV["MEDIAWIKI_PASSWORD"])
|
|
client.action( 'echomarkread', token_type: 'edit', all: '1' )
|
|
|
|
step 'I am logged in my non-shared account'
|
|
on(ArticlePage).flyout_link_element.class_name.should_not match 'mw-echo-unread-notifications'
|
|
end
|
|
|
|
Then(/^I have new notifications$/) do
|
|
on(ArticlePage).flyout_link_element.when_present.class_name.should match 'mw-echo-unread-notifications'
|
|
end
|