class EightDays:
    def __init__(self, testname):
        self.eyes = Eyes()
        self.eyes.api_key = 'IlUcgRAO105BlmoORdtUxbK8CUKg3KRSa8q4f3iACoY1I110'

        desired_caps = {
            "platformName": 'Android',
            "platformVersion": '8.0.0',
            "deviceName": "Android Emulator",
            "automationName": "UiAutomator2",
            # "nativeWebScreenshot": "True",
            "app": 'C:/Users/Tea/Desktop/BCA/8Days/Automated/mobile.apk'
        }

        # need to start appium or this won't happen
        self.wd = webdriver.Remote("http://127.0.0.1:4723/wd/hub", desired_caps)
        # 127.0.0.1 is your localhost and 4723 is the port
        # http://localhost:4723/wd/hub
        self.wd.implicitly_wait(10)  # wait for the page to load
        self.eyes.open(driver=self.wd, app_name='8days', test_name=testname)
        # The string passed to checkWindow() is typically a descriptive name that identifies the checkpoint.

    def select_language(self):
        self.wd.find_element_by_id("kr.co.the8days.dev:id/radioEnglish").click()
        self.wd.find_element_by_id("kr.co.the8days.dev:id/btnNext").click()

        sleep(2)
        self.wd.hide_keyboard()

    def find_login_fields(self):
        self.userField = self.wd.find_element_by_id("kr.co.the8days.dev:id/edtSignInEmail")
        self.pwField = self.wd.find_element_by_id("kr.co.the8days.dev:id/edtSignInPassword")
        self.login_btn = self.wd.find_element_by_id("kr.co.the8days.dev:id/btnSignIn")

    def basic_login(self):
        self.find_login_fields()

        self.userField.send_keys("*****@*****.**")
        self.pwField.click()
        self.delete_field(self.pwField)

        self.pwField.send_keys("golden1")
        self.login_btn.click()

    '''general functions'''

    def delete_field(self, field):
        actions = TouchAction(self.wd)
        actions.long_press(field).release().perform()
        self.wd.press_keycode(67)

    def screenshot(self, name):
        self.eyes.check_window(name)

    def click_by_id(self, id):
        self.wd.find_element_by_id(id).click()
Beispiel #2
0
 def setUp(self):
     desired_caps = {}
     desired_caps["app"] = "Microsoft.WindowsCalculator_8wekyb3d8bbwe!App"
     self.driver = webdriver.Remote(
         command_executor='http://127.0.0.1:4723',
         desired_capabilities=desired_caps)
     self.eyes = Eyes()
     self.eyes.api_key = "your_applitools_key"
     self.driver.set_window_size(
         700, 700)  #set size for responsive design testing...
Beispiel #3
0
class Test(unittest.TestCase):
    eyes = 0
    driver = 0

    def setUp(self):
        self.eyes = Eyes()
        self.eyes.api_key = APPLITOOLS_APIKEY
        self.driver = webdriver.Firefox()

    def tearDown(self):
        self.eyes.abort_if_not_closed()
        self.driver.quit()

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

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

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

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

        # End visual testing. Validate visual correctness.
        self.eyes.close()
class Test(unittest.TestCase):
    eyes = 0
    driver = 0

    def setUp(self):
        self.eyes = Eyes()
        self.eyes.api_key = APPLITOOLS_APIKEY
        self.driver = webdriver.Firefox()

    def tearDown(self):
        self.eyes.abort_if_not_closed()
        self.driver.quit()

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

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

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

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

        # End visual testing. Validate visual correctness.
        self.eyes.close()
Beispiel #5
0
    def __init__(self, mode, path):
        self.eyes = Eyes()
        self.eyes.api_key = 'mHHQDYWEGS5AGbjfNoVO1h4oi15w3jiQ4q9DPagYJBA110'

        if mode == 'local':
            self.driver = webdriver.Chrome(path)
        elif mode == 'docker-chrome':
            self.driver = webdriver.Remote(
                command_executor='http://127.0.0.1:32768/wd/hub',
                desired_capabilities={'browserName': 'chrome'},
            )
Beispiel #6
0
 def setUp(self):
     self.eyes = Eyes("https://localhost.applitools.com")
     self.eyes.api_key = os.environ['APPLITOOLS_API_KEY']
     sauce_url = "http://%s:%[email protected]:80/wd/hub"
     caps = webdriver.DesiredCapabilities.CHROME
     caps['screen-resolution'] = "1280x1024"
     caps['platform'] = "Windows 8"
     sauce_user = os.environ['SAUCELABS_USER']
     sauce_key = os.environ['SAUCELABS_KEY']
     self.driver = webdriver.Remote(desired_capabilities=caps,
                                    command_executor=sauce_url %
                                    (sauce_user, sauce_key))
Beispiel #7
0
def test_server_connector(driver):
    eyes = Eyes('https://localhost.applitools.com')
    driver = eyes.open(driver, "Python SDK", "TestDelete", {'width': 800, 'height': 599})
    driver.get("https://applitools.com/helloworld")
    eyes.check("Hello", Target.window())
    results = eyes.close()
    results.delete()
    eyes.abort_if_not_closed()
Beispiel #8
0
    def __init__(self, *args, **kwargs):
        super(TestAuthenticationPages, self).__init__(*args, **kwargs)
        self.__login = LoginPage()
        self.__register = RegisterPage()
        self.__forgot_password = ForgotPasswordPage()

        self.__data = DataGenerateUtils()
        self.valid_email = self.__data.create_email()
        self.valid_username = self.__data.create_name()
        self.valid_password = self.__data.create_password()

        self.bot_name = "Test"
        self.invalid_faq = "google.com"
        self.eyes = Eyes()
        self.eyes.api_key = YAML_CONFIG.get("eyes_api_key")
class Bootstrap:
    eyes = Eyes()

    eyes.api_key = ''  # Enter your "API" key here from applitools.

    try:
        driver = webdriver.Chrome()

        eyes.open(driver=driver,
                  app_name='Bootstrap',
                  test_name='Selenium Python Test',
                  viewport_size={
                      'width': 1024,
                      'height': 640
                  })

        driver.get('index.html')

        eyes.check_window('Load')

        eyes.close()
    finally:
        driver.quit()

        eyes.abort_if_not_closed()
Beispiel #10
0
class Bootstrap:
  enable_eyes = True

  # Initialize Eyes
  if enable_eyes:
    eyes = Eyes()
    eyes.api_key = '' # your API key on Applitools, explained on an earlier chapter.
    eyes.force_full_page_screenshot = True
    
    # Force stitching of screenshots on pages where floating elements might appear twice on the screenshot
    # Note that this functionality is not perfect and fails miserably on a sticky header that resizes later in the scroll.
    eyes.stitch_mode = StitchMode.CSS

  # Configure Chrome
  options = webdriver.ChromeOptions()
  options.add_argument("--disable-infobars")
  caps = options.to_capabilities()
  
  desired_cap = {
    'browser': 'Chrome',
    'browser_version': '62.0',
    'os': 'Windows',
    'os_version': '10',
    'resolution': '1920x1080'
  }

  # Merge Chrome Settings
  caps.update(desired_cap)

  try:
    # Setup WebDriver object to access remote device.
    driver = webdriver.Remote(
      command_executor='', # your "API Key" on BrowserStack.
      desired_capabilities=caps
    )

    # Maximize Window
    driver.maximize_window()

    # Define the test
    if enable_eyes:
      eyes.open(
        driver=driver,
        app_name='Bootstrap',
        test_name='Selenium Python Test'
      )

    driver.get('') # put the url to test here.
    
    if enable_eyes: eyes.check_window('Load')

    # Close Eyes
    if enable_eyes: eyes.close()
  finally:
    # End the tests
    driver.quit()

    if enable_eyes: eyes.abort_if_not_closed()
 def setUp(self):
     self.eyes = Eyes("https://localhost.applitools.com")
     self.eyes.api_key = os.environ['APPLITOOLS_API_KEY']
     sauce_url = "http://%s:%[email protected]:80/wd/hub"
     caps = webdriver.DesiredCapabilities.CHROME
     caps['screen-resolution'] = "1280x1024"
     caps['platform'] = "Windows 8"
     sauce_user = os.environ['SAUCELABS_USER']
     sauce_key = os.environ['SAUCELABS_KEY']
     self.driver = webdriver.Remote(
         desired_capabilities=caps,
         command_executor=sauce_url % (sauce_user, sauce_key))
Beispiel #12
0
class Unitest(unittest.TestCase):
    eyes = 0
    driver = 0

    def setUp(self):
        self.eyes = Eyes("https://localhost.applitools.com")
        self.eyes.api_key = os.environ['APPLITOOLS_API_KEY']
        sauce_url = "http://%s:%[email protected]:80/wd/hub"
        caps = webdriver.DesiredCapabilities.CHROME
        caps['screen-resolution'] = "1280x1024"
        caps['platform'] = "Windows 8"
        sauce_user = os.environ['SAUCELABS_USER']
        sauce_key = os.environ['SAUCELABS_KEY']
        self.driver = webdriver.Remote(desired_capabilities=caps,
                                       command_executor=sauce_url %
                                       (sauce_user, sauce_key))

    def tearDown(self):
        self.eyes.abort_if_not_closed()
        self.driver.quit()

    def test(self):
        # Start visual testing with browser viewport set to 1024x768.
        # Make sure to use the returned driver from this point on.
        self.driver = self.eyes.open(driver=self.driver,
                                     app_name='Saucelabs',
                                     test_name='Saucelabs test',
                                     viewport_size={
                                         'width': 1100,
                                         'height': 600
                                     })
        self.driver.get('https://saucelabs.com')

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

        menu_items = ['Features', 'Pricing', 'Enterprise', 'Docs']
        for item in menu_items:
            self.driver.find_element_by_xpath("//a[contains(.,'" + item +
                                              "')]").click()
            # Visual validation point
            self.eyes.check_window(item)

        # End visual testing. Validate visual correctness.
        self.eyes.close()
    def setup(self, test_registration=False):
        self.eyes = Eyes()
        self.eyes.api_key = 'IlUcgRAO105BlmoORdtUxbK8CUKg3KRSa8q4f3iACoY1I110'
        self.driver = webdriver.Chrome(r"C:\Users\Tea\Desktop\chromedriver_win32 (1)\chromedriver.exe")

        self.eyes.open(driver=self.driver, app_name='Hello World!', test_name='eventScheduler')
        self.driver.get('http://*****:*****@mymail.sutd.edu.sg'
Beispiel #14
0
 def __init__(self, *args, **kwargs):
     super(TestAdminPages, self).__init__(*args, **kwargs)
     self.__data = DataGenerateUtils()
     self.__login = LoginPage()
     self.__create_bot = CreateBotPage()
     self.__register = RegisterPage()
     self.__dashboard = DashboardPage()
     self.__appearance = AppearancePage()
     self.__create_bot_validation = CreateBotValidation()
     self.__drop_down_list = DropDownList()
     self.__change_password = ChangePasswordPage()
     self.__knowledge = KnowledgePage()
     self.__data_set = DataUtils()
     self.__faq_knowledge_data_table_component = FaqKnowledgeDataTableComponent(
     )
     self.valid_email = self.__data.create_email()
     self.valid_username = self.__data.create_name()
     self.valid_password = self.__data.create_password()
     self.bot_name = "Test"
     self.invalid_faq = "google.com"
     self.eyes = Eyes()
     self.eyes.api_key = YAML_CONFIG.get("eyes_api_key")
     self.eyes.force_full_page_screenshot = True
     self.eyes.stitch_mode = StitchMode.CSS
Beispiel #15
0
class HelloWorld:

    # Initialize the eyes SDK and set your private API key.
    eyes = Eyes()
    eyes.api_key = 'BILoo102mY17vGUvaPXz0jsJiKD8SbdgSz5W101102DaAXmQw110'

    # Set the desired capapbilities.

    desiredCapabilities = {}
    DesiredCapabilities['platformName'] = 'iOS'
    DesiredCapabilities['browserName'] = 'Safari'
    DesiredCapabilities['deviceName'] = 'DEVICE_NAME'
    DesiredCapabilities['platformVersion'] = '10.1'
    #desired_caps['automationName'] = 'XCUITest' # Possible to run without.

    # Open browser
    driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub',
                              desiredCapabilities)

    try:

        # Start the test.
        eyes.open(driver=driver,
                  app_name='Hello World!',
                  test_name='My first Appium web Python test!')

        # Navigate the browser to the "Hello World!" web-site.
        driver.get(r'https://applitools.com/helloworld')

        # Visual validation point #1.
        eyes.check_window('Hello!')

        # Click the "Click me!" button.
        driver.find_element_by_tag_name('button').click()

        # Visual validation #2.
        eyes.check_window('Click!')

        # End the test.
        eyes.close()

    finally:

        # Close the browser.
        driver.quit()

        # If the test was aborted before eyes.Close was called, end the test as aborted.
        eyes.abort_if_not_closed()
class Unitest(unittest.TestCase):
    eyes = 0
    driver = 0

    def setUp(self):
        self.eyes = Eyes("https://localhost.applitools.com")
        self.eyes.api_key = os.environ['APPLITOOLS_API_KEY']
        sauce_url = "http://%s:%[email protected]:80/wd/hub"
        caps = webdriver.DesiredCapabilities.CHROME
        caps['screen-resolution'] = "1280x1024"
        caps['platform'] = "Windows 8"
        sauce_user = os.environ['SAUCELABS_USER']
        sauce_key = os.environ['SAUCELABS_KEY']
        self.driver = webdriver.Remote(
            desired_capabilities=caps,
            command_executor=sauce_url % (sauce_user, sauce_key))

    def tearDown(self):
        self.eyes.abort_if_not_closed()
        self.driver.quit()

    def test(self):
        # Start visual testing with browser viewport set to 1024x768.
        # Make sure to use the returned driver from this point on.
        self.driver = self.eyes.open(
            driver=self.driver, app_name='Saucelabs', test_name='Saucelabs test',
            viewport_size={'width': 1100, 'height': 600})
        self.driver.get('https://saucelabs.com')

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

        menu_items = ['Features', 'Pricing', 'Enterprise', 'Docs']
        for item in menu_items:
            self.driver.find_element_by_xpath("//a[contains(.,'" + item + "')]").click()
            # Visual validation point
            self.eyes.check_window(item)

        # End visual testing. Validate visual correctness.
        self.eyes.close()
Beispiel #17
0
class HelloWorld:

    eyes = Eyes()

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

    try:

        # Open a Chrome browser.
        driver = webdriver.Chrome()

        # Start the test and set the browser's viewport size to 800x600.
        eyes.open(driver=driver,
                  app_name='Google Test',
                  test_name='My first Selenium Python test!',
                  viewport_size={
                      'width': 800,
                      'height': 600
                  })

        # Navigate the browser to the "hello world!" web-site.
        driver.get('https://www.google.lk')

        # Visual checkpoint #1.
        eyes.check_window('Google')

        # Click the 'Click me!' button.
        driver.find_element_by_id('lst-ib').send_keys('Selenium')
        driver.find_element_by_id('hplogo').click()

        # Visual checkpoint #2.
        eyes.check_window('Google')

        # End the test.
        eyes.close()

    finally:

        # Close the browser.
        driver.quit()

        # If the test was aborted before eyes.close was called, ends the test as aborted.
        eyes.abort_if_not_closed()
Beispiel #18
0
class Driver(object):
    def __init__(self, mode, path):
        self.eyes = Eyes()
        self.eyes.api_key = 'mHHQDYWEGS5AGbjfNoVO1h4oi15w3jiQ4q9DPagYJBA110'

        if mode == 'local':
            self.driver = webdriver.Chrome(path)
        elif mode == 'docker-chrome':
            self.driver = webdriver.Remote(
                command_executor='http://127.0.0.1:32768/wd/hub',
                desired_capabilities={'browserName': 'chrome'},
            )

    def open(self):
        self.eyes.open(driver=self.driver,
                       app_name='Creative_Factory',
                       test_name='Auto Regression Test')
        #viewport_size={'width': 800,'height': 600})

    def check_window(self, text):
        self.eyes.check_window(text)

    def get_url(self, url):
        try:
            self.driver.get(url)
        except BaseException as e:
            print(e)

    def add_cookie(self, cookies):
        self.driver.add_cookie(cookie_dict=cookies)

    def find_by_class(self, classname):
        try:
            return self.driver.find_element_by_class_name(classname)
        except BaseException as e:
            print(e)

    def set_size(self):
        self.driver.set_window_size(800, 600)

    def click_elem(self, elem):
        try:
            elem.click()
        except BaseException as e:
            print(e)

    def close(self):
        self.driver.close()

    def eye_close(self):
        self.eyes.close()
class Helloworld:

    eyes = Eyes()

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

    try:

        # Open a Chrome browser.
        driver = webdriver.Chrome("../drivers/chromedriver.exe")

        # Start the test and set the browser's viewport size to 800x600.
        eyes.open(driver=driver,
                  app_name='Hello World!',
                  test_name='My first Selenium Python test!',
                  viewport_size={
                      'width': 800,
                      'height': 600
                  })

        # Navigate the browser to the "hello world!" web-site.
        driver.get('https://applitools.com/helloworld')

        # Visual checkpoint #1.
        eyes.check_window('Hello!')

        # Click the 'Click me!' button.
        driver.find_element_by_css_selector('button').click()

        # Visual checkpoint #2.
        eyes.check_window('Click!')

        # End the test.
        eyes.close()

    finally:

        # Close the browser.
        driver.quit()

        # If the test was aborted before eyes.close was called, ends the test as aborted.
        eyes.abort_if_not_closed()
    def __init__(self, testname):
        self.eyes = Eyes()
        self.eyes.api_key = 'IlUcgRAO105BlmoORdtUxbK8CUKg3KRSa8q4f3iACoY1I110'

        desired_caps = {
            "platformName": 'Android',
            "platformVersion": '8.0.0',
            "deviceName": "Android Emulator",
            "automationName": "UiAutomator2",
            # "nativeWebScreenshot": "True",
            "app": 'C:/Users/Tea/Desktop/BCA/8Days/Automated/mobile.apk'
        }

        # need to start appium or this won't happen
        self.wd = webdriver.Remote("http://127.0.0.1:4723/wd/hub", desired_caps)
        # 127.0.0.1 is your localhost and 4723 is the port
        # http://localhost:4723/wd/hub
        self.wd.implicitly_wait(10)  # wait for the page to load
        self.eyes.open(driver=self.wd, app_name='8days', test_name=testname)
__author__ = 'Roysten'

from selenium import webdriver
from applitools.eyes import Eyes
from selenium.webdriver.common.action_chains import ActionChains
import time


def hover_over_hamburger(driver):
    hamburger = driver.find_element_by_xpath("//div[@class='menu-bars-outer']/a/i")
    ActionChains(driver).move_to_element(hamburger).perform()

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

try:
    eyes.open(driver=driver, app_name='itailor', test_name='itailors')
    driver.get('http://tailor.managedcoder.com/')
    hover_over_hamburger(driver)
    #clicks on login/register link
    driver.find_element_by_xpath("//div[@class='menu-bars-item menu-bars-account']/ul/li[5]/a").click()

    #enter login credentails
    driver.find_element_by_xpath("//input[@id='username']").send_keys("*****@*****.**")
    driver.find_element_by_xpath("//input[@id='password']").send_keys("rash0207")
    driver.find_element_by_xpath("//input[@class='btn btn-default']").click()
    #check account page
    eyes.check_window("my account page")
    #check edit account page
#!/usr/bin/env python

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

eyes = Eyes()
Eyes.api_key = 'VOfLF4XBAbbMmsOLf0BxDx4APw7gCynQz7NjZwRG1076g110'
logger.set_logger(StdoutLogger())
driver = webdriver.Firefox()
driver.implicitly_wait(10)
driver = eyes.open(driver=driver, app_name='Home Reach', test_name='Login to Dash', viewport_size={'width': 1024, 'height': 600})

def userLogin():

    driver.get("https://homereach.aminocom.com")
    # Visual validation point #2
    eyes.check_window('Login')
    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()
    
    try:
__author__ = 'Roysten'


from selenium import webdriver
from applitools.eyes import Eyes
from selenium.webdriver.common.action_chains import ActionChains
import time


def hover_over_hamburger(driver):
    hamburger = driver.find_element_by_xpath("//div[@class='menu-bars-outer']/a/i")
    ActionChains(driver).move_to_element(hamburger).perform()

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

try:
    eyes.open(driver=driver, app_name='itailor', test_name='itailors')

    #homepage_new_arrivals
    driver.get('http://tailor.managedcoder.com/')
    eyes.check_window("homepage_new_arrivals")

    #homepage_hot_products
    driver.find_element_by_xpath("//div[@class='entry-content clearfix']/div[2]/div/div/div/div/div/ul/li[1]/a").click()
    eyes.check_window("homepage_hot_products")

    #homepage_best_Sellers
    driver.find_element_by_xpath("//div[@class='entry-content clearfix']/div[2]/div/div/div/div/div/ul/li[3]/a").click()
Beispiel #24
0
    def open_eyes_session(
        self,
        apikey=None,
        appname=None,
        testname=None,
        library=None,
        width=None,
        height=None,
        osname=None,
        browsername=None,
        matchlevel=None,
        enable_eyes_log=None,
        enable_http_debug_log=None,
        baselinename=None,
        batch=None,
        branchname=None,
        parentbranch=None,
        serverurl=None,
        force_full_page_screenshot=None,
        stitchmode=None,
        matchtimeout=None,
        hidescrollbars=None,
        save_new_tests=None,
        wait_before_screenshots=None,
        send_dom=None,
        stitchcontent=False,
        isdisabled=None,
    ):
        """
        Starts a session (=test) with Applitools.

        Some of the following arguments may also be defined on library import.
        See `Before running tests` or `Importing`.

            | =Arguments=                       | =Description=                                                                                                                               |
            | API Key (str)                     | *Mandatory* - User's Applitools Eyes key                                                                                                    |
            | Application Name (str)            | *Mandatory* - The name of the application under test                                                                                        |
            | Test Name (str)                   | *Mandatory* - The test name                                                                                                                 |  
            | Library (str)                     | Library to test (Either SeleniumLibrary or AppiumLibrary)                                                                                   |
            | Width (int)                       | The width of the browser window e.g. 1280                                                                                                   |
            | Height (int)                      | The height of the browser window e.g. 1000                                                                                                  |
            | Operating System (str)            | The operating system of the test, can be used to override the OS name to allow cross OS verification                                        |
            | Browser Name (str)                | The browser name for the test, can be used to override the browser name to allow cross browser verification                                 |
            | Match Level (str)                 | The match level for the comparison of this test's checkpoints - can be STRICT, LAYOUT, CONTENT or EXACT                                     |
            | Enable Eyes Log (bool)            | Determines if the trace logs of Applitools Eyes SDK are activated for this session                                                          |
            | Enable HTTP Debug Log (bool)      | The HTTP Debug logs will not be included by default. To activate, pass 'True' in the variable                                               |
            | Baseline Name (str)               | Name of the branch where the baseline reference will be taken from and where new and accepted steps will be saved to                        |
            | Batch (str or BatchInfo)          | The desired batch. See `Group tests into batches`                                                                                           |
            | Branch Name (str)                 | The branch to use to check test                                                                                                             |
            | Parent Branch (str)               | Parent Branch to base the new Branch on                                                                                                     |
            | Server URL (str)                  | The URL of the Eyes server. If not provided then your test will run on the public cloud                                                     |
            | Force Full Page Screenshot (bool) | Will force the browser to take a screenshot of whole page                                                                                   |
            | Stitch Mode (str)                 | Type of stitching used for full page screenshots - can be CSS or SCROLL                                                                     |
            | Match Timeout (int)               | Determines how much time in milliseconds Eyes continues to retry the matching before declaring a mismatch on this test checkpoints          |
            | Hide Scrollbars (bool)            | Sets if the scrollbars are hidden this session's tests, by passing 'True' or 'False' in the variable                                        |
            | Save New Tests (bool)             | Sets if the new checkpoints on this session are automatically accepted, by passing 'True' or 'False' in the variable                        |
            | Wait Before Screenshots (int)     | Determines the number of milliseconds that Eyes will wait before capturing a screenshot on this test checkpoints                            |
            | Send DOM (bool)                   | Sets if DOM information should be sent for this session's checkpoints                                                                       |    
            | Stitch Content (bool)             | If this test checkpoint's elements/region are scrollable, determines if Eyes will scroll this them to take a full region/element screenshot |    
            | Is Disabled (bool)                | Determines whether or not interactions with Eyes will be silently ignored for this test                                                     |    

        *Mandatory Arguments:* They may be defined through this keyword, or when importing the library.
        In order to run a test, provide at least the API Key, Application Name and Test Name.
 
        When opening the session on a mobile browser or hybrid app, the context must be set to WEBVIEW in order to retrieve the correct viewport size. Geolocation of the device may have to be set after switching context.

        *Example:*                                                                                                                                                                                                                               
            | Open Eyes Session | YourApplitoolsKey | AppName | TestName | SeleniumLibrary | 1024 | 768 | OSOverrideName | BrowserOverrideName | layout | ${true} | batchname=BatchName | serverurl=https://myserver.com |
        """

        if appname is None:
            appname = self.library_arguments["appname"]
        if testname is None:
            testname = self.library_arguments["testname"]
        if apikey is None:
            apikey = self.library_arguments["apikey"]
        if library is None:
            library = self.library_arguments["library"]
        if osname is None:
            osname = self.library_arguments["osname"]
        if browsername is None:
            browsername = self.library_arguments["browsername"]
        if matchlevel is None:
            matchlevel = self.library_arguments["matchlevel"]
        if enable_eyes_log is None:
            enable_eyes_log = self.library_arguments["enable_eyes_log"]
        if serverurl is None:
            serverurl = self.library_arguments["serverurl"]
        if save_new_tests is None:
            save_new_tests = self.library_arguments["save_new_tests"]
        if matchtimeout is None:
            matchtimeout = self.library_arguments["matchtimeout"]

        if serverurl is None:
            variables.eyes = Eyes()
        else:
            variables.eyes = Eyes(serverurl)

        variables.eyes.api_key = apikey

        try:
            libraryInstance = BuiltIn().get_library_instance(library)

            if library == "AppiumLibrary":
                driver = libraryInstance._current_application()
            else:
                driver = libraryInstance._current_browser()
        except RuntimeError:
            raise Exception("%s instance not found" % library)

        utils.manage_logging(enable_eyes_log, enable_http_debug_log)

        if osname is not None:
            variables.eyes.host_os = osname
        if browsername is not None:
            variables.eyes.host_app = browsername
        if baselinename is not None:
            variables.eyes.baseline_branch_name = baselinename
        if batch is not None:
            if type(batch) is six.text_type:
                batch = str(batch)
            batches_list = variables.batches

            # If batch argument is string
            if isinstance(batch, str):
                # Check for batch with same name
                for batch_element in batches_list:
                    if batch_element.name == batch:
                        variables.eyes.batch = batch_element
                        break
                # If a batch with this name is not yet on the list
                if variables.eyes.batch is None:
                    new_batch = BatchInfo(batch)
                    variables.eyes.batch = new_batch
                    variables.batches.append(new_batch)
            # If batch argument is BatchInfo
            else:
                # Check for batch with same name and date
                for batch_element in batches_list:
                    if (
                        batch_element.name == batch.name
                        and batch_element.started_at == batch.started_at
                    ):
                        variables.eyes.batch = batch_element
                        break
                # If the list doesn't contain a batch with the same name and date
                if variables.eyes.batch is None:
                    variables.eyes.batch = batch
                    variables.batches.append(batch)

        if matchlevel is not None:
            variables.eyes.match_level = utils.get_match_level(matchlevel)
        if parentbranch is not None:
            variables.eyes.parent_branch_name = parentbranch
        if branchname is not None:
            variables.eyes.branch_name = branchname
        if osname is not None:
            variables.eyes.host_os = osname
        if stitchmode is not None:
            variables.eyes.stitch_mode = utils.get_stitch_mode(stitchmode)
        if matchtimeout is not None:
            variables.eyes.match_timeout = int(matchtimeout)
        if force_full_page_screenshot is not None:
            variables.eyes.force_full_page_screenshot = force_full_page_screenshot
        if save_new_tests is not None:
            variables.eyes.save_new_tests = save_new_tests
        if wait_before_screenshots is not None:
            variables.eyes.wait_before_screenshots = int(wait_before_screenshots)
        if send_dom is not None:
            variables.eyes.send_dom = send_dom
        if stitchcontent is not False:
            variables.stitchcontent = stitchcontent

        if width is None and height is None:
            variables.driver = variables.eyes.open(driver, appname, testname)
        else:
            variables.driver = variables.eyes.open(
                driver, appname, testname, {"width": int(width), "height": int(height)}
            )

        # Workaround - This property has to be called after opening session
        # Otherwise, the checks will throw exceptions
        if isdisabled is not None:
            variables.eyes.is_disabled = isdisabled
class Page(_BaseActions, _SelectorsManager, _ComponentsManager):
    """
    This is the base Page Object from which all other Page Objects should inherit.
    It contains all base Selenium2Library actions and browser-wrapping behavior
    used by this class and its descendents.

    It is a robotframework library which implements the dynamic API.
    """
    __metaclass__ = _PageMeta
    ROBOT_LIBRARY_SCOPE = 'TEST SUITE'
    _attempt_sauce = False
    _attempt_remote = False
    _attempt_eyes = False
    eyes = Eyes()
    _total_eyes_elapsed = 0
    _min_eyes_elapsed = 999999
    _max_eyes_elapsed = 0

    def __init__(self):
        """
        Initializes the pageobject_name variable, which is used by the _Keywords class
        for determining aliases.
        """
        for base in Page.__bases__:
            base.__init__(self)
        self.browser = self._option_handler.get("browser") or "phantomjs"
        self.service_args = self._parse_service_args(self._option_handler.get("service_args", ""))
        self.remote_url = self._option_handler.get("remote_url")
        self.eyes_apikey = self._option_handler.get("eyes_apikey")
        self.eyes_batch = self._option_handler.get("eyes_batch")
        self.eyes_id = self._option_handler.get("eyes_id")
        self.suite_name = self._option_handler.get('suite_name')

        if self.remote_url != None:
            if self.remote_url.find('saucelabs.com') > -1:
                self._sauce_options = [
                    "sauce_username",
                    "sauce_apikey",
                    "sauce_platform",
                    "sauce_browserversion",
                    "sauce_device_orientation",
                    "sauce_screenresolution",
                    "sauce_tunnel_id",
                    "sauce_parent_tunnel",
                ]
                for sauce_opt in self._sauce_options:
                    setattr(self, sauce_opt, self._option_handler.get(sauce_opt))

                self._attempt_sauce = self._validate_sauce_options()
            else:
                self._attempt_remote = True

        if self.eyes_apikey != None:
            self._attempt_eyes = True
            self.eyes.api_key = self.eyes_apikey
            if not (self._attempt_sauce and self.browser == "internetexplorer"):
                self.eyes.force_full_page_screenshot = True
                self.eyes.stitch_mode = StitchMode.CSS
            if self.eyes_batch == None: self.eyes_batch = self.suite_name
            if self.eyes_id == None: self.eyes_id = uuid4().__str__()
            if self.eyes.batch == None:
                self.eyes.batch = BatchInfo(self.eyes_batch)
                self.eyes.batch.id_ = self.eyes_id

        self._Capabilities = getattr(webdriver.DesiredCapabilities, self.browser.upper())
        for cap in self._Capabilities:
            new_cap = self._option_handler.get(cap)
            if new_cap is not None:
                self._Capabilities[cap] = new_cap

        if self.browser == "chrome":
            opts = ChromeOptions()
            opts.add_argument("--disable-infobars")
            opts.add_argument("--disable-popups")
            opts.add_argument("--disable-save-password-bubble")
            opts.add_argument("--disable-extensions")
            opts.add_experimental_option('prefs', {'credentials_enable_service': False,
                                                   'profile': {'password_manager_enabled': False}})
            self._Capabilities.update(opts.to_capabilities())

        if self.browser == "internetexplorer":
            self._Capabilities.update(
                {
                    "requireWindowFocus": True,
                }
            )

        # There's only a session ID when using a remote webdriver (Sauce, for example)
        self.session_id = None

        # If a name is not explicitly set with the name attribute,
        # get it from the class name.
        try:
            self.name
        except AttributeError:
            self.name = self._titleize(self.__class__.__name__)

        # Allow setting of uri_template or uri, but make them the same internally
        if hasattr(self, 'uri_template'):
            self.uri = self.uri_template
        # Set a default uri in case one is not set in the Page
        elif not hasattr(self, 'uri'):
            self.uri = '/'

    @staticmethod
    @not_keyword
    def _titleize(str):
        """
        Converts camel case to title case
        :param str: camel case string
        :return: title case string
        """
        return re.sub('([a-z0-9])([A-Z])', r'\1 \2', re.sub(r"(.)([A-Z][a-z]+)", r'\1 \2', str))

    @staticmethod
    @not_keyword
    def _underscore(str):
        return re.sub(r"\s+", "_", str)

    @not_keyword
    def get_keyword_names(self):
        """
        RF Dynamic API hook implementation that provides a list of all keywords defined by
        the implementing class. NB that this will not expose Selenium2Library's keywords.
        That is done (in Robot) by programmatically importing Selenium2Library. See __init__
        in _S2LWrapper.
        This method uses the _Keywords class to handle exclusions and aliases.
        :returns: list
        """

        # Return all method names on the class to expose keywords to Robot Framework
        keywords = []
        # members = inspect.getmembers(self, inspect.ismethod)

        # Look through our methods and identify which ones are Selenium2Library's
        # (by checking it and its base classes).
        for name in dir(self):
            is_keyword = _Keywords.is_obj_keyword_by_name(name, self)
            if is_keyword:
                obj = getattr(self, name)
                in_s2l_base = False
                try:
                    func = obj.__func__  # Get the unbound function for the method
                except AttributeError:
                    # ignore static methods included in libraries
                    continue
                # Check if that function is defined in Selenium2Library
                if func not in self.__class__.__dict__.values():
                    if name in Selenium2Library.__dict__.keys():
                        in_s2l_base = True
                    else:
                        # Check if the function is defined in any of Selenium2Library's direct base classes.
                        # Note that this will not check those classes' ancestors.
                        # TODO: Check all S2L's ancestors. DCLT-
                        for base in Selenium2Library.__bases__:
                            if name in base.__dict__.keys():
                                in_s2l_base = True
                # Don't add methods belonging to S2L to the exposed keywords.
                if in_s2l_base and (in_ld or _Keywords.has_registered_s2l_keywords):
                    continue
                elif inspect.ismethod(obj) and not name.startswith("_") and not _Keywords.is_method_excluded(name):
                    # Add all methods that don't start with an underscore and were not marked with the
                    # @not_keyword decorator.
                    if not in_ld:
                        keywords += _Keywords.get_robot_aliases(name, self._underscore(self.name))
                    else:
                        keywords.append(name)
        _Keywords.has_registered_s2l_keywords = True

        return keywords

    def _attempt_screenshot(self):
        try:
            self.capture_page_screenshot()
        except Exception, e:
            if e.message.find("No browser is open") != -1:
                pass
Beispiel #26
0
class lillyApp():
    # gloabal variables for the methods
    desired_caps = dict(
        platformName='Android',
        deviceName='Galaxy S8',
        platformVersion='8.0.0',
        app=
        'C:\\Users\\chris.dewing\\Desktop\\lillydevicetestapp-1.6-release (1).apk'
        # app_package = "com.lilly.ddcs.lillydevicetestapp",
        # app_activity = 'com.lilly.ddcs.lillydevicetestapp.TestActivity'
    )
    # Open the app.
    wd = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
    wd.implicitly_wait(10)

    # Initialize the eyes SDK and set your private API key.
    eyes = Eyes()
    eyes.api_key = 'lDFzChp3PyMmFF1KVoNlgU2NMG108tWfUHBlItYgC0njA110'

    reportDirectory = 'reports'
    reportFormat = 'xml'
    dc = {}
    testName = 'Untitled'
    driver = None

    def num2buttonclick(self):
        self.wd.find_element_by_xpath("xpath=//*[@text='NUM 2']").click()
        self.wd.find_element_by_xpath("xpath=//*[@text='NUM 1']").click()

    # This method connects to bluetooth device and enables the greyed out buttons
    def enable_grey_buttons(self):
        self.wd.swipe(603, 546, 603, -53, 1349)
        self.wd.swipe(603, 1146, 610, 5978, 3738)
        self.wd.find_element_by_xpath("xpath=//*[@text='START SCAN']").click()
        self.wd.find_element_by_xpath(
            "xpath=//*[@text='Contour7830H5779094 (B0:91:22:FF:53:ED)']"
        ).click()
        self.wd.find_element_by_xpath("xpath=//*[@text='CONNECT']").click()

    # This method tests random buttons on the app
    def buttontest(self):
        self.wd.find_element_by_xpath("xpath=//*[@text='TEST CACHE']").click()
        self.wd.swipe(332, 1032, 332, 582, 682)
        self.wd.swipe(499, 1046, 496, 146, 680)
        self.wd.swipe(467, 1660, 467, 2260, 636)
        self.wd.find_element_by_xpath(
            "xpath=//*[@text='RETRIEVE NEW']").click()
        self.wd.swipe(239, 1946, 239, 2846, 791)
        self.wd.find_element_by_xpath(
            "xpath=//*[@text='RETRIEVE NEWEST']").click()
        self.wd.swipe(228, 2214, 224, 3110, 831)
        self.wd.find_element_by_xpath(
            "xpath=//*[@text='RETRIEVE FROM SEQ. #']").click()
        self.wd.swipe(264, 2253, 264, 3153, 675)
        WebDriverWait(self.wd, 10).until(
            expected_conditions.presence_of_element_located(
                (By.XPATH, '//*[@text="CLEAR CACHE"]')))
        self.wd.find_element_by_xpath("xpath=//*[@text='CLEAR CACHE']").click()
        self.wd.swipe(696, 1967, 696, 2867, 709)
        self.wd.find_element_by_xpath(
            "xpath=//*[@text='RETRIEVE ALL']").click()
        self.wd.swipe(782, 2053, 782, 2949, 678)
        self.wd.find_element_by_xpath(
            "xpath=//*[@text='RETRIEVE OLDEST']").click()
        self.wd.swipe(814, 2121, 814, 3021, 720)
        self.wd.find_element_by_xpath(
            "xpath=//*[@text='RETRIEVE SEQ. #']").click()
        self.wd.swipe(578, 1778, 578, 2678, 720)
        self.wd.swipe(578, 1778, 578, 1928, 582)
        self.wd.swipe(578, 1778, 578, 2528, 762)
        self.wd.swipe(578, 1178, 578, 578, 650)
        self.wd.find_element_by_xpath(
            "xpath=//*[@text='GET FEATURES']").click()
        self.wd.swipe(710, 1732, 703, 2474, 689)
        self.wd.find_element_by_xpath(
            "xpath=//*[@text='SHOW DEVICE INFO']").click()
        self.wd.swipe(496, 1646, 496, 1796, 586)
        self.wd.swipe(235, 996, 235, 696, 801)

    # This mehthod crashes the app
    def lilly_app_crash(self):
        self.wd.find_element_by_xpath(
            "xpath=//*[@text='INIT WITH MAC']").click()

    def enter_sequence_number(self):
        self.wd.swipe(332, 514, 332, -85, 669)
        self.wd.swipe(332, 514, 332, 214, 617)
        self.wd.swipe(457, 1282, 457, 982, 627)
        self.wd.find_element_by_xpath(
            "xpath=//*[@id='sequence_number_edit_text']").click()
        self.wd.find_element_by_xpath(
            "xpath=//*[@class='android.widget.LinearLayout' and ./*[@class='android.widget.FrameLayout' and ./*[@id='decor_content_parent']]]"
        ).click()
        self.wd.find_element_by_xpath("xpath=//*[@id='keyboardView']").click()
        self.wd.find_element_by_xpath("xpath=//*[@id='keyboardView']").click()

    def nav1(self):
        self.wd.swipe(803, 849, 799, 285, 737)
        self.wd.find_element_by_xpath("xpath=//*[@text='SAVE STATE']").click()
        self.wd.find_element_by_xpath(
            "xpath=//*[@text='RESTORE STATE']").click()
        self.wd.find_element_by_xpath(
            "xpath=//*[@text='GET CURRENT TIME']").click()
        self.wd.swipe(328, 1682, 328, 2432, 620)
        self.wd.find_element_by_xpath(
            "xpath=//*[@text='GET BATTERY LEVEL']").click()
        self.wd.swipe(785, 1685, 785, 2585, 674)
        self.wd.find_element_by_xpath(
            "xpath=//*[@text='GET LOCAL TIME INFO']").click()
        self.wd.swipe(407, 1835, 403, 2882, 706)
        self.wd.find_element_by_xpath(
            "xpath=//*[@text='GET REF TIME INFO']").click()
        self.wd.swipe(807, 2446, 803, 2896, 626)

    def nav2(self):
        self.wd.swipe(746, 874, 746, 132, 677)
        self.wd.swipe(746, 899, 746, 299, 771)
        self.wd.swipe(746, 899, 746, 0, 663)
        self.wd.find_element_by_xpath("xpath=//*[@text='GET MODEL #']").click()
        self.wd.swipe(289, 1242, 289, 492, 670)
        self.wd.swipe(296, 1835, 299, 2882, 725)
        self.wd.find_element_by_xpath(
            "xpath=//*[@text='GET MAN. NAME']").click()
        self.wd.swipe(842, 1824, 842, 2871, 766)
        self.wd.find_element_by_xpath(
            "xpath=//*[@text='GET SERIAL #']").click()
        self.wd.swipe(485, 1907, 489, 2807, 693)
        self.wd.find_element_by_xpath("xpath=//*[@text='GET HW REV']").click()
        self.wd.swipe(846, 1935, 849, 2835, 701)

    def nav3(self):

        self.wd.swipe(921, 1332, 921, 2225, 783)
        self.wd.swipe(921, 717, 921, -32, 673)
        self.wd.swipe(928, 721, 928, -478, 729)
        self.wd.find_element_by_xpath("xpath=//*[@text='GET FW REV']").click()
        self.wd.swipe(603, 1064, 603, 21, 736)
        self.wd.swipe(603, 1689, 603, 2589, 694)
        self.wd.find_element_by_xpath("xpath=//*[@text='GET SW REV']").click()
        self.wd.swipe(864, 1521, 864, 2571, 1102)

    def nav4(self):
        self.wd.swipe(753, 610, 753, -435, 728)
        self.wd.swipe(721, 1100, 721, 1999, 635)
        self.wd.swipe(742, 1021, 742, 1621, 644)
        self.wd.swipe(728, 535, 728, -210, 643)
        self.wd.swipe(728, 539, 728, -1410, 1037)
        self.wd.swipe(728, 542, 728, -657, 709)
        self.wd.find_element_by_xpath("xpath=//*[@text='GET SYS ID']").click()
        self.wd.swipe(396, 2024, 396, 3074, 680)
        self.wd.find_element_by_xpath("xpath=//*[@text='GET PNP ID']").click()
        self.wd.swipe(671, 1917, 671, 2967, 709)
Beispiel #27
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')
Beispiel #28
0
class HelloWorldBasic:
    # Initialize the eyes SDK and set your private API key.
    # %%%% start eyes-setup
    uri = "https://eyesapi.applitools.com"
    # %%%% start eyes-exception
    eyes = Eyes(uri)
    #%%%% stop eyes-exception
    api_key = os.environ.get('APPLITOOLS_API_KEY')
    eyes.api_key = api_key
    # %%%% stop eyes-setup
    # Open a Chrome browser.
    # %%%% start eyes-open
    innerDriver = webdriver.Chrome()

    # Start the test and set the browser's viewport size
    # %%%% start eyes-exception
    viewport_size = {'width': 1024, 'height': 768}
    driver = eyes.open(driver=innerDriver,
                       app_name='Hello World App',
                       test_name='Hello World Test',
                       viewport_size=viewport_size)
    #         %%%% stop eyes-open
    try:
        # %%%% stop all
        # insert your checkpoints here....
        # %%%% start all
        # %%%% stop eyes-exception
        # Navigate the browser to the "hello world!" web-site.
        website = "https://applitools.com/helloworld"
        driver.get(website)

        # Visual checkpoint #1.
        # %%%% start eyes-check
        eyes.check_window('Before mouse click')
        # %%%% stop eyes-check

        # Click the 'Click me!' button.
        driver.find_element_by_css_selector('button').click()

        # Visual checkpoint #2.
        eyes.check_window('After mouse click')

        # End the test.
        # %%%% start eyes-close
        # %%%% start eyes-exception
        throwtTestCompleteException = False
        result = eyes.close(throwtTestCompleteException)
        # %%%% stop eyes-exception
        url = result.url
        if result.is_new:
            print("New Baseline Created: URL=", url)
        elif result.is_passed:
            print("All steps passed:     URL=", url)
        else:
            print("Test Failed:          URL=", url)
    # %%%% stop eyes-close
    # %%%% start eyes-exception
    finally:
        # If the test was aborted before eyes.close was called, ends the test as aborted.
        eyes.abort_if_not_closed()
        # %%%% stop eyes-exception
    # Close the browser.
    driver.quit()
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from applitools import logger
from applitools.logger import StdoutLogger, FileLogger
from applitools.eyes import Eyes

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

driver = webdriver.Chrome()

logger.set_logger(StdoutLogger())
eyes = Eyes("https://localhost.applitools.com")
eyes.api_key = os.environ['APPLITOOLS_API_KEY']
eyes.force_full_page_screenshot = True
eyes.save_new_tests = False

try:
    ## First test
    driver = eyes.open(driver, "Python app", "Python binary", {'width': 800, 'height': 600})

    driver.get('http://www.applitools.com')
    eyes.check_window("initial")

    pricing_element = driver.find_element_by_css_selector("li.pricing a")
    eyes.check_region_by_element(pricing_element, "pricing button")

    driver.find_element_by_css_selector("li.contact-us a").click()
    eyes.check_window("contact us page")

    ## Second test
Beispiel #30
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")
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")
from selenium import webdriver
from applitools import logger
from applitools.logger import StdoutLogger
from applitools.eyes import Eyes

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

driver = webdriver.Chrome()

logger.set_logger(StdoutLogger())
eyes = Eyes()
eyes.api_key = os.environ['APPLITOOLS_API_KEY']
eyes.hide_scrollbars = True
# For browser which only take screenshot of the viewport, you can uncomment the setting below, and
# eyes will automatically create a full page screenshot.

# eyes.force_full_page_screenshot = True

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

    pricing_element = driver.find_element_by_css_selector("li.pricing a")
    eyes.check_region_by_element(pricing_element, "pricing button")

    pricing_element.click()
    eyes.check_window("pricing page")

    driver.find_element_by_css_selector("li.contact-us a").click()
__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()
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 setup(self, request):
     self.driver = webdriver.Firefox()
     self.eyes = Eyes()
     self.eyes.api_key = APPLITOOLS_APIKEY
     request.addfinalizer(self.teardown)
Beispiel #36
0
#!/usr/bin/env python -tt
# -*- coding:  utf-8 -*-
import os
import sys

from selenium import webdriver
from applitools.eyes import Eyes, BatchInfo

# This is your api key, make sure you use it in all your tests.
Eyes.api_key = '3Z1sOfalzP1QClQrzmHJaU5BbKiR0AFZlDsBPoVB3Uk110'
eyes = Eyes()
batch = BatchInfo("WG portal batch")
eyes.batch = batch

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

try:
    # viewSizeArray =[{'width': 1024, 'height': 768}, {'width': 1280, 'height': 1024}]
    # viewSizeArray = [[width, height],[...]...]
    viewSizeArray = [[1920, 1080], [1600, 1200], [1280, 1024], [1024, 768], [800, 600]]
    # viewSizeArray = [[1920, 1080], [1600, 1200]]
    # Make sure to use the returned driver from this point on.
    for viewSize in viewSizeArray:
        viewSizeForAppliTools = {'width': viewSize[0], 'height': viewSize[1]}
        driver = eyes.open(driver=driver,
                           app_name='Applitools',
                           test_name='Basic WG Portal test: resolution - ' + str(viewSize[0]) + 'x' + str(viewSize[1]),
                           viewport_size=viewSizeForAppliTools)
        driver.get('http://ru.wargaming.net/')
        # Visual validation point #1
Beispiel #37
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',
import os
from selenium import webdriver
from applitools import logger
from applitools.eyes import Eyes
from applitools.logger import StdoutLogger

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

driver = webdriver.Chrome()

logger.set_logger(StdoutLogger())
eyes = Eyes()
eyes.api_key = os.environ['APPLITOOLS_API_KEY']
eyes.force_full_page_screenshot = True
eyes.hide_scrollbars = True

try:
    ## First test
    driver = eyes.open(driver, "Python app", "Github Website", {'width': 800, 'height': 600})
    driver.get('http://www.github.com')
    eyes.check_window("initial")
    results = eyes.close(False)
    print(results)

    ## Second test
    driver = eyes.open(driver, "Python app", "Applitools Website", {'width': 900, 'height': 600})
    driver.get('http://www.applitools.com')
    eyes.check_window("initial")
    results = eyes.close(False)
    print(results)
finally:
Beispiel #39
0
import os
from selenium import webdriver
from applitools import logger
from applitools.eyes import Eyes
from applitools.logger import StdoutLogger

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

driver = webdriver.Chrome()

logger.set_logger(StdoutLogger())
eyes = Eyes()
eyes.api_key = os.environ['APPLITOOLS_API_KEY']
eyes.force_full_page_screenshot = True
eyes.hide_scrollbars = True

try:
    ## First test
    driver = eyes.open(driver, "Python app", "Github Website", {
        'width': 800,
        'height': 600
    })
    driver.get('http://www.github.com')
    eyes.check_window("initial")
    results = eyes.close(False)
    print(results)

    ## Second test
    driver = eyes.open(driver, "Python app", "Applitools Website", {
        'width': 900,
        'height': 600
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()
class EventScheduler_FrontEndTest:

    def setup(self, test_registration=False):
        self.eyes = Eyes()
        self.eyes.api_key = 'IlUcgRAO105BlmoORdtUxbK8CUKg3KRSa8q4f3iACoY1I110'
        self.driver = webdriver.Chrome(r"C:\Users\Tea\Desktop\chromedriver_win32 (1)\chromedriver.exe")

        self.eyes.open(driver=self.driver, app_name='Hello World!', test_name='eventScheduler')
        self.driver.get('http://*****:*****@mymail.sutd.edu.sg'

    def test_redirection(self):
        self.driver.find_element_by_xpath("//a[text()='Home']").click()
        self.eyes.check_window('Redirected to login')

        # show dropdown menu
        self.driver.find_element_by_xpath("//a[contains(text(),'Forms')]").click()
        self.eyes.check_window('Dropdown menu')

        self.driver.find_element_by_xpath("//a[contains(text(),'Schedule R')]").click()
        self.eyes.check_window('Redirected to login')

        assert(self.driver.current_url == "http://*****:*****@name="username"]')
        username.send_keys(self.ran_name)

        email = self.driver.find_element_by_xpath('//input[@name="email"]').click()
        self.eyes.check_window('Focused textbox')
        self.driver.find_element_by_xpath('//input[@name="email"]').send_keys(self.Email)

        pw1 = self.driver.find_element_by_xpath('//input[@name="password1"]')
        pw1.send_keys(self.LEGAL_PASSWORD)
        pw2 = self.driver.find_element_by_xpath('//input[@name="password2"]')
        pw2.send_keys(self.LEGAL_PASSWORD)
        pw2.send_keys(Keys.RETURN)

        self.eyes.check_window("Submitted")

    # re-registering with the same username
    def test_registration_repeatUser(self):
        self.driver.find_element_by_xpath("//a[text()='Register']").click()

        username = self.driver.find_element_by_xpath('//input[@name="username"]')
        username.send_keys(self.ran_name)

        email = self.driver.find_element_by_xpath('//input[@name="email"]').click()
        self.driver.find_element_by_xpath('//input[@name="email"]').send_keys(self.Email)

        pw1 = self.driver.find_element_by_xpath('//input[@name="password1"]')
        pw1.send_keys(self.LEGAL_PASSWORD)
        pw2 = self.driver.find_element_by_xpath('//input[@name="password2"]')
        pw2.send_keys(self.LEGAL_PASSWORD)
        pw2.send_keys(Keys.RETURN)

        assert('A user with that username already exists.' in self.driver.page_source)
        self.eyes.check_window("same user error message")

    # weak passwords
    def test_registration_fail(self):
        self.driver.find_element_by_xpath("//a[text()='Register']").click()

        # test weakpasswords
        username = self.driver.find_element_by_xpath('//input[@name="username"]')
        username.send_keys(self.RANDOM_NAME)

        email = self.driver.find_element_by_xpath('//input[@name="email"]').click()
        self.driver.find_element_by_xpath('//input[@name="email"]').send_keys(self.Email)

        pw1 = self.driver.find_element_by_xpath('//input[@name="password1"]')
        pw1.send_keys(self.WEAK_PASSWORD)
        pw2 = self.driver.find_element_by_xpath('//input[@name="password2"]')
        pw2.send_keys(self.WEAK_PASSWORD)
        pw2.send_keys(Keys.RETURN)

        self.driver.find_element_by_xpath("//a[text()='Register']").click()
        username = self.driver.find_element_by_xpath('//input[@name="username"]')
        username.send_keys(self.RANDOM_NAME)

        email = self.driver.find_element_by_xpath('//input[@name="email"]').click()
        self.driver.find_element_by_xpath('//input[@name="email"]').send_keys(self.Email)
        pw1 = self.driver.find_element_by_xpath('//input[@name="password1"]')
        pw1.send_keys("fakestrongpassword091")
        pw2 = self.driver.find_element_by_xpath('//input[@name="password2"]')
        pw2.send_keys('fakestrongpassword091')
        pw2.send_keys(Keys.RETURN)

        self.driver.find_element_by_xpath("//a[text()='Register']").click()
        username = self.driver.find_element_by_xpath('//input[@name="username"]')
        username.send_keys(self.RANDOM_NAME)

        email = self.driver.find_element_by_xpath('//input[@name="email"]').click()
        self.driver.find_element_by_xpath('//input[@name="email"]').send_keys(self.Email)
        pw1 = self.driver.find_element_by_xpath('//input[@name="password1"]')
        pw1.send_keys("fakestrongpassword091!")
        pw2 = self.driver.find_element_by_xpath('//input[@name="password2"]')
        pw2.send_keys('fakestrongpassword091!')
        pw2.send_keys(Keys.RETURN)

        self.driver.find_element_by_xpath("//a[text()='Register']").click()
        username = self.driver.find_element_by_xpath('//input[@name="username"]')
        username.send_keys(self.RANDOM_NAME)

        email = self.driver.find_element_by_xpath('//input[@name="email"]').click()
        self.driver.find_element_by_xpath('//input[@name="email"]').send_keys(self.Email)
        pw1 = self.driver.find_element_by_xpath('//input[@name="password1"]')
        pw1.send_keys("100091")
        pw2 = self.driver.find_element_by_xpath('//input[@name="password2"]')
        pw2.send_keys('100091')
        pw2.send_keys(Keys.RETURN)

    def test_login_wrong_username(self):
        self.driver.find_element_by_xpath('//a[text()="Login"]').click()
        self.driver.find_element_by_xpath('//input[@name="username"]').send_keys("WRONG NAME")
        self.driver.find_element_by_xpath('//input[@name = "password"]').send_keys(self.LEGAL_PASSWORD)
        self.driver.find_element_by_xpath('//button[text()="Login"]').click()
        self.eyes.check_window("error")
        assert("Please enter a correct username and password. Note that both fields may be case-sensitive." in self.driver.page_source)

    def test_login_wrong_pw(self):
        self.driver.find_element_by_xpath('//a[text()="Login"]').click()
        self.driver.find_element_by_xpath('//input[@name="username"]').send_keys(self.ran_name)
        self.driver.find_element_by_xpath('//input[@name = "password"]').send_keys("self.LEGAL_PASSWORD")
        self.driver.find_element_by_xpath('//button[text()="Login"]').click()
        assert("Please enter a correct username and password. Note that both fields may be case-sensitive." in self.driver.page_source)

    def test_login_pass(self):
        self.driver.find_element_by_xpath('//a[text()="Login"]').click()
        self.driver.find_element_by_xpath('//input[@name="username"]').send_keys(self.ran_name)
        self.driver.find_element_by_xpath('//input[@name = "password"]').send_keys(self.LEGAL_PASSWORD)
        self.driver.find_element_by_xpath('//button[text()="Login"]').click()

        self.eyes.check_window("Login-ed")

        # right = self.driver.find_element_by_xpath('//button[@class="fc-next-button fc-button fc-state-default fc-corner-right"]')
        # right.click()
        # self.eyes.check_window("today button lit up")

        # left=self.driver.find_element_by_xpath('        //button[@class="fc-prev-button fc-button fc-state-default fc-corner-left"]')
        # left.click()
        # self.eyes.check_window("today not lit")

        # self.driver.find_element_by_xpath('        //button[@class="fc-prev-button fc-button fc-state-default fc-corner-left"]').click()

    def test_collapse(self):
        self.driver.set_window_size(300, 800)
        self.driver.set_window_position(0, 0)
        self.eyes.check_window("check collapse")

        self.driver.set_window_size(1536, 673)
        self.driver.set_window_position(0, 0)

    def test_dropdown(self):
        # show dropdown menu
        self.driver.find_element_by_xpath("//a[contains(text(),'Forms')]").click()
        self.eyes.check_window('Dropdown menu')

    def test_links(self):
        self.driver.find_element_by_xpath("//a[contains(text(),'Schedule R')]").click()

        assert(self.driver.current_url == "http://localhost:8000/requestform/")

        self.driver.find_element_by_xpath("//a[contains(text(),'Forms')]").click()
        self.eyes.check_window('Dropdown menu')

        self.driver.find_element_by_xpath("//a[contains(text(),'Input M')]").click()

        assert(self.driver.current_url == "http://localhost:8000/requestform/input-module-info")

        self.driver.find_element_by_xpath("//a[contains(text(),'Forms')]").click()
        self.eyes.check_window('Dropdown menu')

        self.driver.find_element_by_xpath("//a[contains(text(),'In-vivo')]").click()

        assert(self.driver.current_url == "http://localhost:8000/requestform/add-event")

        self.driver.find_element_by_xpath("//a[contains(text(),'View R')]").click()

        assert(self.driver.current_url == "http://localhost:8000/requestform/view-requests")

    def logout(self):
        self.driver.find_element_by_xpath('//a[text()="Logout"]').click()
        self.eyes.check_window("logged out")

    def end(self):
        self.eyes.close()
        self.driver.quit()
        # If the test was aborted before self.eyes.close was called, ends the test as aborted.
        self.eyes.abort_if_not_closed()
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 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()
    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})
Beispiel #45
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")
    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)
Beispiel #47
0
class TestAdminPages(BaseTest):
    def __init__(self, *args, **kwargs):
        super(TestAdminPages, self).__init__(*args, **kwargs)
        self.__data = DataGenerateUtils()
        self.__login = LoginPage()
        self.__create_bot = CreateBotPage()
        self.__register = RegisterPage()
        self.__dashboard = DashboardPage()
        self.__appearance = AppearancePage()
        self.__create_bot_validation = CreateBotValidation()
        self.__drop_down_list = DropDownList()
        self.__change_password = ChangePasswordPage()
        self.__knowledge = KnowledgePage()
        self.__data_set = DataUtils()
        self.__faq_knowledge_data_table_component = FaqKnowledgeDataTableComponent(
        )
        self.valid_email = self.__data.create_email()
        self.valid_username = self.__data.create_name()
        self.valid_password = self.__data.create_password()
        self.bot_name = "Test"
        self.invalid_faq = "google.com"
        self.eyes = Eyes()
        self.eyes.api_key = YAML_CONFIG.get("eyes_api_key")
        self.eyes.force_full_page_screenshot = True
        self.eyes.stitch_mode = StitchMode.CSS

    def setUp(self):
        super().setUp()
        self.sign_in_for_ui_test(
            email=YAML_CONFIG.get("visual_test_user"),
            password=YAML_CONFIG.get("visual_test_password"),
            # Use is_debugging flag to login instead of register new account
            is_debugging=True)

    def test_for_bot_knowledge_appearance(self):
        try:
            self.eyes.open(driver=self.__login.driver.core_driver,
                           app_name='sample_app',
                           test_name='Bot Knowledge Page',
                           viewport_size={
                               'width': 1440,
                               'height': 887
                           })
            self.__knowledge.open_knowledge_page()
            self.__knowledge.wait_for_create_page()
            # self.eyes.check_window("Default state of Knowledge Page")
            self.eyes.check_region_by_selector(
                By.XPATH, "//*[contains(@class,'two')]/div", "Default state")

            self.__knowledge.btn_add_knowledge.click()
            self.eyes.check_region_by_selector(
                by=By.CSS_SELECTOR,
                value="#add-knowledge-dropdown > div",
                tag="Add knowledge dropdown")

            self.__knowledge.btn_from_faq_url.click()
            # self.eyes.check_window("Knowledge page when adding faq url")
            self.eyes.check_region_by_selector(
                By.XPATH, "//*[contains(@class,'two')]/div", "Adding FAQ URL")

            self.__knowledge.init_manual_question_pair_table()
            # self.eyes.check_window("Knowledge page when init manual faq table")
            self.eyes.check_region_by_selector(
                By.XPATH, "//*[contains(@class,'two')]/div",
                "Initiated manual FAQ")

            manual_section = FaqKnowledgeDataTableComponent.get_table_component_with_group_faqs(
                "Manual Q&A")
            manual_section.collapse_section()
            self.eyes.check_region_by_element(
                manual_section.base_component_element(
                    SeleniumElement).get_wrapper_element,
                "Manual section after collapsing")

            web_content_section = FaqKnowledgeDataTableComponent.get_table_component_with_group_faqs(
                "Web Content")
            web_content_section.open_section()
            # TODO(namndoan): capture full element
            self.eyes.check_region_by_element(
                web_content_section.base_component_element(
                    SeleniumElement).get_wrapper_element,
                "Web content section after open")

            web_content_section.collapse_section()
            # self.eyes.check_window("Knowledge page after closing Web Content section")
            self.eyes.check_region_by_selector(
                By.XPATH, "//*[contains(@class,'two')]/div",
                "Closed Web Content section")
            self.eyes.check_region_by_selector(
                By.XPATH, "//*[contains(@class,'two')]/div[2]",
                "Chat box in knowledge")
        finally:
            res = self.eyes.close(raise_ex=True)
            print(res)
            self.eyes.abort_if_not_closed()

    def tearDown(self):
        super().tearDown()
Beispiel #48
0
class Website:
    enable_eyes = True

    # Establish Eyes
    if enable_eyes:
        eyes = Eyes()
        eyes.api_key = ''
        eyes.force_full_page_screenshot = True

        # Force stitching of screenshots on pages where floating elements might appear twice on the screenshot
        # Note that this functionality is not perfect and fails miserably on a sticky header that resizes later in the scroll.
        eyes.stitch_mode = StitchMode.CSS

    # Configure Chrome
    options = webdriver.ChromeOptions()
    options.add_argument("--disable-infobars")
    caps = options.to_capabilities()

    desired_cap = {
        'browser': 'Chrome',
        'browser_version': '62.0',
        'os': 'Windows',
        'os_version': '10',
        'resolution': '1920x1080'
    }

    # Merge Chrome Settings
    caps.update(desired_cap)

    try:
        # Setup WebDriver object to access remote device.
        driver = webdriver.Remote(command_executor='',
                                  desired_capabilities=caps)

        # Maximize Window
        driver.maximize_window()

        # Define the test
        if enable_eyes:
            eyes.open(driver=driver,
                      app_name='Website',
                      test_name='Website Test - Sitemap')

        domain = ''  # put the url to test here.

        # Get Home
        driver.get(domain)

        # Create snapshot for frontpage.
        if enable_eyes: eyes.check_window('Frontpage')

        print('Frontpage')

        # Sitemap (get contents). Pretty known that sitemaps of sites are in <domain>/sitemap
        driver.get(domain + 'sitemap')

        # Create snapshot for Sitemap
        if enable_eyes: eyes.check_window('Sitemap')

        print('Sitemap')

        sites = []

        # Collect href and text of anchors in sitemap before we move away from the current window
        for element in driver.find_elements_by_css_selector('.sitemap a'):
            if element.text != 'Sitemap':
                sites.append({
                    'href': element.get_attribute('href'),
                    'text': element.text
                })

        # Loop through the collected links earlier and snapshot them
        for site in sites:
            driver.get(site['href'])
            if enable_eyes: eyes.check_window(site['text'])
            print(site['text'])

        # Close Eyes
        if enable_eyes: eyes.close()
    finally:
        # End the tests
        driver.quit()

        if enable_eyes: eyes.abort_if_not_closed()
Beispiel #49
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
            })
 def setUp(self):
     self.eyes = Eyes()
     self.eyes.api_key = APPLITOOLS_APIKEY
     self.driver = webdriver.Firefox()
    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[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")
Beispiel #52
0
#!/usr/bin/env python -tt
# -*- coding:  utf-8 -*-
import ConfigParser
from selenium import webdriver
from applitools.eyes import Eyes, BatchInfo

# This is your api key, make sure you use it in all your tests.
Eyes.api_key = '3Z1sOfalzP1QClQrzmHJaU5BbKiR0AFZlDsBPoVB3Uk110'
eyes = Eyes()
batch = BatchInfo("BackYard batch test")
eyes.batch = batch

# Read configs from file
configParser = ConfigParser.RawConfigParser()
configFilePath = r'config.cfg'
configParser.read(configFilePath)
baseurl = configParser.get('common', 'baseurl')
username = configParser.get('common', 'admin')
password = configParser.get('common', 'password')
accountNameSearch = configParser.get('common', 'accountNameSearch')

# assign xPath variables for web-forms under test
xpaths = {'usernameTxtBox': "//input[@name='username']",
          'passwordTxtBox': "//input[@name='password']",
          'submitButton': "/html/body/div/form/div/div[1]/button",
          'DashBoard_bckWOWPMain': "/html/body/div[1]/div/div[2]/div/ul/li[5]/a",
          'bckWOWP_accountsPage': "/html/body/div[3]/div[16]/div/div[1]/ul/li[1]/a",
          'bckWOWP_accounts_searchType': "/html/body/div[3]/div[17]/div/div/div/form/div[1]/fieldset[1]/div/select/" +
                                         "option[4]",
          'bckWOWP_accounts_searchValue': "/html/body/div[3]/div[17]/div/div/div/form/div[1]/fieldset[1]/div/input",
          'bckWOWP_accounts_searchStart': "/html/body/div[3]/div[17]/div/div/div/form/div[2]/button",
Beispiel #53
0
class TestAuthenticationPages(BaseTest):
    def __init__(self, *args, **kwargs):
        super(TestAuthenticationPages, self).__init__(*args, **kwargs)
        self.__login = LoginPage()
        self.__register = RegisterPage()
        self.__forgot_password = ForgotPasswordPage()

        self.__data = DataGenerateUtils()
        self.valid_email = self.__data.create_email()
        self.valid_username = self.__data.create_name()
        self.valid_password = self.__data.create_password()

        self.bot_name = "Test"
        self.invalid_faq = "google.com"
        self.eyes = Eyes()
        self.eyes.api_key = YAML_CONFIG.get("eyes_api_key")

    def setUp(self):
        super().setUp()

    def test_login_page_appearance(self):
        try:
            self.eyes.open(driver=self.__login.driver.core_driver,
                           app_name='sample_app',
                           test_name='Login Page',
                           viewport_size={'width': 1440, 'height': 887})
            self.__login.open_login_page()
            self.__login.wait_for_log_in_page()
            self.eyes.check_window("Default Login Page")
            self.__login.check_remember_me(False)
            self.eyes.check_window("Login Page without remember me")
            self.__login.login_with_account("", "")
            self.eyes.check_window("Login Page with error message")
        finally:
            res = self.eyes.close(raise_ex=True)
            print(res)
            self.eyes.abort_if_not_closed()

    def test_register_page_appearance(self):
        try:
            self.eyes.open(driver=self.__login.driver.core_driver,
                           app_name='sample_app',
                           test_name='Register Page',
                           viewport_size={'width': 1440, 'height': 887})
            self.__register.open_register_page()
            self.__register.wait_for_register_page()
            self.eyes.check_window("Default Register Page")
            self.__register.txt_email.click()
            self.eyes.check_window("Register with tips for email")
            self.__register.txt_password.click()
            self.eyes.check_window("Register with tips for password")
            self.__register.login_with_new_account("", "", "")
            self.eyes.check_window("Register with error message")
        finally:
            res = self.eyes.close(raise_ex=True)
            print(res)
            self.eyes.abort_if_not_closed()

    def test_forgot_password_page_appearance(self):
        try:
            self.eyes.open(driver=self.__login.driver.core_driver,
                           app_name='sample_app',
                           test_name='Forgot Password Page',
                           viewport_size={'width': 1440, 'height': 887})
            self.__forgot_password.open_forgot_password_page()
            self.__forgot_password.wait_for_forgot_password_page()
            self.eyes.check_window("Default Forgot password page")
            self.__forgot_password.submit_email("")
            self.eyes.check_window("Submit empty email")
            self.__forgot_password.submit_email("*****@*****.**")
            self.eyes.check_window("Submit with wrong email format")
            self.__forgot_password.submit_email(YAML_CONFIG.get("sample_app_user"))
            self.eyes.check_window("Submit successfully")
        finally:
            res = self.eyes.close(raise_ex=True)
            print(res)
            self.eyes.abort_if_not_closed()

    def tearDown(self):
        super().tearDown()
Beispiel #54
0
 def setUp(self):
     self.driver = webdriver.Firefox()
     Eyes.api_key = '8PN69qEtrGKMMYrzyThC8wWXLlFmqyPMH1YLurYcxp8110'
     eyes = Eyes()
     self.driver = eyes.open(driver=self.driver, app_name='Applitools', test_name='Test Web Page',
                    viewport_size={'width': 1024, 'height': 768})
Beispiel #55
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
            })
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()