mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-12 01:10:07 +00:00
QA: Add some basic browser tests
yippee ki yay! Tests basic functionality 1) presence of Echo button 2) behaviour of clicking Echo button Change-Id: I6334264e1ee73a59da1e7b0c3f18a1d43b565f3a
This commit is contained in:
parent
091d1c9b52
commit
bb6eef198c
8
tests/browser/Gemfile
Executable file
8
tests/browser/Gemfile
Executable file
|
@ -0,0 +1,8 @@
|
|||
#ruby=ruby-2.1.1
|
||||
#ruby-gemset=MobileFrontend
|
||||
|
||||
source "https://rubygems.org"
|
||||
|
||||
gem "chunky_png"
|
||||
gem "mediawiki_api"
|
||||
gem "mediawiki_selenium"
|
17
tests/browser/features/flyout.feature
Normal file
17
tests/browser/features/flyout.feature
Normal file
|
@ -0,0 +1,17 @@
|
|||
@chrome @firefox @en.m.wikipedia.beta.wmflabs.org
|
||||
Feature: Flyout
|
||||
|
||||
Background:
|
||||
Given I am on the "Selenium Echo flyout test page" page
|
||||
|
||||
Scenario: Flyout button not present when anon
|
||||
Then I do not see the notification flyout button
|
||||
|
||||
Scenario: Flyout button present
|
||||
Given I am logged in
|
||||
Then I see the notification flyout button
|
||||
|
||||
Scenario: Flyout button present
|
||||
Given I am logged in
|
||||
When I click the notification flyout button
|
||||
Then I see the notification flyout
|
11
tests/browser/features/flyout_nojs.feature
Normal file
11
tests/browser/features/flyout_nojs.feature
Normal file
|
@ -0,0 +1,11 @@
|
|||
@en.m.wikipedia.beta.wmflabs.org @firefox
|
||||
Feature: Flyout (nojs)
|
||||
|
||||
Background:
|
||||
Given I am viewing the basic non-JavaScript site
|
||||
And I am on the "Selenium Echo flyout test page" page
|
||||
|
||||
Scenario: Flyout button present
|
||||
Given I am logged in
|
||||
When I click the notification flyout button
|
||||
Then I find myself on the "Special:Notifications" page
|
19
tests/browser/features/step_definitions/common_steps.rb
Normal file
19
tests/browser/features/step_definitions/common_steps.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
# For use in Firefox browser tests only
|
||||
Given /^I am using user agent "(.+)"$/ do |user_agent|
|
||||
@user_agent = user_agent
|
||||
@browser = browser(test_name(@scenario), {user_agent: user_agent})
|
||||
$session_id = @browser.driver.instance_variable_get(:@bridge).session_id
|
||||
end
|
||||
|
||||
Then(/^I find myself on the "(.*?)" page$/) do |title|
|
||||
on(ArticlePage, :using_params => {:article_name => title})
|
||||
end
|
||||
|
||||
Given(/^I am viewing the basic non-JavaScript site$/) do
|
||||
step 'I am using user agent "Mozilla/4.0 (compatible; MSIE 5.00; Windows 98)"'
|
||||
end
|
||||
|
||||
Given(/^I am on the "(.+)" page$/) do |title|
|
||||
on(APIPage).create title, "Test is used by Selenium web driver"
|
||||
visit(ArticlePage, :using_params => {:article_name => title})
|
||||
end
|
15
tests/browser/features/step_definitions/flyout_steps.rb
Normal file
15
tests/browser/features/step_definitions/flyout_steps.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
Then(/^I do not see the notification flyout button$/) do
|
||||
on(ArticlePage).flyout_link_container_element.when_not_present
|
||||
end
|
||||
|
||||
Then(/^I see the notification flyout button$/) do
|
||||
on(ArticlePage).flyout_link_container_element.when_present
|
||||
end
|
||||
|
||||
When(/^I click the notification flyout button$/) do
|
||||
on(ArticlePage).flyout_link_element.when_present.click
|
||||
end
|
||||
|
||||
Then(/^I see the notification flyout$/) do
|
||||
on(ArticlePage).flyout_element.when_present
|
||||
end
|
9
tests/browser/features/support/env.rb
Normal file
9
tests/browser/features/support/env.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
require 'mediawiki_selenium'
|
||||
|
||||
if ( ENV['PAGE_WAIT_TIMEOUT'] ) then
|
||||
PageObject.default_page_wait = ENV['PAGE_WAIT_TIMEOUT'].to_i
|
||||
end
|
||||
|
||||
if ( ENV['ELEMENT_WAIT_TIMEOUT'] ) then
|
||||
PageObject.default_element_wait = ENV['ELEMENT_WAIT_TIMEOUT'].to_i
|
||||
end
|
3
tests/browser/features/support/hooks.rb
Normal file
3
tests/browser/features/support/hooks.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Allow running of bundle exec cucumber --dry-run -f stepdefs
|
||||
require "mediawiki_selenium"
|
||||
require 'page-object'
|
8
tests/browser/features/support/pages/article_page.rb
Normal file
8
tests/browser/features/support/pages/article_page.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
class ArticlePage
|
||||
include PageObject
|
||||
include URL
|
||||
page_url URL.url("<%=params[:article_name]%><%=params[:hash]%>")
|
||||
li("flyout_link_container", css: "#pt-notifications")
|
||||
a("flyout_link", css: "#pt-notifications a")
|
||||
div("flyout", css: ".mw-echo-overlay")
|
||||
end
|
Loading…
Reference in a new issue