From b79c109c9231108c6835765b0390b030fd8f0084 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= <fpeters@entrouvert.com>
Date: Sun, 29 Mar 2020 11:29:27 +0200
Subject: [PATCH] misc: remove obsolete robot framework tests (#41136)

---
 tests/robot/BaseSettings.txt            |  52 ----------
 tests/robot/WcsRobotFrameworkLibrary.py | 127 ------------------------
 tests/robot/fields/Date.txt             |  94 ------------------
 3 files changed, 273 deletions(-)
 delete mode 100644 tests/robot/BaseSettings.txt
 delete mode 100644 tests/robot/WcsRobotFrameworkLibrary.py
 delete mode 100644 tests/robot/fields/Date.txt

diff --git a/tests/robot/BaseSettings.txt b/tests/robot/BaseSettings.txt
deleted file mode 100644
index b881da54b..000000000
--- a/tests/robot/BaseSettings.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-*** Settings ***
-Library         Selenium2 Library
-Library         Wcs Robot Framework Library
-Suite Setup     Start WCS Server  True
-Test Teardown   Close All Browsers
-
-*** Keywords ***
-Given a logged in admin
-  Click Link  Login
-  Input Text  username  admin
-  Input Text  password  admin
-  Click Button  Log in
-
-
-*** Testcases ***
-Configure Language
-  Open Browser  http://localhost:10003/admin  ff
-  Click Link  Settings
-  Click Link  Language
-  Select From List  qx=Language  English
-  Submit Form
-
-Configure Debug
-  Open Browser  http://localhost:10003/admin  ff
-  Click Link  Settings
-  Click Link  Debug Options
-  Select From List  qx=Display Exceptions  Display as Text
-  Submit Form
-
-Configure Authentication
-  Open Browser  http://localhost:10003/admin  ff
-  Click Link  Settings
-  Click Link  Identification
-  Select Checkbox  qx=Simple local username / password
-  Submit Form
-  Click Link  Users
-  Click Link  New User
-  Input Text  qx=Name  Admin
-  Input Text  qx=Email  admin@localhost
-  Select Checkbox  qx=Administrator Account
-  Input Text  qx=Username  admin
-  Input Text  qx=Password  admin
-  Submit Form
-
-Configure Roles
-  Open Browser  http://localhost:10003/admin  ff
-  Given a logged in admin
-  Click Link  Roles
-  Click Link  New Role
-  Input Text  qx=Role Name  First Role
-  Click Button  Submit
-
diff --git a/tests/robot/WcsRobotFrameworkLibrary.py b/tests/robot/WcsRobotFrameworkLibrary.py
deleted file mode 100644
index d9649b74b..000000000
--- a/tests/robot/WcsRobotFrameworkLibrary.py
+++ /dev/null
@@ -1,127 +0,0 @@
-# w.c.s. - web application for online forms
-# Copyright (C) 2005-2013  Entr'ouvert
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-
-import os
-import time
-import urllib2
-import subprocess
-import shutil
-import signal
-import sys
-
-WCS_SRCDIR = '../../'
-WCSCTL = '../../wcsctl.py'
-WCS_DATA_DIR = os.path.abspath('../../data')
-
-from robot.libraries.BuiltIn import BuiltIn
-
-from Selenium2Library.locators import ElementFinder as BaseElementFinder
-from Selenium2Library import utils
-
-
-class ElementFinder(BaseElementFinder):
-    def __init__(self):
-        BaseElementFinder.__init__(self)
-        self._strategies['qx'] = self._find_by_qx_field
-
-    def _find_by_qx_field(self, browser, criteria, tag, constraints):
-        xpath_value = utils.escape_xpath_value(criteria)
-        criterias = [
-                "//div[div[@class='title'][text()=%s]]/div[@class='content']/input" % xpath_value,
-                "//div[div[@class='title'][text()=%s]]/div[@class='content']/select" % xpath_value,
-                "//div[div[@class='title'][text()=%s]]/div[@class='content']/textarea" % xpath_value,
-                "//div/div[@class='content']//label[text()=%s]/input[@type='checkbox']" % xpath_value]
-        for criteria in criterias:
-            if browser.find_elements_by_xpath(criteria):
-                return self._find_by_xpath(browser, criteria, tag, constraints)
-        return []
-
-
-class WcsRobotFrameworkLibrary:
-    def __init__(self, port=10003):
-        self.port = port
-        try:
-            seleniumlib = BuiltIn().get_library_instance('Selenium2Library')
-        except RuntimeError:
-            # the selenium library has not yet been loaded, monkeypatch it from
-            # the outside
-            import Selenium2Library.locators.elementfinder
-            import Selenium2Library.keywords._element
-            Selenium2Library.locators.elementfinder.ElementFinder = ElementFinder
-            Selenium2Library.keywords._element.ElementFinder = ElementFinder
-        else:
-            # the selenium library is already loaded, and the ElementFinder
-            # will therefore already have been instantiated, replace it.
-            seleniumlib._element_finder = ElementFinder()
-
-    def _waitforport(self, start):
-        while True:
-            if time.time() - start > 90:
-                raise Exception('Servers did not start in 90 seconds!!')
-            time.sleep(1)
-            try:
-                urllib2.urlopen('http://localhost:%s' % self.port)
-            except urllib2.URLError:
-                continue
-            else:
-                break
-
-    def start_wcs_server(self, reset=True):
-        if reset == 'False': reset = False
-        if reset and os.path.exists('/tmp/.tests'):
-            self.stop_wcs_server()
-            shutil.rmtree('/tmp/.tests')
-        if not os.path.exists('/tmp/.tests'):
-            os.mkdir('/tmp/.tests')
-
-        if not reset:
-            try:
-                urllib2.urlopen('http://localhost:%s' % self.port)
-            except urllib2.URLError:
-                pass
-            else:
-                return
-
-        wcs_command = [WCSCTL, 'start',
-                '--app-dir', '/tmp/.tests/',
-                '--data-dir', WCS_DATA_DIR,
-                '--port', str(self.port), '--http', '--silent']
-        sp = subprocess.Popen(wcs_command)
-        fd = open('/tmp/.tests/pid', 'w')
-        fd.write(str(sp.pid))
-        fd.close()
-
-        # Wait for the daemons to load themselves
-        starttime = time.time()
-        self._waitforport(starttime)
-
-    def stop_wcs_server(self):
-        if not os.path.exists('/tmp/.tests/pid'):
-            return
-        fd = open('/tmp/.tests/pid')
-        pid = int(fd.read())
-        fd.close()
-        try:
-            # valgrind seems to prefer SIGINT to SIGTERM
-            os.kill(pid, signal.SIGINT)
-        except OSError, e:
-            print >> sys.stderr, 'failed to kill pid %s (%s)' % (pid, e)
-
-    def reset_formdefs(self):
-        if os.path.exists('/tmp/.tests/localhost/formdefs'):
-            shutil.rmtree('/tmp/.tests/localhost/formdefs')
-        if os.path.exists('/tmp/.tests/localhost/formdefs-url_name'):
-            shutil.rmtree('/tmp/.tests/localhost/formdefs-url_name')
diff --git a/tests/robot/fields/Date.txt b/tests/robot/fields/Date.txt
deleted file mode 100644
index 198008439..000000000
--- a/tests/robot/fields/Date.txt
+++ /dev/null
@@ -1,94 +0,0 @@
-*** Settings ***
-Library         Selenium2 Library
-Library         Wcs Robot Framework Library
-Test Setup      Setup Test
-Suite Setup     Start WCS Server  False
-Test Teardown   Close All Browsers
-
-*** Keywords ***
-Setup Test
-  Open Browser  http://localhost:10003/  ff
-  #Maximize Browser Window
-
-Given a logged in admin
-  Click Link  Login
-  Input Text  qx=Username  admin
-  Input Text  qx=Password  admin
-  Click Button  Log in
-
-*** Testcases ***
-Create Form With a Date Field
-  Reset Formdefs
-  Given a logged in admin
-  Click Link  Back Office
-  Click Link  admin
-  Click Link  Forms
-  Click Link  New Form
-  Input Text  qx=Form Title  Form with a date field
-  Click Button  Submit
-  Input Text  qx=Label  Date
-  Select From List  qx=Type  Date
-  Click Button  Add
-  Click Link  Enable
-
-Correct Date
-  Click Link  Form with a date field
-  Input Text  qx=Date  2009-10-13
-  Click Button  Next
-  Page Should Contain  Check values then click submit.
-
-Incorrect Date
-  Click Link  Form with a date field
-  Input Text  qx=Date  hello world
-  Click Button  Next
-  Page Should Not Contain  Check values then click submit.
-
-Set Minimum Date
-  Given a logged in admin
-  Click Link  Back Office
-  Click Link  admin
-  Click Link  Forms
-  Click Link  Form with a date field
-  Click Link  edit
-  Mouse Over  css=#itemId_1
-  Click Link  css=#itemId_1 .commands .edit a
-  Input Text  qx=Minimum Date  2009-10-13
-  Click Button  Submit
-
-Correct Date with minimum check
-  Click Link  Form with a date field
-  Input Text  qx=Date  2009-10-15
-  Click Button  Next
-  Page Should Contain  Check values then click submit.
-
-Incorrect Date with minimum check
-  Click Link  Form with a date field
-  Input Text  qx=Date  2009-08-03
-  Click Button  Next
-  Page Should Not Contain  Check values then click submit.
-
-Set Maximum Date
-  Given a logged in admin
-  Click Link  Back Office
-  Click Link  admin
-  Click Link  Forms
-  Click Link  Form with a date field
-  Click Link  edit
-  Mouse Over  css=#itemId_1
-  Click Link  css=#itemId_1 .commands .edit a
-  Input Text  qx=Minimum Date  ${EMPTY}
-  Input Text  qx=Maximum Date  2009-10-13
-  Click Button  Submit
-
-Correct Date with maximum check
-  Click Link  Form with a date field
-  Input Text  qx=Date  2009-08-03
-  Click Button  Next
-  Page Should Contain  Check values then click submit.
-
-Incorrect Date with maximum check
-  Click Link  Form with a date field
-  Input Text  qx=Date  2009-10-15
-  Click Button  Next
-  Page Should Not Contain  Check values then click submit.
-
-- 
2.26.0

