def userLogin():
    # Set options so that Chrome starts fullscreen
    logger.set_logger(StdoutLogger())
    options = webdriver.ChromeOptions()
    options.add_argument("--start-maximized")

    eyes = Eyes()
    eyes.api_key = "VOfLF4XBAbbMmsOLf0BxDx4APw7gCynQz7NjZwRG1076g110"
    eyes.force_full_page_screenshot = True

    # Get a selenium web driver object.
    # driver = webdriver.Chrome(chrome_options=options)
    driver = webdriver.Firefox()
    # driver = webdriver.Chrome()
    # Make sure to use the returned driver from this point on.
    # Use the following line for a specific viewport_size (WSVGA 16:9)
    eyes.open(
        driver=driver, app_name="Home Reach", test_name="Login to Dash", viewport_size={"width": 1136, "height": 640}
    )
    # No viewport size set - using fullscreen
    # driver = eyes.open(driver=driver, app_name='Home Reach', test_name='Login to Dash')
    # Work-around for eyes SDK issue
    # eyes.open(driver=driver, app_name='Home Reach', test_name='Login to Dash')

    try:
        driver.get("https://homereach.aminocom.com")

        # Visual validation point #1
        eyes.check_window("Login Page")

        driver.find_element_by_id("username").clear()
        driver.find_element_by_id("username").send_keys("rayres-prodlive1")
        driver.find_element_by_id("username").send_keys(u"\ue004")
        driver.find_element_by_id("userpassword").clear()
        driver.find_element_by_id("userpassword").send_keys("planet07")
        driver.find_element_by_id("cmdLogin").click()

        for i in range(10):
            try:
                if driver.find_element_by_id("flashImg1"):
                    # Visual validation point #2
                    # eyes.check_window('Dashboard')
                    driver.find_element_by_link_text("Logout").click()
                    print "Logging out"
                    break
            except Exception as e:
                print "Wait.."
                time.sleep(1)
        else:
            return "Element not found"

        # End visual testing. Validate visual correctness.
        eyes.close()

    except Exception as e:
        print e

    finally:
        driver.quit()
        eyes.abort_if_not_closed()
def test_non_logged_in_users():
    eyes = Eyes()
    eyes.api_key = 'u51qaFo104ruwwox0ewoWiFZQpijro9Z47fYTk1iQTozU110'

    driver = webdriver.Firefox()
    driver.maximize_window()

    try:
        eyes.open(driver=driver, app_name='Applitools', test_name='TpT Non Logged In Pages')
        driver.get('http://www.teacherspayteachers.com')
        eyes.check_window('Homepage')

        driver.get("https://www.teacherspayteachers.com/Product/Multi-Purpose-Graphic-Organizers-Bundle-576136")
        eyes.check_window("Product Page")

        driver.find_element_by_xpath(".//*[@id='content_layout']/div[1]/div[3]/div[5]/div/div[2]/div/a").click()
        eyes.check_window("Store Page")

        eyes.close()

    finally:
        driver.quit()
        eyes.abort_if_not_closed()
Esempio n. 3
0
    time.sleep(5)
    second_dropdown_2 = driver.find_element_by_xpath("//ul[@class='super-menu mobile-menu menu-table']/li[3]/ul/li[5]/a")
    ActionChains(driver).move_to_element(second_dropdown_2).perform()


def hover_over_recreational_leasing_gallery_second_drop_down(driver):
    time.sleep(5)
    second_dropdown_1 = driver.find_element_by_xpath("//ul[@class='super-menu mobile-menu menu-table']/li[4]/a/span")
    ActionChains(driver).move_to_element(second_dropdown_1).perform()
    time.sleep(5)
    second_dropdown_2 = driver.find_element_by_xpath("//ul[@class='super-menu mobile-menu menu-table']/li[4]/ul/li[6]/a")
    ActionChains(driver).move_to_element(second_dropdown_2).perform()


eyes = Eyes()
eyes.api_key = 'u51qaFo104ruwwox0ewoWiFZQpijro9Z47fYTk1iQTozU110'
driver = webdriver.Firefox()
#driver.maximize_window()

try:
    eyes.open(driver=driver, app_name='hullforest1', test_name='hullforestwhole')

    #Homepage
    driver.get('http://hullforest.managedcoder.com/')
    #eyes.check_window('Homepage')

    #register
    driver.find_element_by_xpath("//a[@class='secondary-menu-item-2']/span").click()
    #eyes.check_window("register")

    # Login
Esempio n. 4
0
    def open_eyes_session(self, url, appname, testname, apikey, width=None,
                          height=None, osname=None, browsername=None,
                          matchlevel=None, includeEyesLog=False, httpDebugLog=False):
        """
        Starts a session with the Applitools Eyes Website.

        Arguments:
                |  URL (string)                         | The URL to start the test on                                                                                |
                |  Application Name (string)            | The name of the application under test.                                                                     |
                |  Test Name (string)                   | The test name.                                                                                              |
                |  API Key (string)                     | User's Applitools Eyes key.                                                                                 |
                |  (Optional) Width (int)               | The width of the browser window e.g. 1280                                                                   |
                |  (Optional) Height (int)              | The height of the browser window e.g. 1000                                                                  |
                |  (Optional) Operating System (string) | The operating system of the test, can be used to override the OS name to allow cross OS verfication         |
                |  (Optional) Browser Name (string)     | The browser name for the test, can be used to override the browser name to allow cross browser verfication  |
                |  (Optional) Match Level (string)      | The match level for the comparison - can be STRICT, LAYOUT or CONTENT                                       |
                |  Include Eyes Log (default=False)     | The Eyes logs will not be included by default. To activate, pass 'True' in the variable.                    |
                |  HTTP Debug Log (default=False)       | The HTTP Debug logs will not be included by default. To activate, pass 'True' in the variable.              |

        Creates an instance of the Selenium2Library webdriver.
        Defines a global driver and sets the Selenium2Library webdriver to the global driver.

        Checks if there has been a width or height value passed in.
        If there no are values passed in, eyes calls the method open without the width and height values.
        Otherwise eyes calls open with the width and height values defined.

        The Height resolution should not be greater than 1000, this is currently Applitools maximum setting.

        The driver then gets the url that will be tested.

        Starts a session with the Applitools Eyes Website. See https://eyes.applitools.com/app/sessions/

        Example:

        | *Keywords*         |  *Parameters*                                                                                                                                                                                                                    |
        | Open Browser       |  http://www.navinet.net/ | gc                |                            |                     |        |       |                  |                       |                      |                       |                     |
        | Open Eyes Session  |  http://www.navinet.net/ | RobotAppEyes_Test |  NaviNet_RobotAppEyes_Test |  YourApplitoolsKey  |  1024  |  768  |  OSOverrideName  |  BrowserOverrideName  |  matchlevel=LAYOUT   |  includeEyesLog=True  |  httpDebugLog=True  |
        | Check Eyes Window  |  NaviNet Home            |                   |                            |                     |        |       |                  |                       |                      |                       |                     |
        | Close Eyes Session |  False                   |                   |                            |                     |        |       |                  |                       |                      |                       |                     |

        """

        global driver
        global eyes
        eyes = Eyes()
        eyes.api_key = apikey
        s2l = BuiltIn().get_library_instance('Selenium2Library')
        webdriver = s2l._current_browser()
        driver = webdriver
        if includeEyesLog is True:
            logger.set_logger(StdoutLogger())
            logger.open_()
        if httpDebugLog is True:
            httplib.HTTPConnection.debuglevel = 1
        if osname is not None:
            eyes.host_os = osname  # (str)
        if browsername is not None:
            eyes.host_app = browsername  # (str)
        if matchlevel is not None:
            eyes.match_level = matchlevel
        if width is None and height is None:
            eyes.open(driver, appname, testname)
        else:
            intwidth = int(width)
            intheight = int(height)
            eyes.open(driver, appname, testname, {'width': intwidth, 'height': intheight})
            driver.get(url)
Esempio n. 5
0
    def open_eyes_session(self,
                          appname,
                          testname,
                          apikey,
                          applitoolsurl='https://eyessdk.applitools.com',
                          library='Selenium2Library',
                          width=None,
                          height=None,
                          osname=None,
                          browsername=None,
                          matchlevel=None,
                          includeEyesLog=False,
                          httpDebugLog=False,
                          fullPageScreenshot=False,
                          baselineName=None,
                          batchName=None,
                          branchname=None,
                          parentbranch=None):
        """
        Starts a session with the Applitools Eyes Website.
        Arguments:
                |  Application Name (string)                    | The name of the application under test.                                                                     |
                |  Test Name (string)                           | The test name.                                                                                              |
                |  API Key (string)                             | User's Applitools Eyes key.
                |  library  (optional)                          | Standard:Selenium2Library. If you use another one, assign the right library.
                |  applitoolsurl (optional)                     | Standard:eyes.applitools.com. If you run in a cloud version, assign the right applitoolsurl.
                |  (Optional) Width (int)                       | The width of the browser window e.g. 1280                                                                   |
                |  (Optional) Height (int)                      | The height of the browser window e.g. 1000                                                                  |
                |  (Optional) Operating System (string)         | The operating system of the test, can be used to override the OS name to allow cross OS verfication         |
                |  (Optional) Browser Name (string)             | The browser name for the test, can be used to override the browser name to allow cross browser verfication  |
                |  (Optional) Match Level (string)              | The match level for the comparison - can be STRICT, LAYOUT or CONTENT                                       |
                |  Force Full Page Screenshot (default=False)   | Will force the browser to take a screenshot of whole page.                                      |
                |  Include Eyes Log (default=False)             | The Eyes logs will not be included by default. To activate, pass 'True' in the variable.                    |
                |  HTTP Debug Log (default=False)               | The HTTP Debug logs will not be included by default. To activate, pass 'True' in the variable.              |
                |  baselineName (default=None)                  | New tests will be automatically saved as baseline.
                |  batchName (default=None)                     | Tests with the same batchname will be unified as one group in the Test Manager screen.
                |  Branch Name (default=False)                  | The branch to use to check test                                                                             |
                |  Parent Branch (default=False)                | Parent Branch to base the new Branch on
                |  Force full page screenshot (default=false)   | The whole page will be in the screen shot

        Creates an instance of the library webdriver.
        Defines a global driver and sets the library webdriver to the global driver.
        Checks if there has been a width or height value passed in.
        If there no are values passed in, eyes calls the method open without the width and height values.
        Otherwise eyes calls open with the width and height values defined.
        The Height resolution should not be greater than 1000, this is currently Applitools maximum setting.
        Starts a session with the Applitools Eyes Website. See https://eyes.applitools.com/app/sessions/
        Example:
        | *Keywords*         |  *Parameters*        |               |                  |                       |           |        |        |                  |                      |                     |                     |                       |
        | Open Browser       |  yourTestingUrl      |  gc           |                  |                       |           |        |        |                  |                      |                     |                     |                       |
        | Open Eyes Session  | yourAppName          |  yourTestName | YourApplitoolsKey|  cloudapplitoolsurl   | library   |  1024  |  768   |  OSOverrideName  |  BrowserOverrideName |  matchlevel=LAYOUT  | includeEyesLog=True |  httpDebugLog=True    |
        | Check Eyes Window  |  NaviNet Home        |               |                  |                       |           |        |        |                  |                      |                     |                     |                       |
        | Close Eyes Session |  False               |               |                  |                       |           |        |        |                  |                      |                     |                     |                       |
        """
        global driver
        global eyes
        eyes = Eyes(applitoolsurl)
        eyes.api_key = apikey
        eyes.force_full_page_screenshot = fullPageScreenshot in [
            True, 'True', 'true', '1', 1
        ]
        s2l = BuiltIn().get_library_instance(library)
        webdriver = s2l._current_browser()
        driver = webdriver

        if includeEyesLog is True:
            logger.set_logger(StdoutLogger())
            logger.open_()
        if httpDebugLog is True:
            httplib.HTTPConnection.debuglevel = 1
        if osname is not None:
            eyes.host_os = osname  # (str)
        if browsername is not None:
            eyes.host_app = browsername  # (str)
        if baselineName is not None:
            eyes.baseline_name = baselineName  # (str)
        if batchName is not None:
            batch = BatchInfo(batchName)
            eyes.batch = batch
        if matchlevel is not None:
            eyes.match_level = matchlevel
        if parentbranch is not None:
            eyes.parent_branch_name = parentbranch  # (str)
        if branchname is not None:
            eyes.branch_name = branchname  # (str)
        if width is None and height is None:
            eyes.open(driver, appname, testname)
        else:
            intwidth = int(width)
            intheight = int(height)
            eyes.open(driver, appname, testname, {
                'width': intwidth,
                'height': intheight
            })
Esempio n. 6
0
from selenium import webdriver
from applitools import logger
from applitools.logger import StdoutLogger
from applitools.eyes import Eyes
from applitools.common import StitchMode

import os
#os.environ['HTTPS_PROXY'] = "http://localhost:8888"

driver = webdriver.Chrome()

eyes = Eyes()
eyes.api_key = os.environ['APPLITOOLS_API_KEY']

logger.set_logger(StdoutLogger())

# Force Eyes to grab a full page screenshot.
eyes.force_full_page_screenshot = True
eyes.stitch_mode = StitchMode.CSS

try:
    driver = eyes.open(driver, "Python app", "applitools", {
        'width': 800,
        'height': 600
    })
    driver.get('http://www.applitools.com')
    eyes.check_window("Home")

    automated_paragraph = driver.find_element_by_class_name("automated")
    eyes.check_region_by_element(automated_paragraph,
                                 "Automated Testing Paragraph")
Esempio n. 7
0
from selenium import webdriver
from applitools.eyes import Eyes, DiffsFoundError
import requests

username = '******'
authkey = 'u70ee7e205f04560'
test_result = None
eyes = Eyes()

# Initialize the eyes SDK and set your private API key.
eyes.api_key = 'NOTMYAPIKEY'

try:
    # choose some capabilities that will reflect
    # the browser/os we want to test on.
    caps = {
        'name': 'Applitools Example',
        'browserName': 'Chrome',
        'platform': 'Windows 10',
        'screenResolution': '1366x768'
    }

    # open a remote webdriver connected to cbt's hub
    driver = webdriver.Remote(
        desired_capabilities=caps,
        command_executor="http://%s:%[email protected]:80/wd/hub" %
        (username, authkey))

    # Start the test and set the browser's viewport size to 800x600.
    eyes.open(driver=driver,
              app_name='CrossBrowserTesting',
Esempio n. 8
0
__author__ = 'Yanir Taflev'
from selenium import webdriver
from applitools.eyes import Eyes

eyes = Eyes()
# This is your api key, make sure you use it in all your tests.
eyes.api_key = APPLITOOLS_APIKEY

# Get a selenium web driver object.
driver = webdriver.Firefox()

try:
    # Start visual testing with browser viewport set to 1024x768.
    # Make sure to use the returned driver from this point on.
    driver = eyes.open(driver=driver,
                       app_name='Applitools website',
                       test_name='Example test',
                       viewport_size={
                           'width': 900,
                           'height': 600
                       })
    driver.get('http://www.applitools.com')

    # Visual validation point #1
    eyes.check_window('Main Page')

    driver.find_element_by_css_selector('.read_more').click()

    # Visual validation point #2
    eyes.check_window('Features Page')
from applitools import logger
from applitools.eyes import Eyes
import os


# Appium session configuration.
from applitools.logger import StdoutLogger

desired_capabilities = {'platformName': 'Android',
                        'platformVersion': '4.2',
                        'deviceName': 'Samsung Galaxy S5',
                        'app': os.environ['ANDROID_NOTES_LIST_APP'],
                        'app-package': 'com.example.android.notepad',
                        'app-activity': '.NotesList',
                        'newCommandTimeout': 300}

# Assuming Appium is running on localhost.
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_capabilities)
driver.orientation = 'LANDSCAPE'
logger.set_logger(StdoutLogger())
eyes = Eyes("https://localhost.applitools.com")
eyes.api_key = os.environ['APPLITOOLS_API_KEY']
eyes.baseline_name = "NotesList 1080x1794"
try:
    eyes.open(driver, 'Appium', 'Notes list')
    eyes.check_window('Opening screen')
    eyes.close()
finally:
    driver.quit()
    eyes.abort_if_not_closed()
def userLogin():
    #Set options so that Chrome starts fullscreen
    logger.set_logger(StdoutLogger())
    #options = webdriver.ChromeOptions();
    #options.add_argument("--start-maximized");

    eyes = Eyes()
    eyes.api_key = 'VOfLF4XBAbbMmsOLf0BxDx4APw7gCynQz7NjZwRG1076g110'
    #eyes.force_full_page_screenshot=True

    # Get a selenium web driver object.
    # driver = webdriver.Chrome(chrome_options=options)
    driver = webdriver.Firefox()
    # driver = webdriver.Chrome()
    # Make sure to use the returned driver from this point on.
    # Use the following line for a specific viewport_size (WSVGA 16:9)
    driver = eyes.open(driver=driver, app_name='Home Reach', test_name='Login to Dash', viewport_size={'width': 1024, 'height': 600})
    # No viewport size set - using fullscreen
    # driver = eyes.open(driver=driver, app_name='Home Reach', test_name='Login to Dash')
    # Work-around for eyes SDK issue
    # eyes.open(driver=driver, app_name='Home Reach', test_name='Login to Dash')
    
    
    driver.get('https://homereach.aminocom.com')
       
    # Visual validation point #1
    #eyes.check_window('Login Page')
        
    driver.find_element_by_id("username").clear()
    driver.find_element_by_id("username").send_keys("rayres-trialsbeta1")
    driver.find_element_by_id("username").send_keys(u'\ue004')
    driver.find_element_by_id("userpassword").clear()
    driver.find_element_by_id("userpassword").send_keys("planet07")
    driver.find_element_by_id("cmdLogin").click()
       
    #selenium.webdriver.support.expected_conditions.invisibility_of_element_located(locator)
    #element = WebDriverWait(driver, 15).until(EC.presence_of_element_located((By.ID, "divFlashVersion"))
    element = WebDriverWait(driver, 15).until(EC.invisibility_of_element_located((By.ID, "divFlashVersion")))
    
    try:
        for i in range(20):
            try:
                flashCheck = driver.find_element_by_id("divFlashVersion")
                print flashCheck
                if flashCheck != driver.find_element_by_id("divFlashVersion"):
					print "Flash version check"
					print flashCheck
					time.sleep(1)
					continue
                elif flashCheck == driver.find_element_by_id("divFlashVersion"):
					print "No Flash check"
					print flashCheck
					if driver.find_element_by_id("flashImg1"):
						# Visual validation point #2
						#eyes.check_window('Dashboard')
						print "Found flashImg1"
						driver.find_element_by_link_text("Logout").click()
						print 'Logging out'
						break
            except Exception as e:
                print e
                print 'Wait..'
                time.sleep(1)
             
        # End visual testing. Validate visual correctness.
        eyes.close()

    except Exception as e:
        print e

    finally:
        driver.quit()
        eyes.abort_if_not_closed()
Esempio n. 11
0
__author__ = 'Roysten'

from selenium import webdriver
from applitools.eyes import Eyes
from selenium.webdriver.support.ui import Select

eyes = Eyes()
eyes.api_key = 'ch7Sd23Pev9cGQxppqs9LhVIOsFfKzR98VOCravuZxmk110'
driver = webdriver.Firefox()


try:


    driver.get('http://hullforest.managedcoder.com/account/register')
    element0 = driver.find_element_by_name("custom_field[account][1]")
    element0.click()
    element = driver.find_element_by_id("input-firstname")
    element.send_keys("roystonbseller")
    element1 = driver.find_element_by_id("input-lastname")
    element1.send_keys("fernandes")
    element2 = driver.find_element_by_id("input-email")
    element2.send_keys("*****@*****.**")
    element3 = driver.find_element_by_id("input-address-1")
    element3.send_keys("goa")
    element4 = driver.find_element_by_id("input-city")
    element4.send_keys("ponda")
    element5 = Select(driver.find_element_by_id('input-country'))
    element5 = Select(driver.find_element_by_id('input-zone'))
    element6 = driver.find_element_by_id("input-telephone")
    element6.send_keys("8698042639")
    def open_eyes_session(self,
                          appname,
                          testname,
                          apikey,
                          matchlevel=None,
                          includeEyesLog=False,
                          httpDebugLog=False,
                          use_css_transition=False,
                          baselineName=None,
                          batch=None):
        """
        Starts a session with the Applitools Eyes Website.
        Arguments:
                |  Application Name (string)            | The name of the application under test.                                                                     |
                |  Test Name (string)                   | The test name.                                                                                              |
                |  API Key (string)                     | User's Applitools Eyes key.                                                                                 |
                |  (Optional) Match Level (string)      | The match level for the comparison - can be STRICT, LAYOUT or CONTENT                                       |
                |  Include Eyes Log (default=False)     | The Eyes logs will not be included by default. To activate, pass 'True' in the variable.                    |
                |  HTTP Debug Log (default=False)       | The HTTP Debug logs will not be included by default. To activate, pass 'True' in the variable.              |
                |  Use CSS Transition (default=False)           | Uses CSS Transition instead of actual scrolling for full page screenshots. To activate, pass 'True' in the variable. |
                |  (Optional) Baseline Name (string)    | The name of the baseline to compare test to. Should be used for cross browser verification                  |
                |  (Optional) Batch (BatchInfo)         | The batch to place the test into. Should be a BatchInfo object                                              |
        Defines a global driver, and eyes.

        Starts a session with the Applitools Eyes Website. See https://eyes.applitools.com/app/sessions/
        Example:
        | *Keywords*         |  *Parameters*                                                                                                                                                                                                                                 |
        | Open Browser       |  http://www.navinet.net/ | gc                         |                     |                 |                      |                       |                     |                           |                           |                  |
        | ${batch}           |  Create Eyes Batch       | Batch Name                 |                     |                 |                      |                       |                     |                           |                           |                  |
        | Open Eyes Session  |  RobotAppEyes_Test       |  NaviNet_RobotAppEyes_Test |  YourApplitoolsKey  |  matchlevel=LAYOUT   |  includeEyesLog=True  |  httpDebugLog=True  |  use_css_transition=True  |  baselineName='Baseline'  |  batch=${batch}  |
        | Check Eyes Window  |  NaviNet Home            |                            |                     |                 |                      |                       |                     |                           |                           |                  |
        | Close Eyes Session |  False                   |                            |                     |                 |                      |                       |                     |                           |                           |                  |
        """
        global driver
        global eyes

        eyes = Eyes()
        eyes.api_key = apikey

        driver = self.get_webdriver_instance()

        if includeEyesLog is True:
            logger.set_logger(StdoutLogger())
            logger.open_()
        if httpDebugLog is True:
            http.client.HTTPConnection.debuglevel = 1
        if baselineName is not None:
            eyes.baseline_branch_name = baselineName  # (str)
        if batch is not None:
            eyes.batch = batch
        if matchlevel is not None:
            eyes.match_level = matchlevel

        stitch_mode = StitchMode.Scroll

        if isinstance(use_css_transition, bool):
            if use_css_transition == True:
                stitch_mode = StitchMode.CSS
        elif use_css_transition.lower() == 'true':
            stitch_mode = StitchMode.CSS

        eyes.stitch_mode = stitch_mode

        eyes.open(driver, appname, testname)
__author__ = 'Yanir Taflev'
from selenium import webdriver
from applitools.eyes import Eyes

eyes = Eyes()
# This is your api key, make sure you use it in all your tests.
eyes.api_key = APPLITOOLS_APIKEY

# Get a selenium web driver object.
driver = webdriver.Firefox()

try:
    # Start visual testing with browser viewport set to 1024x768.
    # Make sure to use the returned driver from this point on.
    driver = eyes.open(driver=driver, app_name='Applitools website', test_name='Example test',
                       viewport_size={'width': 900, 'height': 600})
    driver.get('http://www.applitools.com')

    # Visual validation point #1
    eyes.check_window('Main Page')

    driver.find_element_by_css_selector('.read_more').click()

    # Visual validation point #2
    eyes.check_window('Features Page')

    # End visual testing. Validate visual correctness.
    eyes.close()
finally:
    driver.quit()
    eyes.abort_if_not_closed()
from selenium import webdriver
from applitools.eyes import Eyes
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from applitools import logger
from applitools.logger import StdoutLogger
import time

delay1 = 5
delay2 = 15
delay3 = 30
delay4 = 35
eyes = Eyes()
eyes.api_key = 'VOfLF4XBAbbMmsOLf0BxDx4APw7gCynQz7NjZwRG1076g110'
logger.set_logger(StdoutLogger())
driver = webdriver.Firefox()
driver.implicitly_wait(delay2)
driver = eyes.open(driver=driver, app_name='Home Reach', test_name='Dashboard Navigation v2', viewport_size={'width': 1366, 'height': 768})
target = "https://homereach.aminocom.com"

def dashNav():
    try:
        driver.get(target)
        driver.find_element_by_id("username").clear()
        driver.find_element_by_id("username").send_keys("rayres-prodlive1")
        driver.find_element_by_id("username").send_keys(u'\ue004')
        driver.find_element_by_id("userpassword").clear()
        driver.find_element_by_id("userpassword").send_keys("planet07")
        driver.find_element_by_id("cmdLogin").click()
def test_non_logged_in_users():
    eyes = Eyes()
    eyes.api_key = 'u51qaFo104ruwwox0ewoWiFZQpijro9Z47fYTk1iQTozU110'

    driver = webdriver.Firefox()
    driver.maximize_window()

    try:
        eyes.open(driver=driver, app_name='Applitools', test_name='TpT Non Logged In Pages')

        # Check HomePage
        driver.get('http://www.teacherspayteachers.com')
        eyes.check_window('Homepage')

        # Check Empty Cart Page
        driver.find_element_by_xpath("//div[@class='drop_down my_cart']/a").click()
        eyes.check_window("Empty Cart Page")
        driver.find_element_by_xpath("//a[@class='common_button green small continue_shopping_button']").click()

        # Check Product Page
        driver.get("https://www.teacherspayteachers.com/Product/Informational-Text-Structures-Task-Cards-1057257")
        eyes.check_window("Product Page")

        # Check cart page with products
        driver.find_element_by_xpath("//div[@class='prod_price_box_wrap']/div[1]/div[2]/div[1]/a").click()
        eyes.check_window("Cart Page")
        driver.find_element_by_xpath("//div[@class='checkout_flow_pages cart_page']/div[1]/div[1]/div[1]/a").click()

        # Check Store Page
        driver.find_element_by_xpath("//div[@class='r_side']/div[3]/div[1]/div[1]/a").click()
        eyes.check_window("Store Page")

        # Check Ratings & Comment Tab on store page
        driver.find_element_by_xpath("//a[@id='ui-id-2']").click()
        time.sleep(2)
        eyes.check_window("Store Page >> Ratings & Comment Tab")

        # Check Gift Cards Page
        driver.find_element_by_xpath("//div[@class='header_user_menu']/a[3]").click()
        eyes.check_window("Gift Card Page")

        # Check Login Page
        driver.find_element_by_class_name("js-login").click()
        eyes.check_window("Login Page")

        # Check Signup Page
        driver.find_element_by_xpath("//div[@class='btns']/a[2]").click()
        eyes.check_window("Signup Page")

        # Check publisher signup page
        driver.find_element_by_xpath("//div[@class='seller_publisher_block']/a").click()
        eyes.check_window("Publisher Signup Page")

        # Terms of Service
        driver.find_element_by_xpath("//div[@class='centered']/a[2]").click()
        eyes.check_window("Terms of service")

        # Privacy Policy
        driver.find_element_by_xpath("//div[@class='centered']/a[3]").click()
        eyes.check_window("Privacy policy")

        # Press
        driver.find_element_by_xpath("//div[@class='block left']/a[4]").click()
        eyes.check_window("Press")

        # Blog
        driver.find_element_by_xpath("//div[@class='block left']/a[5]").click()
        eyes.check_window("Blog")
        driver.back()

        # How to sell items
        driver.find_element_by_xpath("//div[@class='block left']/a[6]").click()
        eyes.check_window("How to sell items")

        # Copyright and trademark policies
        driver.find_element_by_xpath("//div[@class='centered']/a[4]").click()
        eyes.check_window("Copyright and trademark policies")

        # About us
        driver.find_element_by_xpath("//div[@class='centered']/a[5]").click()
        eyes.check_window("About us")

        # Contact us
        driver.find_element_by_xpath("//div[@class='centered']/a[6]").click()
        eyes.check_window("Contact us")

        # Careers
        driver.find_element_by_xpath("//div[@class='centered']/a[7]").click()
        eyes.check_window("Careers")


        #FAQ's and Helps
        driver.find_element_by_xpath("//div[@class='centered']/a[8]").click()
        eyes.check_window("FAQ's and Helps")
        driver.back()

        # Schools
        driver.find_element_by_xpath("//div[@class='header_user_menu']/a[2]").click()
        eyes.check_window("Schools")

        eyes.close()

    finally:
        driver.quit()
        eyes.abort_if_not_closed()
    def open_eyes_session(self,
                          appname,
                          testname,
                          apikey,
                          width=None,
                          height=None,
                          osname=None,
                          browsername=None,
                          matchlevel=None,
                          includeEyesLog=False,
                          httpDebugLog=False,
                          baselineName=None,
                          batchName=None,
                          ApplitoolsJenkinsPlugin=False,
                          branchname=None,
                          parentbranch=None,
                          hideScrollBar=False,
                          fullPageScreenshot=False,
                          matchTimeout=None,
                          cssStitch=None):
        """
        Starts a session with the Applitools Eyes Website.

        Arguments:
                |  Application Name (string)                     | The name of the application under test.                                                                                                  |
                |  Test Name (string)                            | The test name.                                                                                                                           |
                |  API Key (string)                              | User's Applitools Eyes key.                                                                                                              |
                |  (Optional) Width (int)                        | The width of the browser window e.g. 1280                                                                                                |
                |  (Optional) Height (int)                       | The height of the browser window e.g. 1000                                                                                               |
                |  (Optional) Operating System (string)          | The operating system of the test, can be used to override the OS name to allow cross OS verfication                                      |
                |  (Optional) Browser Name (string)              | The browser name for the test, can be used to override the browser name to allow cross browser verfication                               |
                |  (Optional) Match Level (string)               | The match level for the comparison - can be STRICT, LAYOUT or CONTENT                                                                    |
                |  Include Eyes Log (default=False)              | The Eyes logs will not be included by default. To activate, pass 'True' in the variable.                                                 |
                |  HTTP Debug Log (default=False)                | The HTTP Debug logs will not be included by default. To activate, pass 'True' in the variable.                                           |
                |  (Optional) Branch Name (default=None)         | The branch to use to check test                                                                                                          |   For further information - http://support.applitools.com/customer/portal/articles/2142886
                |  (Optional)Parent Branch (default=None)        | Parent Branch to base the new Branch on                                                                                                  |   For further information - http://support.applitools.com/customer/portal/articles/2142886
                |  (Optional) fullPageScrennshot (default=False) | Will force the browser to take a screenshot of whole page.                                                                               |
                |  (Optional) matchTimeout                       | The amount of time that Eyes will wait for an image to stabilize to a point that it is similar to the baseline image                     |   For further information - http://support.applitools.com/customer/portal/articles/2099488
                |  (Optional) ApplitoolsJenkinsPlugin (Boolean)  | Integration with Applitools Jenkins Plugin                                                                                               |   For further information - http://support.applitools.com/customer/portal/articles/2689601
                |  (Optional) cssStitch (string)                 | Scrolling option either Scroll or CSS                                                                                                    |   For further information - http://support.applitools.com/customer/portal/articles/2249374


        Creates an instance of the Selenium2Library webdriver.
        Defines a global driver and sets the Selenium2Library webdriver to the global driver.

        Checks if there has been a width or height value passed in.
        If there no are values passed in, eyes calls the method open without the width and height values.
        Otherwise eyes calls open with the width and height values defined.

        The Height resolution should not be greater than 1000, this is currently Applitools maximum setting.

        Starts a session with the Applitools Eyes Website. See https://eyes.applitools.com/app/sessions/

        Example:

        | *Keywords*         |  *Parameters*                                                                                                                                                                                                                    |
        | Open Browser       |  http://www.navinet.net/ | gc                |                            |                     |        |       |                  |                       |                      |                       |                     |
        | Open Eyes Session  |  RobotAppEyes_Test |  NaviNet_RobotAppEyes_Test |  YourApplitoolsKey  |  1024  |  768  |  OSOverrideName  |  BrowserOverrideName  |  matchlevel=LAYOUT   |  includeEyesLog=True  |  httpDebugLog=True  |
        | Check Eyes Window  |  NaviNet Home            |                   |                            |                     |        |       |                  |                       |                      |                       |                     |
        | Close Eyes Session |  False                   |                   |                            |                     |        |       |                  |                       |                      |                       |                     |

        """
        global driver
        global eyes
        eyes = Eyes()
        eyes.api_key = apikey
        self._eyes_set_batch(batchName,ApplitoolsJenkinsPlugin)
        eyes.force_full_page_screenshot = fullPageScreenshot
        eyes.hide_scrollbars = hideScrollBar
        if baselineName is not None:
            eyes.baseline_name = baselineName  # (str)

        s2l = BuiltIn().get_library_instance('Selenium2Library')
        webdriver = s2l._current_browser()
        driver = webdriver

        if includeEyesLog is True:
            logger.set_logger(StdoutLogger())
            logger.open_()
        if httpDebugLog is True:
            httplib.HTTPConnection.debuglevel = 1
        if osname is not None:
            eyes.host_os = osname  # (str)
        if browsername is not None:
            eyes.host_app = browsername  # (str)
        if matchTimeout is not None:
            eyes._match_timeout= int(matchTimeout)
        if baselineName is not None:
            eyes.baseline_name = baselineName  # (str)
        if matchlevel is not None:
            eyes.match_level = matchlevel
        if parentbranch is not None:
            eyes.parent_branch_name = parentbranch  # (str)
        if branchname is not None:
            eyes.branch_name = branchname  # (str)
        if cssStitch is not None:
            if cssStitch == 'CSS':
                eyes.stitch_mode = StitchMode.CSS
            elif cssStitch == 'Scroll':
                eyes.stitch_mode = StitchMode.Scroll
        if width is None and height is None:
            eyes.open(driver, appname, testname)
        else:
            intwidth = int(width)
            intheight = int(height)
            eyes.open(driver, appname, testname, {'width': intwidth, 'height': intheight})
Esempio n. 17
0
    def open_eyes_session(self,
                          appname,
                          testname,
                          apikey,
                          width=None,
                          height=None,
                          osname=None,
                          browsername=None,
                          matchlevel=None,
                          includeEyesLog=False,
                          httpDebugLog=False,
                          baselineName=None,
                          batchName=None,
                          branchname=None,
                          parentbranch=None):
        """
        Starts a session with the Applitools Eyes Website.

        Arguments:
                |  Application Name (string)            | The name of the application under test.                                                                     |
                |  Test Name (string)                   | The test name.                                                                                              |
                |  API Key (string)                     | User's Applitools Eyes key.                                                                                 |
                |  (Optional) Width (int)               | The width of the browser window e.g. 1280                                                                   |
                |  (Optional) Height (int)              | The height of the browser window e.g. 1000                                                                  |
                |  (Optional) Operating System (string) | The operating system of the test, can be used to override the OS name to allow cross OS verfication         |
                |  (Optional) Browser Name (string)     | The browser name for the test, can be used to override the browser name to allow cross browser verfication  |
                |  (Optional) Match Level (string)      | The match level for the comparison - can be STRICT, LAYOUT or CONTENT                                       |
                |  Include Eyes Log (default=False)     | The Eyes logs will not be included by default. To activate, pass 'True' in the variable.                    |
                |  HTTP Debug Log (default=False)       | The HTTP Debug logs will not be included by default. To activate, pass 'True' in the variable.              |
                |  Branch Name (default=False)          | The branch to use to check test                                                                             |
                |  Parent Branch (default=False)        | Parent Branch to base the new Branch on                                                                     |

        Creates an instance of the Selenium2Library webdriver.
        Defines a global driver and sets the Selenium2Library webdriver to the global driver.

        Checks if there has been a width or height value passed in.
        If there no are values passed in, eyes calls the method open without the width and height values.
        Otherwise eyes calls open with the width and height values defined.

        The Height resolution should not be greater than 1000, this is currently Applitools maximum setting.

        Starts a session with the Applitools Eyes Website. See https://eyes.applitools.com/app/sessions/

        Example:

        | *Keywords*         |  *Parameters*                                                                                                                                                                                                                    |
        | Open Browser       |  http://www.navinet.net/ | gc                |                            |                     |        |       |                  |                       |                      |                       |                     |
        | Open Eyes Session  |  RobotAppEyes_Test |  NaviNet_RobotAppEyes_Test |  YourApplitoolsKey  |  1024  |  768  |  OSOverrideName  |  BrowserOverrideName  |  matchlevel=LAYOUT   |  includeEyesLog=True  |  httpDebugLog=True  |
        | Check Eyes Window  |  NaviNet Home            |                   |                            |                     |        |       |                  |                       |                      |                       |                     |
        | Close Eyes Session |  False                   |                   |                            |                     |        |       |                  |                       |                      |                       |                     |

        """
        global driver
        global eyes
        eyes = Eyes()
        eyes.api_key = apikey
        s2l = BuiltIn().get_library_instance('Selenium2Library')
        webdriver = s2l._current_browser()
        driver = webdriver

        if includeEyesLog is True:
            logger.set_logger(StdoutLogger())
            logger.open_()
        if httpDebugLog is True:
            httplib.HTTPConnection.debuglevel = 1
        if osname is not None:
            eyes.host_os = osname  # (str)
        if browsername is not None:
            eyes.host_app = browsername  # (str)
        if baselineName is not None:
            eyes.baseline_name = baselineName  # (str)
        if batchName is not None:
            batch = BatchInfo(batchName)
            eyes.batch = batch
        if matchlevel is not None:
            eyes.match_level = matchlevel
        if parentbranch is not None:
            eyes.parent_branch_name = parentbranch  # (str)
        if branchname is not None:
            eyes.branch_name = branchname  # (str)
        if width is None and height is None:
            eyes.open(driver, appname, testname)
        else:
            intwidth = int(width)
            intheight = int(height)
            eyes.open(driver, appname, testname, {
                'width': intwidth,
                'height': intheight
            })
from selenium import webdriver
from applitools.eyes import Eyes

eyes = Eyes()
# This is your api key, make sure you use it in all your tests.
eyes.api_key = 'YOUR_API_KEY'

# Get a selenium web driver object.
desired_cap = webdriver.DesiredCapabilities.FIREFOX
driver = webdriver.Remote(
    command_executor=
    'http://*****:*****@ondemand.saucelabs.com:80/wd/hub',
    desired_capabilities=desired_cap)

try:
    # Start visual testing with browser viewport set to 1024x768.
    # Make sure to use the returned driver from this point on.
    driver = eyes.open(driver=driver,
                       app_name='Applitools',
                       test_name='Test Web Page',
                       viewport_size={
                           'width': 1024,
                           'height': 768
                       })
    driver.get('http://www.applitools.com')

    # Visual validation point #1
    eyes.check_window('Main Page')

    driver.find_element_by_css_selector('.features>a').click()