Example #1
0
class TestTacoTodos(object):
    def setup_method(self, method):
        self.driver = WebDriver(desired_capabilities=desired_capabilities,
                                command_executor=command_executor)
        self.current_method_name = method.__name__

    def teardown_method(self, method):
        self.driver.close()
        self.driver.quit()

    def test_todo_counts(self):
        tacotodos = TacoTodoPage(self.driver).open()
        tacotodos.new_todo = 'Bean and egg taco \n'
        tacotodos.new_todo = 'Potato, egg & cheese \n'
        tacotodos.new_todo = 'Nopales y huevos\n'
        tacotodos.new_todo = 'Crispy taco\n'
        tacotodos.new_todo = 'Cruspy taco\n'
        tacotodos.new_todo = 'Crepes\n'
        assert 6 == tacotodos.todos_remaining
        tacotodos.complete_all_todos()
        assert 6 == tacotodos.todos_completed
        assert 6 == tacotodos.todos_listed
        assert 0 == tacotodos.todos_remaining
        tacotodos.clear_completed_todos()
        assert 0 == tacotodos.todos_listed
        assert 0 == tacotodos.todos_completed
Example #2
0
class TestFlipkartPage(object):
    '''
    1. Check that the Flipkart's page is loaded. i.e active internet connection existss
    2. 
    '''
    def setup_class(self):
        self.driver = WebDriver()
        self.welcome_page = FlipkartPage(self.driver).open()

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

    def test_flipkart_welcome(self):
        ''' Check that we have landed on Flipkart's main page.
        '''
        assert 'Flipkart' in self.welcome_page.title

    def test_search(self):
        ''' Check the availability of the search bar on the page.
        If the search bar exists, we search for "laptop".
        '''
        assert self.welcome_page.has_search()
        self.search_page = self.welcome_page.search('laptop')

        assert self.search_page.has_sorting_options()
        self.new_search_page = self.search_page.sort_by_popularity()

        assert self.new_search_page.has_products()
        assert self.new_search_page.get_details is not None
class TestTacoTodos(object):

    def setup_method(self, method):
        self.driver = WebDriver(desired_capabilities=desired_capabilities,
                                command_executor=command_executor)
        self.current_method_name = method.__name__

    def teardown_method(self, method):
        self.driver.close()
        self.driver.quit()

    def test_todo_counts(self):
        tacotodos = TacoTodoPage(self.driver).open()
        tacotodos.new_todo = 'Bean and egg taco \n'
        tacotodos.new_todo = 'Potato, egg & cheese \n'
        tacotodos.new_todo = 'Nopales y huevos\n'
        tacotodos.new_todo = 'Crispy taco\n'
        tacotodos.new_todo = 'Cruspy taco\n'
        tacotodos.new_todo = 'Crepes\n'
        assert 6 == tacotodos.todos_remaining
        tacotodos.complete_all_todos()
        assert 6 == tacotodos.todos_completed
        assert 6 == tacotodos.todos_listed
        assert 0 == tacotodos.todos_remaining
        tacotodos.clear_completed_todos()
        assert 0 == tacotodos.todos_listed
        assert 0 == tacotodos.todos_completed
def main():
    ''' The main script to perform the task.'''
    # Setting up the driver and loading Flipkart's landing page
    driver = WebDriver()
    welcome_page = FlipkartPage(driver).open()

    # Searching for "laptop"
    search_page = welcome_page.search('laptop')
    # Sorting the results by Popularity
    new_search_page = search_page.sort_by_popularity()
    # Printing a list of most popular laptops
    laptops = new_search_page.get_details(max_items=5)
    for i, laptop in enumerate(laptops):
        print('--------------------------------------\n')
        print(i + 1, laptop)
        print('--------------------------------------\n')

    # Tearing down the setup
    driver.close()
    driver.quit()
Example #5
0
import sys
from selenium.webdriver.support.event_firing_webdriver import EventFiringWebDriver

sys.path.append('.')

from pago.errors import ExpectedElementError
from pago.driver import WebDriver
from pago.listener import MaListener

desired_capabilities = {'browserName': 'chrome'}
command_executor = "http://127.0.0.1:4444/wd/hub"

from modules.pagesofreps.base import JqueryPagination

remote_webdriver = WebDriver(desired_capabilities=desired_capabilities,
                             command_executor=command_executor)
driver = EventFiringWebDriver(remote_webdriver, MaListener())
test_page = JqueryPagination(driver)
test_page.open()

while True:
    try:
        test_page = test_page.next()
    except ExpectedElementError as eee:
        break

test_page.driver.close()
test_page.driver.quit()
Example #6
0
 def setup_method(self, method):
     self.driver = WebDriver(desired_capabilities=desired_capabilities,
                             command_executor=command_executor)
     self.current_method_name = method.__name__
Example #7
0
 def setup_class(self):
     self.driver = WebDriver()
     self.welcome_page = FlipkartPage(self.driver).open()
 def setup_method(self, method):
     self.driver = WebDriver(desired_capabilities=desired_capabilities,
                             command_executor=command_executor)
     self.current_method_name = method.__name__