diff options
Diffstat (limited to 'Echo/tests/browser/features')
14 files changed, 0 insertions, 253 deletions
diff --git a/Echo/tests/browser/features/no_javascript.feature b/Echo/tests/browser/features/no_javascript.feature deleted file mode 100644 index a8b318ed..00000000 --- a/Echo/tests/browser/features/no_javascript.feature +++ /dev/null @@ -1,11 +0,0 @@ -@chrome @en.wikipedia.beta.wmflabs.org @firefox @localhost @vagrant -Feature: Basic features for no-js functionality - - Background: - Given I am using a nojs browser - - Scenario: Clicking alerts badge goes to Special:Notifications - Given I am logged in - When I click the alert badge - And I wait for the page to load - Then I am on Special Notifications page diff --git a/Echo/tests/browser/features/notifications.feature b/Echo/tests/browser/features/notifications.feature deleted file mode 100644 index 3d443a7d..00000000 --- a/Echo/tests/browser/features/notifications.feature +++ /dev/null @@ -1,22 +0,0 @@ -@chrome @en.wikipedia.beta.wmflabs.org @firefox @localhost @vagrant -Feature: Testing notification types - - Background: - Given I am logged in - And all my notifications are read - - Scenario: Someone mentions me - Given another user mentions me - When I refresh the page - Then the alert badge is showing unseen notifications - And the alert badge value is "Alert (1)" - - @skip - Scenario: Someone writes on my talk page - Given another user writes on my talk page - When I refresh the page - Then the alert badge is showing unseen notifications - And the alert badge value is "Alert (1)" - When I click the alert badge - And I see the alert popup - Then there are "1" unread notifications in the alert popup diff --git a/Echo/tests/browser/features/step_definition/badge_steps.rb b/Echo/tests/browser/features/step_definition/badge_steps.rb deleted file mode 100644 index 82590cb1..00000000 --- a/Echo/tests/browser/features/step_definition/badge_steps.rb +++ /dev/null @@ -1,10 +0,0 @@ -# Steps related to clicking and interacting with the badge -# Work in both nojs and js version - -Given(/^I click the alert badge$/) do - on(ArticlePage).alerts_element.when_present.click -end - -Given(/^I click the notice badge$/) do - on(ArticlePage).notices_element.when_present.click -end diff --git a/Echo/tests/browser/features/step_definition/no_javascript.rb b/Echo/tests/browser/features/step_definition/no_javascript.rb deleted file mode 100644 index 5cf97b1b..00000000 --- a/Echo/tests/browser/features/step_definition/no_javascript.rb +++ /dev/null @@ -1,21 +0,0 @@ -# This test has no javascript -# Therefore this test has no AJAX -# Therefore it should run without any "when_present" clauses -# If you need a "when_present" to make the test run, that is a bug - -Given(/^I am using a nojs browser$/) do - # The following user-agent string contains: - # SymbianOS: for RL to NOT load the modern experience - # SMART-TV-SamsungBrowser: to bypass mobile-frontend and stay on the desktop site - browser_factory.override(browser_user_agent: 'SymbianOS,SMART-TV-SamsungBrowser') -end - -Given(/^I wait for the page to load$/) do - # Wait for the page to load. We're technically clicking the <li> rather than <a>, - # so the special-case implicit wait after clicking links doesn't kick in. - browser.wait -end - -Given(/^I am on Special Notifications page$/) do - expect(on(SpecialNotificationsPage).firstHeading).to match('Notifications') -end diff --git a/Echo/tests/browser/features/step_definition/notifications_steps.rb b/Echo/tests/browser/features/step_definition/notifications_steps.rb deleted file mode 100644 index 5557c5db..00000000 --- a/Echo/tests/browser/features/step_definition/notifications_steps.rb +++ /dev/null @@ -1,76 +0,0 @@ -Given(/^all my notifications are read$/) do - clear_unread_notifications(@username) -end - -Given(/^I refresh the page$/) do - on(ArticlePage) do |page| - page.refresh - end -end - -Given(/^another user mentions me$/) do - message = '===Mention test===\nI am mentioning [[User:' + user(nil) + - ']] in this page to test Echo notifications. ~~~~' - as_user(:b) do - api.create_page( - @data_manager.get('Echo_test_page'), - message - ) - end -end - -Given(/^another user writes on my talk page$/) do - talk_page = "User_talk:#{user}" - message = '===Talk page test===\n' + - 'I am writing a message in your user page to test Echo notifications. ~~~~' - as_user(:b) do - api.create_page(talk_page, message) - end -end - -Given(/^the alert badge is showing unseen notifications$/) do - on(ArticlePage) do |page| - page.refresh_until do - page.alerts.badge_unseen_element.exists? - end - end -end - -Given(/^the notice badge is showing unseen notifications$/) do - on(ArticlePage) do |page| - page.refresh_until do - page.notices.badge_unseen_element.exists? - end - end -end - -Given(/^the alert badge value is "(.+)"$/) do |num| - on(ArticlePage) do |page| - page.refresh_until do - # `.text` doesn't work for invisible elements, and Selenium thinks the badge is invisible - page.alerts.badge_element.attribute('innerText') == num - end - end -end - -Given(/^the notice badge value is "(.+)"$/) do |num| - on(ArticlePage) do |page| - page.refresh_until do - page.notices.badge_element.attribute('innerText') == num - end - end -end - -Given(/^there are "(.+)" unread notifications in the notice popup$/) do |num| - on(ArticlePage) do |page| - page.notices.when_loaded - expect(page.notices.num_unread_notifications).to eq(num.to_i) - end -end - -Given(/^there are "(.+)" unread notifications in the alert popup$/) do |num| - on(ArticlePage) do |page| - page.alerts.when_loaded - expect(page.alerts.num_unread_notifications).to eq(num.to_i) - end -end diff --git a/Echo/tests/browser/features/step_definition/popup_steps.rb b/Echo/tests/browser/features/step_definition/popup_steps.rb deleted file mode 100644 index e6c8f0f0..00000000 --- a/Echo/tests/browser/features/step_definition/popup_steps.rb +++ /dev/null @@ -1,11 +0,0 @@ -Given(/^I see the alert popup$/) do - on(ArticlePage) do |page| - expect(page.alerts.title_element.when_present.text).to match('Alerts') - end -end - -Given(/^I see the message popup$/) do - on(ArticlePage) do |page| - expect(page.messages.title_element.when_present.text).to match('Messages') - end -end diff --git a/Echo/tests/browser/features/support/components/notifications.rb b/Echo/tests/browser/features/support/components/notifications.rb deleted file mode 100644 index 6f8d5ab8..00000000 --- a/Echo/tests/browser/features/support/components/notifications.rb +++ /dev/null @@ -1,21 +0,0 @@ -class Notifications - include PageObject - - link(:badge, css: '.mw-echo-notifications-badge') - link(:badge_unseen, css: '.mw-echo-unseen-notifications') - link(:mark_all_as_read, css: '.mw-echo-ui-notificationsListWidget-markAllReadButton > a') - div(:popup, css: '.mw-echo-ui-notificationBadgeButtonPopupWidget-popup') - span(:title, css: '.oo-ui-popupWidget-head > .oo-ui-labelElement-label') - div( - :notifications_container, - css: '.mw-echo-ui-notificationsListWidget > .mw-echo-ui-notificationItemWidget') - - def when_loaded - title_element.when_present - notifications_container_element.when_present - end - - def num_unread_notifications - div_elements(css: '.mw-echo-ui-notificationItemWidget-unread').size - end -end diff --git a/Echo/tests/browser/features/support/data_manager.rb b/Echo/tests/browser/features/support/data_manager.rb deleted file mode 100644 index 0ff6d66c..00000000 --- a/Echo/tests/browser/features/support/data_manager.rb +++ /dev/null @@ -1,11 +0,0 @@ -# Data manager for Echo tests -class DataManager - def initialize - @data = {} - end - - def get(part) - @data[part] = "#{part}_#{Random.srand}" unless @data.key? part - @data[part] - end -end diff --git a/Echo/tests/browser/features/support/echo_api_helper.rb b/Echo/tests/browser/features/support/echo_api_helper.rb deleted file mode 100644 index 77b7e5ab..00000000 --- a/Echo/tests/browser/features/support/echo_api_helper.rb +++ /dev/null @@ -1,25 +0,0 @@ -module EchoAPIHelper - def create_page_with_user(title, text, username) - as_user(username) do - api.create_page title, text - end - end - - def clear_unread_notifications(username) - as_user(username) do - api.action('echomarkread', token_type: 'csrf', all: '1') - end - end - - def update_seentime(username, notificationType) - as_user(username) do - api.action('echomarkseen', token_type: 'csrf', type: notificationType) - end - end - - def watch_page(username, pageTitle) - as_user(username) do - api.action('watch', token_type: 'watch', title: pageTitle) - end - end -end diff --git a/Echo/tests/browser/features/support/echo_pageobject_extension.rb b/Echo/tests/browser/features/support/echo_pageobject_extension.rb deleted file mode 100644 index 8e18a6e6..00000000 --- a/Echo/tests/browser/features/support/echo_pageobject_extension.rb +++ /dev/null @@ -1,9 +0,0 @@ -module PageObject - def refresh_until(timeout = PageObject.default_page_wait, message = nil) - platform.wait_until(timeout, message) do - yield.tap do |result| - refresh unless result - end - end - end -end diff --git a/Echo/tests/browser/features/support/env.rb b/Echo/tests/browser/features/support/env.rb deleted file mode 100644 index d7dbf3e0..00000000 --- a/Echo/tests/browser/features/support/env.rb +++ /dev/null @@ -1,10 +0,0 @@ -require 'mediawiki_selenium/cucumber' -require 'mediawiki_selenium/pages' -require 'mediawiki_selenium/step_definitions' - -def env_or_default(key, default) - ENV[key].nil? ? default : ENV[key].to_i -end - -PageObject.default_page_wait = env_or_default 'PAGE_WAIT_TIMEOUT', 60 -PageObject.default_element_wait = env_or_default 'ELEMENT_WAIT_TIMEOUT', 60 diff --git a/Echo/tests/browser/features/support/hooks.rb b/Echo/tests/browser/features/support/hooks.rb deleted file mode 100644 index 0d84341d..00000000 --- a/Echo/tests/browser/features/support/hooks.rb +++ /dev/null @@ -1,10 +0,0 @@ -# Allow running of bundle exec cucumber --dry-run -f stepdefs -require 'mediawiki_selenium' -require 'page-object' -require_relative 'echo_api_helper' -require_relative 'echo_pageobject_extension' -require_relative 'data_manager' - -World(EchoAPIHelper) - -Before { @data_manager = DataManager.new } diff --git a/Echo/tests/browser/features/support/pages/article_page.rb b/Echo/tests/browser/features/support/pages/article_page.rb deleted file mode 100644 index 25ffa043..00000000 --- a/Echo/tests/browser/features/support/pages/article_page.rb +++ /dev/null @@ -1,8 +0,0 @@ -class ArticlePage - include PageObject - - li(:alerts, css: '#pt-notifications-alert') - li(:notices, css: '#pt-notifications-notice') - page_section(:alerts, Notifications, css: '#pt-notifications-alert') - page_section(:notices, Notifications, css: '#pt-notifications-notice') -end diff --git a/Echo/tests/browser/features/support/pages/special_notifications_page.rb b/Echo/tests/browser/features/support/pages/special_notifications_page.rb deleted file mode 100644 index 3f6f0c25..00000000 --- a/Echo/tests/browser/features/support/pages/special_notifications_page.rb +++ /dev/null @@ -1,8 +0,0 @@ -# Special:Notifications page -class SpecialNotificationsPage - include PageObject - - page_url 'Special:Notifications' - - h1(:firstHeading, css: '.firstHeading') -end |