Beispiel #1
0
# ---------- #
# TEST CASES
# ---------- #

if spy.urlArray:
    for u in spy.urlArray:
        spy.urlToTest = u
        
        spy.browser = spy.resolveBrowser(spy.whichBrowser)     
        spy.browser.get(spy.urlToTest)
        #spy.browser.execute_script("window.scrollTo(0, document.body.scrollHeight);")
        
        #1. validate url ------------------------
        spy.testId = 1
        if(spy.browser):
            spy.logSuccess("Page Loaded", spy.testId)
            print spy.urlToTest
        else:
            spy.logFail("Page NOT Loaded", spy.testId)
        
            
        #2. check that header exists ------------------------
        spy.testId = 2
        try:
            footer = spy.browser.find_element_by_id('main-header')
            spy.logSuccess("Header found", spy.testId)
        except spy.NoSuchElementException:
            spy.logFail("Header missing", spy.testId)    


        #3 validate header links and href --------------------
Beispiel #2
0
# ---------- #
# TEST CASES
# ---------- #

if spy.urlArray:
    for u in spy.urlArray:
        spy.urlToTest = u
        
        spy.browser = spy.resolveBrowser(spy.whichBrowser)     
        spy.browser.get(spy.urlToTest)
        #spy.browser.execute_script("window.scrollTo(0, document.body.scrollHeight);")
        
        #1. validate url ------------------------
        spy.testId = 1
        if(spy.browser):
            spy.logSuccess("Page Loaded", spy.testId)
            print spy.urlToTest
        else:
            spy.logFail("Page not Loaded", spy.testId)
        
        
        #2. Validate meta tags
        spy.testId = 2
        
        meta_tags = [
            {'k':'charset', 'v':'utf-8'},
            {'k':'name', 'v':'viewport'},
            {'k':'name', 'v':'keywords'},
            {'k':'name', 'v':'description'},
        ]
        
Beispiel #3
0
 #1 Check for Scripts Included
 
 spy.testId = 1
 
 scripts = [
         {'src': 'http://aglobal.go.com/stat/dolWebAnalytics_DCT.js', 'p': 'do1 Web Analytics Script'},
         {'src': '/sites/all/themes/spoonful-themes/spoonful/library/js/modernizr.js', 'p': 'Modernizr'},
         {'src': '/sites/all/themes/spoonful-themes/spoonful/library/js/require.js', 'p': 'Require JS'},
     ]
 
 for s in scripts:
     
     meta = {'k': 'script src', 'v': s['src']}            
     try:
         script = spy.browser.find_element_by_css_selector('script[src="'+ s['src'] +'"]')
         spy.logSuccess(s['p'] + " found", spy.testId, meta)
     except spy.NoSuchElementException:
         spy.logFail(s['p'] + " not found", spy.testId, meta)
 
   #2 Check for analytics
 
 tests = [
     #homepage
     {'u': 'http://50.56.136.148/', 'e':
         [
             {'s':'ul.footer-logos li.first a', 'v':'&lid=GlobalFooter/image/Spoonful&lpos=GlobalFooter', 'p':'Footer - Spoonful'},
             {'s':'ul.footer-logos li a.logo-disneyfamily', 'v':'&lid=GlobalFooter/image/Disneyfamily.com&lpos=GlobalFooter', 'p':'Footer - Family'},
             {'s':'ul.footer-logos li a.logo-disneyfamilyfun', 'v':'&lid=GlobalFooter/image/FamilyFun&lpos=GlobalFooter', 'p':'Footer - Family Fun'},
             {'s':'ul.footer-logos li a.logo-babyzone', 'v':'&lid=GlobalFooter/image/baby zone&lpos=GlobalFooter', 'p':'Footer - Baby Zone'},
             {'s':'ul.footer-logos li a.logo-babble', 'v':'&lid=GlobalFooter/image/babble&lpos=GlobalFooter', 'p':'Footer - Babble'},
             
Beispiel #4
0
 
     i += 1
     spy.urlToTest = u
     print ""
     print "*****"
     print "Running Url #" + str(i)
     print "*****"
     print ""
     
     spy.browser.get(spy.urlToTest)
     #spy.browser.execute_script("window.scrollTo(0, document.body.scrollHeight);")
     
     #1. validate url ------------------------
     spy.testId = 1
     if(spy.browser):
         spy.logSuccess("Page Loaded", spy.testId)
         print spy.urlToTest
     else:
         spy.logFail("Page NOT Loaded", spy.testId)
     
     #2 get family fun url
     #temp hard coded url (use john's meta tag to get)
     spy.testId = 2
     
     try:
         hidden_box = spy.find('input[type="hidden"]')
         
         original_url = hidden_box.get_attribute('value')
         spoonful_url = u
         
         #3 Query Original URL
Beispiel #5
0
# ---------- #
# TEST CASES
# ---------- #

if spy.urlArray:
    for u in spy.urlArray:
        spy.urlToTest = u

        spy.browser = spy.resolveBrowser(spy.whichBrowser)
        spy.browser.get(spy.urlToTest)
        # spy.browser.execute_script("window.scrollTo(0, document.body.scrollHeight);")

        # 1. validate url ------------------------
        spy.testId = 1
        if spy.browser:
            spy.logSuccess("Page Loaded", spy.testId)
            print spy.urlToTest
        else:
            spy.logFail("Page not Loaded", spy.testId)

        # 2. check that footer exists ------------------------
        spy.testId = 2
        try:
            footer = spy.browser.find_element_by_id("global-footer")
            spy.logSuccess("footer found", spy.testId)
        except spy.NoSuchElementException:
            spy.logFail("footer missing", spy.testId)

        # 3. validate footer links presence & href ------------------------
        spy.testId = 3
        # s = selector
Beispiel #6
0
# TEST CASES
# ---------- #


if spy.urlArray:
    for u in spy.urlArray:
        spy.urlToTest = u
        
        spy.browser = spy.resolveBrowser(spy.whichBrowser)     
        spy.browser.get(spy.urlToTest)
        #spy.browser.execute_script("window.scrollTo(0, document.body.scrollHeight);")
        
        #1. validate url ------------------------
        spy.testId = 1
        if(spy.browser):
            spy.logSuccess("Page Loaded", spy.testId)
            print spy.urlToTest
        else:
            spy.logFail("Page NOT Loaded", spy.testId)
            
        #1. login ------------------------
        spy.testId = 2

        try:
            username = spy.browser.find_element_by_id("edit-name")
            password = spy.browser.find_element_by_id("edit-pass")
            submit = spy.browser.find_element_by_id("edit-submit")
            
            username.send_keys('admin')
            password.send_keys('admin')
            spy.time.sleep(1)
Beispiel #7
0
spy.browser = spy.resolveBrowser(spy.whichBrowser)     
spy.browser.get(spy.urlToTest)


# ---------- #
# TEST CASES
# ---------- #



#1. Alt Attributes
spy.testId = '1a'
try:
    images = spy.browser.find_elements_by_css_selector('img')
    spy.logSuccess("Image Markup Found: " + str(len(images)), spy.testId)
except spy.NoSuchElementException:
    spy.logNotice("No Image Markup Found", spy.testId)

spy.testId = '1b'
try:
    withAlt = spy.browser.find_elements_by_xpath('//img[@alt]')
    spy.logNotice("Number of images with alt attributes: " + str(len(withAlt)), spy.testId)
except:
    spy.logFail("No alt attributes found", spy.testId)

spy.testId = '1c'

altBlank = spy.browser.find_elements_by_xpath("//img[@alt='']")
if altBlank:
    for img in altBlank:
Beispiel #8
0
# ---------- #
# TEST CASES
# ---------- #

if spy.urlArray:
    for u in spy.urlArray:
        spy.urlToTest = u
        
        spy.browser = spy.resolveBrowser(spy.whichBrowser)     
        spy.browser.get(spy.urlToTest)
        #spy.browser.execute_script("window.scrollTo(0, document.body.scrollHeight);")
        
        #1. validate url ------------------------
        spy.testId = 1
        if(spy.browser):
            spy.logSuccess("Page Loaded", spy.testId)
            print spy.urlToTest
        else:
            spy.logFail("Page NOT Loaded", spy.testId)
        
        #1. login ------------------------
        spy.testId = 2
        try:
            username = spy.browser.find_element_by_id("edit-name")
            password = spy.browser.find_element_by_id("edit-pass")
            
            username.send_keys('admin')
            password.send_keys('admin' + spy.Keys.RETURN)

            spy.browser.get('http://50.56.136.148/admin')