Porting file test from browsertests
authorCmcmahon <cmcmahon@wikimedia.org>
Mon, 30 Jun 2014 19:13:41 +0000 (12:13 -0700)
committerCmcmahon <cmcmahon@wikimedia.org>
Mon, 30 Jun 2014 19:14:24 +0000 (12:14 -0700)
Testing in bare wiki, beta enwiki and hewiki

Change-Id: If8262a7798c19dad84f9ceb88a5e286a90cf2a39

tests/browser/features/file.feature [new file with mode: 0644]
tests/browser/features/step_definitions/file_steps.rb [new file with mode: 0644]
tests/browser/features/support/pages/file_does_not_exist_page.rb [new file with mode: 0644]

diff --git a/tests/browser/features/file.feature b/tests/browser/features/file.feature
new file mode 100644 (file)
index 0000000..2d3b708
--- /dev/null
@@ -0,0 +1,23 @@
+#
+# This file is subject to the license terms in the LICENSE file found in the
+# qa-browsertests top-level directory and at
+# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/LICENSE. No part of
+# qa-browsertests, including this file, may be copied, modified, propagated, or
+# distributed except according to the terms contained in the LICENSE file.
+#
+# Copyright 2012-2014 by the Mediawiki developers. See the CREDITS file in the
+# qa-browsertests top-level directory and at
+# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/CREDITS
+#
+@chrome @en.wikipedia.beta.wmflabs.org @firefox @internet_explorer_6 @internet_explorer_7 @internet_explorer_8 @internet_explorer_9 @internet_explorer_10 @phantomjs @test2.wikipedia.org
+Feature: File
+
+ Scenario: Anonymous goes to file that does not exist
+   Given I am at file that does not exist
+   Then page should show that no such file exists
+
+ @login
+ Scenario: Logged-in user goes to file that does not exist
+   Given I am logged in
+     And I am at file that does not exist
+   Then page should show that no such file exists
\ No newline at end of file
diff --git a/tests/browser/features/step_definitions/file_steps.rb b/tests/browser/features/step_definitions/file_steps.rb
new file mode 100644 (file)
index 0000000..a2ed1bf
--- /dev/null
@@ -0,0 +1,18 @@
+#
+# This file is subject to the license terms in the LICENSE file found in the
+# qa-browsertests top-level directory and at
+# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/LICENSE. No part of
+# qa-browsertests, including this file, may be copied, modified, propagated, or
+# distributed except according to the terms contained in the LICENSE file.
+#
+# Copyright 2012-2014 by the Mediawiki developers. See the CREDITS file in the
+# qa-browsertests top-level directory and at
+# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/CREDITS
+#
+Given(/^I am at file that does not exist$/) do
+  visit(FileDoesNotExistPage, using_params: {page_name: @random_string})
+end
+
+Then(/^page should show that no such file exists$/) do
+  on(FileDoesNotExistPage).file_does_not_exist_message_element.should be_visible
+end
diff --git a/tests/browser/features/support/pages/file_does_not_exist_page.rb b/tests/browser/features/support/pages/file_does_not_exist_page.rb
new file mode 100644 (file)
index 0000000..c8491f3
--- /dev/null
@@ -0,0 +1,19 @@
+#
+# This file is subject to the license terms in the LICENSE file found in the
+# qa-browsertests top-level directory and at
+# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/LICENSE. No part of
+# qa-browsertests, including this file, may be copied, modified, propagated, or
+# distributed except according to the terms contained in the LICENSE file.
+#
+# Copyright 2012-2014 by the Mediawiki developers. See the CREDITS file in the
+# qa-browsertests top-level directory and at
+# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/CREDITS
+#
+class FileDoesNotExistPage
+  include PageObject
+
+  include URL
+  page_url URL.url("File:<%=params[:page_name]%>")
+
+  div(:file_does_not_exist_message, id: "mw-imagepage-nofile")
+end