Systemvoraussetzungen (win32)

  1. geckodriver.exe
    https://github.com/mozilla/geckodriver/releases
    per Systempath allseits adressierbar (z.B. in C:\dev\geckodriver.exe)
  2. die beiden sitepackage-Libs aus der requirements.txt in das virtEnv per pip install ergänzen
    %C:\dev\ZMS3\Scripts> pip install selenium>3.3 --trusted-host pypi.python.org
    %C:\dev\ZMS3\Scripts> pip install pytest --trusted-host pypi.python.org

 

Konfiguration

$ZMS_HOME/selenium_tests/credentials.txt

[ac_server]
base_url=http://localhost:8080
login=admin
password=admin
firefox_path=C:\Users\<UserId>\AppData\Local\Mozilla Firefox\firefox.exe

Implementierung

$ZMS_HOME/selenium_tests/metaobj_manager_test.py

# encoding: utf-8

import unittest
import time
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.common.alert import Alert
from selenium.webdriver.support.ui import Select, WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
import example_test

# python -m unittest selenium_tests.metaobj_manager_test.MetaobjManagerTest
class MetaobjManagerTest(example_test.SeleniumTestCase):
  
      def test_conf(self):
        print '<MetaobjManagerTest.test_conf>'
        self._login()
        self._create_or_navigate_to_zms()
        self.driver.get(self.driver.current_url)
       
        # open config
        navbar = self._wait_for_element('.navbar-main')
        navbar.find_element_by_css_selector('.dropdown-toggle').click()
        navbar.find_element_by_link_text('Content-Objekte').click()
       
        # wait until opened
        self._find_element(By.CSS_SELECTOR, 'body.metas.config')
       
        time.sleep(1)
        print '</MetaobjManagerTest.test_conf>'

Ausführung

Einen einzelnen Test mittels folgendem Befehl ausführen:

%C:\dev\ZMS3\instance\live\Products\zms> C:\dev\ZMS3\Scripts\python.exe -m unittest selenium_tests.metaobj_manager_test.MetaobjManagerTest

# $ZMS_HOME/selenium-tests/credentials.txt #

[ac_server]
base_url=http://localhost:8080
login=admin
password=admin
firefox_path=C:\Users\<UserId>\AppData\Local\Mozilla Firefox\firefox.exe