From 0d30940db6fd3d48bdb3fa26ecf8c980e73b0d50 Mon Sep 17 00:00:00 2001 From: Cmcmahon Date: Mon, 30 Jun 2014 12:13:41 -0700 Subject: [PATCH] Porting file test from browsertests Testing in bare wiki, beta enwiki and hewiki Change-Id: If8262a7798c19dad84f9ceb88a5e286a90cf2a39 --- tests/browser/features/file.feature | 23 +++++++++++++++++++ .../features/step_definitions/file_steps.rb | 18 +++++++++++++++ .../support/pages/file_does_not_exist_page.rb | 19 +++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 tests/browser/features/file.feature create mode 100644 tests/browser/features/step_definitions/file_steps.rb create mode 100644 tests/browser/features/support/pages/file_does_not_exist_page.rb diff --git a/tests/browser/features/file.feature b/tests/browser/features/file.feature new file mode 100644 index 0000000000..2d3b70858f --- /dev/null +++ b/tests/browser/features/file.feature @@ -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 index 0000000000..a2ed1bfc98 --- /dev/null +++ b/tests/browser/features/step_definitions/file_steps.rb @@ -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 index 0000000000..c8491f3b82 --- /dev/null +++ b/tests/browser/features/support/pages/file_does_not_exist_page.rb @@ -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 -- 2.20.1