Page MenuHomePhorge

Extract webadmin utility scripts from pykolab
Closed, ResolvedPublic5 Story Points

Description

There are existing utility functions in pykolab which interact with the webadmin API of a Kolab server in order to create/purge user accounts for integration tests. These should be integrated into a well documented set of tools that can be used in CI for automated integration testing.

Details

Ticket Type
Task

Event Timeline

bruederli claimed this task.
bruederli raised the priority of this task from to 60.
bruederli updated the task description. (Show Details)
bruederli changed Ticket Type from Task to Task.
bruederli edited a custom field.
bruederli subscribed.
vanmeeuwen subscribed.

These should probably end up in Stick?

Yes, these utilities could indeed end up in Stick but depend on PyKolab for the Webadmin API functions

I've created a set of functions/classes that would allow for Selenium-based integration tests to be written like this example for T153:

import unittest
from pytest import KolabSeleniumTest

class TestT153(KolabSeleniumTest):
    """
        Test case for Bug: Quering for a delegation user results in server error
        https://git.kolab.org/T153
    """
    @classmethod
    def setUpClass(self, *args, **kw):
        # define user accounts required for this test
        self.john = self.require_user("John", "Doe")
        self.jane = self.require_user("Jane", "Mitchell")

        KolabSeleniumTest.setUpClass(self, *args, **kw)

    def test_001_add_delegate(self):
        self.roundcube_login(self.john['mail'], self.john['userpassword'])

        # open delegation screen
        self.roundcube_open('settings','plugin.delegation')

        env = self.get_env()
        self.assertEqual(env.get('task'), 'settings')

        # open delegation form
        self.driver.get(self.roundcube_url('settings','plugin.delegation', _framed=1))
        elem = self.driver.find_element_by_css_selector('form input[name="delegate"]')
        elem.send_keys(self.jane['givenname'])
        self.wait_loading()

        # check autocompletion
        li = self.driver.find_element_by_css_selector('#rcmKSearchpane li:first-child')
        self.assertIn(self.jane['sn'], str(li.text), "Autocompletion list")

This is just an example of an actual issue we'd like to get tested in CI. The Selenium tests run in a headless PhantomJS environment and are inspired by TBits' test suite.

Initial import in rQAdcdad2a025a3

More things to be considered:

  • Dependencies: combine individual tests in suites with appropriate dependencies
  • Flags: allow to define tests as Todo, prototype or fatal; assign percentage values?

Added decorators for flagging tests as todo or selenium in rQA0941b9e2.