from driver.CurlDriver import CurlDriver from util.spec import Spec, Argument, UseDriverArgument, InitDriverArgument, MultilineTextArgument, \ EnumArgument, AnonymousBooleanArgument spec = Spec('HTTP', spec_id='Http', imports=""" from typing import Optional from driver.CurlDriver import CurlDriver """ ) given = spec.given when = spec.when then = spec.then def driver_arg(): return UseDriverArgument('request object to use, "curl" by default', CurlDriver) given( 'HTTP request [as "<http driver instance id>"]', args={ 'http driver instance id': InitDriverArgument('a shortcut to this HTTP request, "curl" by default', CurlDriver), }, doc=""" HTTP request [as "<http driver instance id>"] * <http driver instance id> (optional): a shortcut to this HTTP request, "curl" by default """ )
from util.spec import Spec spec = Spec('Internal', imports=""" from typing import Dict, Any from util.spec import SentenceMatch """) given = spec.given when = spec.when then = spec.then when('I debug', doc=""" I debug A dummy pass step, that meant to have a place for putting a breakpoint by maintenance team only. """)
from driver.FtpDriver import FtpDriver from util.spec import Spec, Argument, UseDriverArgument, InitDriverArgument, EnumArgument spec = Spec('FTP/SFTP', spec_id='Ftp', imports=""" from driver.FtpDriver import FtpDriver """) given = spec.given when = spec.when then = spec.then def driver_arg(): return UseDriverArgument('FTP connection to use, "ftp" by default', FtpDriver) given('<protocol> connection to "<endpoint>" [as "<ftp driver instance id>"]', args={ 'protocol': EnumArgument('connection protocol', values=['FTP', 'SFTP']), 'endpoint': Argument('endpoint definition from environment to connect to'), 'ftp driver instance id': InitDriverArgument('a shortcut to this connection, "ftp" by default', FtpDriver), }, doc=""" FTP connection to "<endpoint>" [as "<ftp driver instance id>"] SFTP connection to "<endpoint>" [as "<ftp driver instance id>"]
from driver.ShellDriver import ShellDriver from util.spec import Spec, UseDriverArgument, InitDriverArgument, Argument, MultilineTextArgument, EnumArgument spec = Spec('Shell', imports=""" import sys from abc import abstractmethod from typing import Optional from driver.ShellDriver import ShellDriver """) given = spec.given when = spec.when then = spec.then def driver_arg(): return UseDriverArgument('shell session to use, "shell" by default', ShellDriver) given( 'shell session to "<endpoint>" [using "<shell>"] [as "<shell driver instance id>"]', args={ 'endpoint': Argument('endpoint definition from environment to connect to'), 'shell': Argument( '"bash", getting from environment definition or "bash" by default' ), 'shell driver instance id':
from driver.SqlDriver import SqlDriver from util.spec import Spec, UseDriverArgument, InitDriverArgument, Argument, EnumArgument spec = Spec('SQL', spec_id='Sql', imports=""" from typing import Optional from driver.SqlDriver import SqlDriver """) given = spec.given when = spec.when then = spec.then def driver_arg(): return UseDriverArgument('SQL connection to use, "db" by default', SqlDriver) given( 'DB ["<type>"] ["<version>"] connection to "<endpoint>" [as "<db driver instance id>"]', args={ 'type': Argument( 'MySQL, SQL Server, PostgreSQL, etc., type from environment by default', 'db_type'), 'version': Argument( 'exact client library version to use, version from environment by default' ), 'endpoint':
from driver.UiBrowserDriver import BrowserDriver, AppDriver, UiDriver from util.spec import Spec, UseDriverArgument, EnumArgument, Argument, InitDriverArgument, MultilineTextArgument, \ SelectorArgument, AnonymousBooleanArgument spec = Spec('Browser/GUI', spec_id='UiBrowser', imports=""" from typing import Optional from driver.UiBrowserDriver import BrowserDriver, UiDriver, AppDriver from util.spec import Selector """) given = spec.given when = spec.when then = spec.then def app_driver_arg(): return UseDriverArgument('application connection, "app" by default', AppDriver) def browser_driver_arg(): return UseDriverArgument('application connection, "app" by default', BrowserDriver) def ui_driver_arg(): return UseDriverArgument('application connection, "app" by default', UiDriver)
from util.spec import Spec, Argument spec = Spec('Scenario', imports=""" from typing import Optional """) given = spec.given when = spec.when then = spec.then when( 'I use "<variable>" [with value "<value>"] as an input parameter', args={ 'variable': Argument('input parameter name'), 'value': Argument( 'parameter value, defaults to the value of <variable> in the current scenario' ), }, doc=""" I use "<variable>" [with value "<value>"] as an input parameter * <variable> (required) input parameter name * <value> (optional) parameter value, defaults to the value of <variable> in the current scenario """) when('I expect "<variable>" to be an output parameter', args={ 'variable': Argument('output parameter name'), },
from driver.StopwatchDriver import StopwatchDriver from util.spec import Spec, UseDriverArgument, InitDriverArgument, EnumArgument, Argument spec = Spec('Stopwatch', imports=""" from driver.StopwatchDriver import StopwatchDriver """) given = spec.given when = spec.when then = spec.then def driver_arg(): return UseDriverArgument('driver id, "stopwatch" by default', StopwatchDriver) given('a stopwatch "<stopwatch driver id>"', args={ 'stopwatch driver id': InitDriverArgument( 'a shortcut to this HTTP request, "curl" by default', StopwatchDriver), }, doc=""" a stopwatch "<stopwatch driver id>" A stopwatch driver with driver id "stopwatch" is available by default * <stopwatch driver id> (required): driver id """)