Zfilipin has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/287643

Change subject: Merge environments.yml and config.yml in WikidataBrowserTests
......................................................................

Merge environments.yml and config.yml in WikidataBrowserTests

Paths are tests/browser/environments.yml and tests/browser/config/config.yml

- Do not ignore config.yml
- Replace WIKIDATA_REPO_URL with mediawiki_url
- Replace WB_REPO_USERNAME with mediawiki_user
- Temporarily add pry to Gemfile to make debugging easier
- Replace WB_REPO_PASSWORD with mediawiki_password
- Delete unused @repo_login Cucumber tag
- Run local tests using Chrome. It does not steal focus, like Firefox. Bad 
Firefox. :|
- Replace ITEM_NAMESPACE with item_namespace

Bug: T128097
Change-Id: I378d15abf46c9a1fca736ffece4cd14f1ec1c294
---
M .gitignore
M Gemfile
M Gemfile.lock
A tests/browser/config/config.yml
M tests/browser/config/config.yml.sample
M tests/browser/config/config_ci.yml
M tests/browser/environments.yml
M tests/browser/features/reference.feature
M tests/browser/features/statement.feature
M tests/browser/features/statements_geo.feature
M tests/browser/features/statements_item.feature
M tests/browser/features/statements_monolingual.feature
M tests/browser/features/statements_quantity.feature
M tests/browser/features/statements_string.feature
M tests/browser/features/statements_time.feature
M tests/browser/features/statements_url.feature
M tests/browser/features/step_definitions/entity_steps.rb
M tests/browser/features/step_definitions/non_existing_item_steps.rb
M tests/browser/features/step_definitions/statement_steps.rb
M tests/browser/features/support/env.rb
M tests/browser/features/support/modules/entity_module.rb
M tests/browser/features/support/modules/url_module.rb
M tests/browser/features/support/pages/item_page.rb
M tests/browser/features/support/pages/non_existing_item_page.rb
M tests/browser/features/support/pages/property_page.rb
25 files changed, 72 insertions(+), 60 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikidata/browsertests 
refs/changes/43/287643/1

diff --git a/.gitignore b/.gitignore
index fdb5a7b..deeb73b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,5 @@
 .idea/
 
 .bundle/*
-tests/browser/config/config.yml
 
 .DS_Store
diff --git a/Gemfile b/Gemfile
index 27b5a13..2f4a0e1 100644
--- a/Gemfile
+++ b/Gemfile
@@ -7,5 +7,6 @@
 gem 'mediawiki_api-wikidata', '~> 0.2.0'
 gem 'mediawiki_selenium', '~> 1.6.5'
 gem 'parallel_tests'
+gem 'pry'
 gem 'require_all'
 gem 'rubocop', require: false
diff --git a/Gemfile.lock b/Gemfile.lock
index 8d98a6a..10858e3 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -13,6 +13,7 @@
     builder (3.2.2)
     childprocess (0.5.9)
       ffi (~> 1.0, >= 1.0.11)
+    coderay (1.1.0)
     cucumber (1.3.20)
       builder (>= 2.1.2)
       diff-lcs (>= 1.1.3)
@@ -56,6 +57,7 @@
       rspec-expectations (~> 2.14, >= 2.14.4)
       syntax (~> 1.2, >= 1.2.0)
       thor (~> 0.19, >= 0.19.1)
+    method_source (0.8.2)
     mime-types (2.99)
     minitest (5.8.2)
     multi_json (1.11.2)
@@ -74,6 +76,10 @@
     parser (2.2.3.0)
       ast (>= 1.1, < 3.0)
     powerpack (0.1.1)
+    pry (0.10.1)
+      coderay (~> 1.1.0)
+      method_source (~> 0.8.1)
+      slop (~> 3.4)
     rainbow (2.0.0)
     require_all (1.3.3)
     rest-client (1.8.0)
@@ -96,6 +102,7 @@
       multi_json (~> 1.0)
       rubyzip (~> 1.0)
       websocket (~> 1.0)
+    slop (3.6.0)
     syntax (1.2.0)
     thor (0.19.1)
     thread_safe (0.3.5)
@@ -119,6 +126,7 @@
   mediawiki_api-wikidata (~> 0.2.0)
   mediawiki_selenium (~> 1.6.5)
   parallel_tests
+  pry
   require_all
   rubocop
 
diff --git a/tests/browser/config/config.yml b/tests/browser/config/config.yml
new file mode 100644
index 0000000..cdb4cae
--- /dev/null
+++ b/tests/browser/config/config.yml
@@ -0,0 +1,10 @@
+WIKIDATA_REPO_API: "http://wikidata.wiki.local.wmftest.net:8080/w/api.php";
+
+# the namespace of the data items (e.g. "Data:" or "" for main namespace)
+PROPERTY_NAMESPACE: "Property:"
+ITEM_ID_PREFIX: "Q"
+PROPERTY_ID_PREFIX: "P"
+LANGUAGE_CODE: "en"
+
+# local browser configuration
+BROWSER: "chrome"
diff --git a/tests/browser/config/config.yml.sample 
b/tests/browser/config/config.yml.sample
index 4fce284..10633ce 100644
--- a/tests/browser/config/config.yml.sample
+++ b/tests/browser/config/config.yml.sample
@@ -5,19 +5,12 @@
 # The environment variable will then be used instead of the values in here.
 
 # beta instance configuration
-WIKIDATA_REPO_URL: "http://wikidata.beta.wmflabs.org/wiki/";
 WIKIDATA_REPO_API: "http://wikidata.beta.wmflabs.org/w/api.php";
-WB_REPO_USERNAME: "WikidataUser"
-WB_REPO_PASSWORD: "WikidataPassword"
 
 # local configuration
 #WIKIDATA_REPO_API: "http://localhost/mediawiki/api.php/";
-#WIKIDATA_REPO_URL: "http://localhost/mediawiki/index.php/";
-#WB_REPO_USERNAME: "LocalUser"
-#WB_REPO_PASSWORD: "LocalPassword"
 
 # the namespace of the data items (e.g. "Data:" or "" for main namespace)
-ITEM_NAMESPACE: ""
 PROPERTY_NAMESPACE: "Property:"
 ITEM_ID_PREFIX: "Q"
 PROPERTY_ID_PREFIX: "P"
diff --git a/tests/browser/config/config_ci.yml 
b/tests/browser/config/config_ci.yml
index 61c14d3..f1a4a78 100644
--- a/tests/browser/config/config_ci.yml
+++ b/tests/browser/config/config_ci.yml
@@ -1,7 +1,4 @@
-WIKIDATA_REPO_URL: "http://wikidata.beta.wmflabs.org/wiki/";
 WIKIDATA_REPO_API: "http://wikidata.beta.wmflabs.org/w/api.php";
-WB_REPO_USERNAME: "WikidataTester"
-ITEM_NAMESPACE: ""
 PROPERTY_NAMESPACE: "Property:"
 ITEM_ID_PREFIX: "Q"
 PROPERTY_ID_PREFIX: "P"
diff --git a/tests/browser/environments.yml b/tests/browser/environments.yml
index b2232e6..32851ff 100644
--- a/tests/browser/environments.yml
+++ b/tests/browser/environments.yml
@@ -15,21 +15,25 @@
 #   bundle exec cucumber
 #
 mw-vagrant-host: &default
-  mediawiki_url: http://127.0.0.1:8080/wiki/
-  mediawiki_user: Selenium_user
+  item_namespace: ''
+  mediawiki_url: http://wikidata.wiki.local.wmftest.net:8080/wiki/
+  mediawiki_user: Admin
   mediawiki_password: vagrant
 
 mw-vagrant-guest:
+  item_namespace: ''
   mediawiki_url: http://127.0.0.1/wiki/
-  mediawiki_user: Selenium_user
+  mediawiki_user: Admin
   mediawiki_password: vagrant
 
 beta:
-  mediawiki_url: http://en.wikipedia.beta.wmflabs.org/wiki/
-  mediawiki_user: Selenium_user
+  item_namespace: ''
+  mediawiki_url: http://wikidata.beta.wmflabs.org/wiki/
+  mediawiki_user: WikidataTester
   # mediawiki_password: SET THIS IN THE ENVIRONMENT!
 
 test2:
+  item_namespace: ''
   mediawiki_url: http://test2.wikipedia.org/wiki/
   mediawiki_user: Selenium_user
   # mediawiki_password: SET THIS IN THE ENVIRONMENT!
diff --git a/tests/browser/features/reference.feature 
b/tests/browser/features/reference.feature
index 2d2e22d..a67e562 100644
--- a/tests/browser/features/reference.feature
+++ b/tests/browser/features/reference.feature
@@ -96,7 +96,7 @@
       And Snak entity selector input element should be there
       And Snak value input element should be there
 
-  @modify_entity @repo_login
+  @modify_entity
   Scenario Outline: Add reference with one snak
     When I click the statement edit button
       And I click the reference add button
@@ -118,7 +118,7 @@
     | click the statement save button |
     | press the RETURN key in the snak value input field |
 
-  @modify_entity @repo_login
+  @modify_entity
   Scenario: Add reference with multiple snaks
     Given I have the following properties with datatype:
         | stringprop1 | string |
@@ -147,7 +147,7 @@
       And Value of snak 3 of reference 1 should be test3
       And Reference counter should show 1
 
-  @modify_entity @repo_login
+  @modify_entity
   Scenario: Check UI elements when editing reference
     Given I have the following properties with datatype:
         | stringprop | string |
@@ -163,7 +163,7 @@
       And Snak entity selector input element should not be there
       And Snak value input element should be there
 
-  @modify_entity @repo_login
+  @modify_entity
   Scenario: Edit reference with one snak
     Given I have the following properties with datatype:
         | stringprop | string |
@@ -183,7 +183,7 @@
       And Value of snak 1 of reference 1 should be modified
       And Reference counter should show 1
 
-  @modify_entity @repo_login
+  @modify_entity
   Scenario: Remove complete reference
     Given I have the following properties with datatype:
         | stringprop | string |
@@ -201,7 +201,7 @@
       And Property of snak 1 of reference 1 should not be there
       And Value of snak 1 of reference 1 should not be there
 
-  @modify_entity @repo_login
+  @modify_entity
   Scenario: Remove reference snak
     Given I have the following properties with datatype:
         | stringprop1 | string |
diff --git a/tests/browser/features/statement.feature 
b/tests/browser/features/statement.feature
index 424f13d..96f571e 100644
--- a/tests/browser/features/statement.feature
+++ b/tests/browser/features/statement.feature
@@ -52,7 +52,7 @@
     | click the statement cancel button |
     | press the ESC key in the claim entity selector input field |
 
-  @repo_login @ui_only
+  @ui_only
   Scenario: Select a property
     Given I have the following properties with datatype:
       | stringprop | string |
@@ -66,7 +66,7 @@
       And Rank selector for claim 1 in group 1 should be there
       And Snaktype selector for claim 1 in group 1 should be there
 
-  @repo_login @smoke @ui_only
+  @smoke @ui_only
   Scenario: Select a property and enter a statement value
     Given I have the following properties with datatype:
       | stringprop | string |
@@ -81,7 +81,7 @@
       And Rank selector for claim 1 in group 1 should be there
       And Snaktype selector for claim 1 in group 1 should be there
 
-  @repo_login @ui_only
+  @ui_only
   Scenario Outline: Cancel statement after selecting a property
     Given I have the following properties with datatype:
       | stringprop | string |
@@ -102,7 +102,7 @@
     | click the statement cancel button |
     | press the ESC key in the claim value input field |
 
-  @repo_login @ui_only
+  @ui_only
   Scenario: Select a property, enter a statement value and clear the property
     Given I have the following properties with datatype:
       | stringprop | string |
diff --git a/tests/browser/features/statements_geo.feature 
b/tests/browser/features/statements_geo.feature
index f08fac0..be5d1f4 100644
--- a/tests/browser/features/statements_geo.feature
+++ b/tests/browser/features/statements_geo.feature
@@ -68,7 +68,7 @@
     | 42.1538, 8.5731 | 42°9'13.7"N, 8°34'23.2"E | ±0.0001° |
     | 42° 09.231' N 008° 34.386' E | 42°9'13.86"N, 8°34'23.16"E | to 1/100 of 
an arcsecond |
 
-  @repo_login @modify_entity
+  @modify_entity
   Scenario: Adding a statement of type geo
     Given I am logged in to the repo
       And I am on an item page
@@ -84,7 +84,7 @@
       And Statement edit button for claim 1 in group 1 should be there
 
 
-  @repo_login @modify_entity
+  @modify_entity
   Scenario: Adding a statement of type geo and reload page
     Given I am logged in to the repo
       And I am on an item page
diff --git a/tests/browser/features/statements_item.feature 
b/tests/browser/features/statements_item.feature
index 819516e..cb6e413 100644
--- a/tests/browser/features/statements_item.feature
+++ b/tests/browser/features/statements_item.feature
@@ -13,7 +13,7 @@
       And The copyright warning has been dismissed
       And Anonymous edit warnings are disabled
 
-  @modify_entity @repo_login
+  @modify_entity
   Scenario Outline: Adding a statement of type item
     Given I have the following properties with datatype:
       | itemprop | wikibase-item |
@@ -36,7 +36,7 @@
     | item  | save                            |
     | item1 | click the statement save button |
 
-  @ui_only @repo_login
+  @ui_only
   Scenario: Select a property, use entity selector
     Given I have the following properties with datatype:
       | itemprop | wikibase-item |
diff --git a/tests/browser/features/statements_monolingual.feature 
b/tests/browser/features/statements_monolingual.feature
index 0f27700..b8ce6a9 100644
--- a/tests/browser/features/statements_monolingual.feature
+++ b/tests/browser/features/statements_monolingual.feature
@@ -38,7 +38,7 @@
     Then Statement save button should be there
       And Statement cancel button should be there
 
-  @repo_login @modify_entity
+  @modify_entity
   Scenario Outline: Adding a statement of type monolingual
     Given I am logged in to the repo
       And I am on an item page
@@ -81,7 +81,7 @@
     | English |
     | German |
 
-  @repo_login @modify_entity
+  @modify_entity
   Scenario: Adding a statement of type monolingual and reload page
     Given I am logged in to the repo
       And I am on an item page
diff --git a/tests/browser/features/statements_quantity.feature 
b/tests/browser/features/statements_quantity.feature
index 8245d05..ce3a350 100644
--- a/tests/browser/features/statements_quantity.feature
+++ b/tests/browser/features/statements_quantity.feature
@@ -40,7 +40,7 @@
     | astring |
     | 1:1 |
 
-  @repo_login @modify_entity
+  @modify_entity
   Scenario: Quantity parser and saving should work properly
     Given I am logged in to the repo
       And I am on an item page
@@ -56,7 +56,7 @@
       And Statement cancel button should not be there
       And Statement edit button for claim 1 in group 1 should be there
 
-  @repo_login @modify_entity
+  @modify_entity
   Scenario: Adding a statement of type quantity and reload page
     Given I am logged in to the repo
       And I am on an item page
diff --git a/tests/browser/features/statements_string.feature 
b/tests/browser/features/statements_string.feature
index a871c17..20758f5 100644
--- a/tests/browser/features/statements_string.feature
+++ b/tests/browser/features/statements_string.feature
@@ -13,7 +13,7 @@
       And The copyright warning has been dismissed
       And Anonymous edit warnings are disabled
 
-  @repo_login @modify_entity
+  @modify_entity
   Scenario Outline: Adding a statement of type string
     Given I have the following properties with datatype:
       | stringprop | string |
@@ -35,7 +35,7 @@
     | it's a string                       | press the RETURN key in the claim 
value input field |
     | <script>$('body').empty();</script> | click the statement save button    
                     |
 
-  @modify_entity @repo_login
+  @modify_entity
   Scenario: Adding a statement of type string and reload page
     Given I have the following properties with datatype:
       | stringprop | string |
diff --git a/tests/browser/features/statements_time.feature 
b/tests/browser/features/statements_time.feature
index debcd3a..29068b2 100644
--- a/tests/browser/features/statements_time.feature
+++ b/tests/browser/features/statements_time.feature
@@ -76,7 +76,7 @@
     | 100000000 | 100 million years CE | Gregorian | hundred million years |
     | 1000000000 BCE | 1 billion years BCE | Julian | billion years |
 
-  @repo_login @modify_entity
+  @modify_entity
   Scenario Outline: Adding a statement of type time
     Given I am logged in to the repo
       And I am on an item page
@@ -96,7 +96,7 @@
     | click the statement save button |
     | press the RETURN key in the claim value input field |
 
-  @repo_login @modify_entity
+  @modify_entity
   Scenario: Adding a statement of type time and reload page
     Given I am logged in to the repo
       And I am on an item page
diff --git a/tests/browser/features/statements_url.feature 
b/tests/browser/features/statements_url.feature
index 49045f4..cb46f53 100644
--- a/tests/browser/features/statements_url.feature
+++ b/tests/browser/features/statements_url.feature
@@ -13,7 +13,6 @@
       | urlprop | url |
       And I am not logged in to the repo
 
-  @repo_login
   Scenario Outline: Check UI for invalid values
     Given I am on an item page
       And The copyright warning has been dismissed
@@ -31,7 +30,7 @@
     | this is no url |
     | missing.http.org |
 
-  @repo_login @modify_entity
+  @modify_entity
   Scenario Outline: Adding a statement of type url
     Given I am logged in to the repo
       And I am on an item page
@@ -53,7 +52,7 @@
     | press the RETURN key in the claim value input field |
     | click the statement save button |
 
-  @repo_login @modify_entity
+  @modify_entity
   Scenario Outline: Save a statement of type url and check the output
     Given I am logged in to the repo
     And I am on an item page
@@ -76,7 +75,7 @@
     | mailto:m...@example.com |
     | http://عربي.امارات/en/ |
 
-  @repo_login @modify_entity
+  @modify_entity
   Scenario: Save a statement of type url and check the link href
     Given I am logged in to the repo
       And I am on an item page
@@ -93,7 +92,7 @@
       And Statement link text of claim 1 in group 1 should be 
http://www.wikimedia.de
       And Statement link url of claim 1 in group 1 should be 
http://www.wikimedia.de/
 
-  @repo_login @modify_entity
+  @modify_entity
   Scenario: Adding a statement of type url and reload page
     Given I am logged in to the repo
       And I am on an item page
diff --git a/tests/browser/features/step_definitions/entity_steps.rb 
b/tests/browser/features/step_definitions/entity_steps.rb
index 4a2e769..ba80f21 100644
--- a/tests/browser/features/step_definitions/entity_steps.rb
+++ b/tests/browser/features/step_definitions/entity_steps.rb
@@ -7,7 +7,7 @@
 # basic steps for entities
 
 Given(/^I am logged in to the repo$/) do
-  visit(RepoLoginPage).login_with(ENV['WB_REPO_USERNAME'], 
ENV['WB_REPO_PASSWORD'])
+  visit(RepoLoginPage).login_with(user, password)
 end
 
 Given(/^I am not logged in to the repo$/) do
@@ -51,7 +51,7 @@
 end
 
 Given(/^I navigate to item (.*) with resource loader debug mode (.*)$/) do 
|item_id, debug_mode|
-  entity_url = URL.repo_url(ENV['ITEM_NAMESPACE'] + item_id) + '&debug=' + 
debug_mode
+  entity_url = URL.repo_url(lookup(:item_namespace, default: '') + item_id) + 
'&debug=' + debug_mode
   visit(ItemPage).navigate_to_entity entity_url
   @item_under_test = on(ItemPage).create_item_data_from_page
 end
@@ -99,7 +99,7 @@
 
 Given(/^The following sitelinks do not exist:$/) do |sitelinks|
   wb_api = MediawikiApi::Wikidata::WikidataClient.new URL.repo_api
-  wb_api.log_in(ENV['WB_REPO_USERNAME'], ENV['WB_REPO_PASSWORD'])
+  wb_api.log_in(user, password)
   sitelinks.raw.each do |sitelink|
     if wb_api.sitelink_exists?(sitelink[0], sitelink[1])
       wb_api.remove_sitelink({ site_id: sitelink[0], title: sitelink[1] }, 
sitelink[0])
diff --git a/tests/browser/features/step_definitions/non_existing_item_steps.rb 
b/tests/browser/features/step_definitions/non_existing_item_steps.rb
index c82d4fc..590f73b 100644
--- a/tests/browser/features/step_definitions/non_existing_item_steps.rb
+++ b/tests/browser/features/step_definitions/non_existing_item_steps.rb
@@ -12,6 +12,6 @@
 Then(/^check if this page behaves correctly$/) do
   on_page(NonExistingItemPage) do |page|
     expect(page.first_heading?).to be true
-    expect(page.first_heading_element.text).to be == ENV['ITEM_NAMESPACE'] + 
ENV['ITEM_ID_PREFIX'] + 'xy'
+    expect(page.first_heading_element.text).to be == lookup(:item_namespace, 
default: '') + ENV['ITEM_ID_PREFIX'] + 'xy'
   end
 end
diff --git a/tests/browser/features/step_definitions/statement_steps.rb 
b/tests/browser/features/step_definitions/statement_steps.rb
index 2ef8925..3b401f0 100644
--- a/tests/browser/features/step_definitions/statement_steps.rb
+++ b/tests/browser/features/step_definitions/statement_steps.rb
@@ -8,7 +8,7 @@
 
 When(/^I have statements with the following properties and values:$/) do 
|statements|
   wb_api = MediawikiApi::Wikidata::WikidataClient.new URL.repo_api
-  wb_api.log_in(ENV['WB_REPO_USERNAME'], ENV['WB_REPO_PASSWORD'])
+  wb_api.log_in(user, password)
   statements.raw.each do |statement|
     property_handle = statement[0]
     value = on(ItemPage).get_string_snak_value(statement[1])
diff --git a/tests/browser/features/support/env.rb 
b/tests/browser/features/support/env.rb
index 73c609e..99e734c 100644
--- a/tests/browser/features/support/env.rb
+++ b/tests/browser/features/support/env.rb
@@ -33,11 +33,6 @@
 require_all 'features/support/pages'
 require_all 'features/support/utils'
 
-Before('@repo_login') do
-  abort('WB_REPO_USERNAME environment variable is not defined! Please export a 
value for that variable before proceeding.') unless ENV['WB_REPO_USERNAME']
-  abort('WB_REPO_PASSWORD environment variable is not defined! Please export a 
value for that variable before proceeding.') unless ENV['WB_REPO_PASSWORD']
-end
-
 PageObject.default_element_wait = 10 # increased to avoid fails on jenkins
 
 unless (env_no = ENV['TEST_ENV_NUMBER'].to_i).zero?
diff --git a/tests/browser/features/support/modules/entity_module.rb 
b/tests/browser/features/support/modules/entity_module.rb
index d4581e8..cd49a13 100644
--- a/tests/browser/features/support/modules/entity_module.rb
+++ b/tests/browser/features/support/modules/entity_module.rb
@@ -61,7 +61,7 @@
 
   def create_item_data_from_page
     id = entity_id_span_element.text.gsub(/\(|\)/, '')
-    url = URL.repo_url(ENV['ITEM_NAMESPACE'] + id)
+    url = URL.repo_url(env.lookup(:item_namespace, default: '') + id)
     label_en = first_heading_element.text.gsub(/(.*)(\(#{id}\))(.*)/, '\1\3')
     description_en = entity_description_div_element.text
 
@@ -147,7 +147,8 @@
   # this method is really ugly and should be refactored
   def create_entity_and_properties(serialization)
     wb_api = MediawikiApi::Wikidata::WikidataClient.new URL.repo_api
-    wb_api.log_in(ENV['WB_REPO_USERNAME'], ENV['WB_REPO_PASSWORD'])
+    env = MediawikiSelenium::Environment.load_default
+    wb_api.log_in(env[:mediawiki_user], env[:mediawiki_password])
 
     serialization['properties'].each do |oldId, prop|
       if prop['description'] && prop['description']['en']['value']
diff --git a/tests/browser/features/support/modules/url_module.rb 
b/tests/browser/features/support/modules/url_module.rb
index bc0f379..794da4c 100644
--- a/tests/browser/features/support/modules/url_module.rb
+++ b/tests/browser/features/support/modules/url_module.rb
@@ -16,7 +16,8 @@
   end
 
   def self.repo_url(name)
-    url = ENV['WIKIDATA_REPO_URL']
+    env = MediawikiSelenium::Environment.load_default
+    url = env.lookup(:mediawiki_url)
     lang = ENV['LANGUAGE_CODE']
     "#{url}#{name}?setlang=#{lang}"
   end
diff --git a/tests/browser/features/support/pages/item_page.rb 
b/tests/browser/features/support/pages/item_page.rb
index e935b85..97a283f 100644
--- a/tests/browser/features/support/pages/item_page.rb
+++ b/tests/browser/features/support/pages/item_page.rb
@@ -26,7 +26,8 @@
 
   def create_item(data)
     wb_api = MediawikiApi::Wikidata::WikidataClient.new URL.repo_api
-    wb_api.log_in(ENV['WB_REPO_USERNAME'], ENV['WB_REPO_PASSWORD'])
+    env = MediawikiSelenium::Environment.load_default
+    wb_api.log_in(env[:mediawiki_user], env[:mediawiki_password])
     resp = wb_api.create_item(data)
 
     id = resp['entity']['id']
@@ -43,7 +44,7 @@
       description_en = ''
     end
 
-    url = URL.repo_url(ENV['ITEM_NAMESPACE'] + id)
+    url = URL.repo_url(env.lookup(:item_namespace, default: '') + id)
 
     { 'id' => id, 'url' => url, 'label' => label_en, 'description' => 
description_en }
   end
diff --git a/tests/browser/features/support/pages/non_existing_item_page.rb 
b/tests/browser/features/support/pages/non_existing_item_page.rb
index 0df749d..e62fa51 100644
--- a/tests/browser/features/support/pages/non_existing_item_page.rb
+++ b/tests/browser/features/support/pages/non_existing_item_page.rb
@@ -8,7 +8,9 @@
 
 class NonExistingItemPage
   include PageObject
-  page_url ENV['WIKIDATA_REPO_URL'] + ENV['ITEM_NAMESPACE'] + 
ENV['ITEM_ID_PREFIX'] + 'xy'
+
+  env = MediawikiSelenium::Environment.load_default
+  page_url '<%= env.lookup(:mediawiki_url) %><%= env.lookup(:item_namespace, 
default: "") %><%= env.lookup(:item_id_prefix) %>xy'
 
   h1(:first_heading, class: 'firstHeading')
   link(:special_log_link, css: '.noarticletext a:nth-child(1)')
diff --git a/tests/browser/features/support/pages/property_page.rb 
b/tests/browser/features/support/pages/property_page.rb
index 2e11428..d23ccb2 100644
--- a/tests/browser/features/support/pages/property_page.rb
+++ b/tests/browser/features/support/pages/property_page.rb
@@ -32,7 +32,8 @@
 
   def create_property(data)
     wb_api = MediawikiApi::Wikidata::WikidataClient.new URL.repo_api
-    wb_api.log_in(ENV['WB_REPO_USERNAME'], ENV['WB_REPO_PASSWORD'])
+    env = MediawikiSelenium::Environment.load_default
+    wb_api.log_in(env[:mediawiki_user], env[:mediawiki_password])
     resp = wb_api.create_property(data)
 
     id = resp['entity']['id']

-- 
To view, visit https://gerrit.wikimedia.org/r/287643
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I378d15abf46c9a1fca736ffece4cd14f1ec1c294
Gerrit-PatchSet: 1
Gerrit-Project: wikidata/browsertests
Gerrit-Branch: master
Gerrit-Owner: Zfilipin <zfili...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to