LoginTest
extends PersistentTools
in package
Uses
LoginLogoutTrait
Selenium low level utilities wich are using only selenium bindings
Tags
Table of Contents
- $downloadsDirectory : string
- Directory for downloads
- $driver : RemoteWebDriver|null
- Selenium driver
- $lastLogin : string
- Login of the last logged in user
- __destruct() : mixed
- Destroing driver at the end of the tests
- assertFileWasDownloaded() : void
- Asserting that file was downloaded
- setUp() : void
- Setting up test vars
- tearDown() : void
- Method destroys test variables
- testLogin() : void
- Testing login
- testLogout() : void
- Testing logout
- assertHasClass() : void
- Method asserts class name for the element
- checkTagContent() : void
- Method validates tag content
- clearInput() : void
- Method clears input field
- clickElement() : void
- Method clicks on element
- desktop() : bool
- Method returns true if the test was launched for desktop
- elementExists() : bool
- Method returns true if the element exists
- getDriver() : RemoteWebDriver
- Method fetches web driver object
- getTagContent() : string
- Method fetches tag's text
- inputIn() : void
- Method send data to the element with the specified selector
- isProd() : bool
- Method returns true if the parameter 'prod' was passed through command line
- isVisible() : bool
- Method returns true if the element is visible
- phone() : bool
- Method returns true if the test was lanched for mobile device
- requireLoggedIn() : void
- Method authorizes user
- requireLoggedOut() : void
- Method forces user to logout
- scrollToElement() : void
- Scrolling to element
- tablet() : bool
- Method returns true if the test was lanched for tablet device
- waitForInvisibilityBySelector() : void
- Method waits when element with class $className become invisible
- waitForPageLoad() : void
- Waiting for page load
- waitForPageReload() : void
- Waiting for page will be reloaded
- waitForVisibilityBySelector() : void
- Method waits when element with class $className become visible
Properties
$downloadsDirectory
Directory for downloads
public
string
$downloadsDirectory
= 'c:\tmp\selenium\'
$driver
Selenium driver
public
static RemoteWebDriver|null
$driver
= null
$lastLogin
Login of the last logged in user
private
static string
$lastLogin
= ''
Methods
__destruct()
Destroing driver at the end of the tests
public
__destruct() : mixed
Return values
mixed —assertFileWasDownloaded()
Asserting that file was downloaded
public
assertFileWasDownloaded([string $fileName = '' ]) : void
Parameters
- $fileName : string = ''
-
name of the downloaded file
Return values
void —setUp()
Setting up test vars
public
setUp() : void
Return values
void —tearDown()
Method destroys test variables
public
tearDown() : void
Return values
void —testLogin()
Testing login
public
testLogin() : void
Return values
void —testLogout()
Testing logout
public
testLogout() : void
Return values
void —assertHasClass()
Method asserts class name for the element
protected
assertHasClass(string $selector, string $className) : void
Parameters
- $selector : string
-
Selector of the element
- $className : string
-
Class name
Return values
void —checkTagContent()
Method validates tag content
protected
checkTagContent(string $selector, string $expectedValue) : void
Parameters
- $selector : string
-
tag selector
- $expectedValue : string
-
expected value
Tags
Return values
void —clearInput()
Method clears input field
protected
clearInput(string $selector) : void
Parameters
- $selector : string
-
Selector of the input field
Return values
void —clickElement()
Method clicks on element
protected
clickElement(string $selector) : void
Parameters
- $selector : string
-
Selector of the clicking element
Return values
void —desktop()
Method returns true if the test was launched for desktop
protected
desktop() : bool
Return values
bool —true if the test was launched for desktop, false otherwise
elementExists()
Method returns true if the element exists
protected
elementExists(string $selector) : bool
Parameters
- $selector : string
-
selector of the testing element
Return values
bool —true if the element exists, false otherwise
getDriver()
Method fetches web driver object
protected
static getDriver() : RemoteWebDriver
Return values
RemoteWebDriver —web driver object
getTagContent()
Method fetches tag's text
protected
getTagContent(string $selector) : string
Parameters
- $selector : string
-
tag's selector
Return values
string —tag's text
inputIn()
Method send data to the element with the specified selector
protected
inputIn(string $selector, string $value) : void
Parameters
- $selector : string
-
Element's selector
- $value : string
-
Value to be inputed
Return values
void —isProd()
Method returns true if the parameter 'prod' was passed through command line
protected
isProd() : bool
Return values
bool —isVisible()
Method returns true if the element is visible
protected
isVisible(string $selector) : bool
Parameters
- $selector : string
-
element's selector
Return values
bool —true if visible, false otherwise
phone()
Method returns true if the test was lanched for mobile device
protected
phone() : bool
Return values
bool —true if the test was lanched for mobile device, false otherwise
requireLoggedIn()
Method authorizes user
protected
requireLoggedIn(string $login, string $password) : void
Parameters
- $login : string
-
user login
- $password : string
-
user password
Return values
void —requireLoggedOut()
Method forces user to logout
protected
requireLoggedOut() : void
Return values
void —scrollToElement()
Scrolling to element
protected
scrollToElement(string $selector) : void
Parameters
- $selector : string
Return values
void —tablet()
Method returns true if the test was lanched for tablet device
protected
tablet() : bool
Return values
bool —true if the test was lanched for tablet device, false otherwise
waitForInvisibilityBySelector()
Method waits when element with class $className become invisible
protected
waitForInvisibilityBySelector(string $selector[, string $errorMessage = '' ]) : void
Parameters
- $selector : string
-
Selector
- $errorMessage : string = ''
-
Error message
Return values
void —waitForPageLoad()
Waiting for page load
protected
waitForPageLoad(string $url) : void
Parameters
- $url : string
-
page url
Return values
void —waitForPageReload()
Waiting for page will be reloaded
protected
waitForPageReload(callable $reloader) : void
Parameters
- $reloader : callable
Return values
void —waitForVisibilityBySelector()
Method waits when element with class $className become visible
protected
waitForVisibilityBySelector(string $selector[, string $errorMessage = '' ]) : void
Parameters
- $selector : string
-
Selector
- $errorMessage : string = ''
-
Error message