Add login error browser test
authorTyler Cipriani <tcipriani@wikimedia.org>
Mon, 25 May 2015 10:00:33 +0000 (03:00 -0700)
committerTyler Cipriani <tcipriani@wikimedia.org>
Wed, 27 May 2015 15:51:59 +0000 (08:51 -0700)
Change-Id: I19a7f708825d5f11859d8ea70db4cdde752df26c

tests/browser/features/create_account.feature
tests/browser/features/step_definitions/create_account_steps.rb
tests/browser/features/support/pages/create_account_page.rb

index 0b4e83a..35df8b4 100644 (file)
@@ -10,3 +10,8 @@ Feature: Create account
     | Special:CreateAccount         |
     | Special:UserLogin/signup      |
     | Special:UserLogin?type=signup |
+
+  Scenario: If no username is entered then an error is displayed
+    Given I go to Create account page at Special:CreateAccount
+    When I submit the form
+    Then an error message is displayed
index 03bff66..3d312f7 100644 (file)
@@ -16,3 +16,11 @@ end
 Then(/^form has Create account button$/) do
   expect(on(CreateAccountPage).create_account_element).to exist
 end
+
+When(/^I submit the form$/) do
+  on(CreateAccountPage).create_account
+end
+
+Then(/^an error message is displayed$/) do
+  expect(on(CreateAccountPage).error_message_element.class_name).to eq "errorbox"
+end
index 98b893a..9aa00cd 100644 (file)
@@ -15,4 +15,5 @@ class CreateAccountPage
   page_url '<%=params[:page_title]%>'
 
   button(:create_account, id: 'wpCreateaccount')
+  div(:error_message, id: 'mw-createacct-status-area')
 end