From 0f93115725781d5991723414ce170e47d845c10f Mon Sep 17 00:00:00 2001 From: jdlrobson Date: Mon, 31 Jul 2017 15:03:18 -0700 Subject: [PATCH] QA: Minor tweaks to how we check toast notifications A toast autohides within 5 seconds and its display properties are inherited from #mw-notification-area. This slight tweak waits for mw-notification-area to be visible before verifying toast and its contents Change-Id: I89beaf9d131155e958cc9aae84a9e30ffd8e9e4f --- .../browser/features/step_definitions/common_article_steps.rb | 4 +++- tests/browser/features/support/pages/article_page.rb | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/browser/features/step_definitions/common_article_steps.rb b/tests/browser/features/step_definitions/common_article_steps.rb index 0e89e9e..c16a05d 100644 --- a/tests/browser/features/step_definitions/common_article_steps.rb +++ b/tests/browser/features/step_definitions/common_article_steps.rb @@ -27,7 +27,9 @@ When(/^I click the watch star$/) do end Then(/^I should see a toast notification$/) do - expect(on(ArticlePage).toast_element.when_present(10)).to be_visible + # To avoid flakey tests check the notification area element first (T170890) + expect(on(ArticlePage).notification_area_element.when_visible).to be_visible + expect(on(ArticlePage).toast_element.when_visible).to be_visible end Then(/^I should see a toast with message "(.+)"$/) do |msg| diff --git a/tests/browser/features/support/pages/article_page.rb b/tests/browser/features/support/pages/article_page.rb index 064e9a7..2b733ae 100644 --- a/tests/browser/features/support/pages/article_page.rb +++ b/tests/browser/features/support/pages/article_page.rb @@ -144,6 +144,7 @@ class ArticlePage div(:spinner_loading, class: 'spinner loading') # toast + div(:notification_area, id: 'mw-notification-area') div(:toast, class: 'mw-notification') # loader