This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from selenium import webdriver | |
| from selenium.webdriver.common.by import By | |
| from selenium.webdriver.common.action_chains import ActionChains | |
| # this Base class is serving basic attributes for every single page inherited from Page class | |
| class Page(object): | |
| def __init__(self, driver, base_url='http://www.app.com/'): | |
| self.base_url = base_url | |
| self.driver = driver |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ~/P/m/h/services python run.py | |
| test_get_session (__main__.SoapServices) ... ok | |
| test_get_token (__main__.SoapServices) ... ok | |
| test_CompleteReturnRequest (__main__.SoapServices) ... ok | |
| test_ReturnTransactionRequest (__main__.SoapServices) ... ok | |
| test_UserInfoRequest (__main__.SoapServices) ... ok | |
| test_RefundRequest (__main__.SoapServices) ... ok | |
| test_StartTransactionRequest (__main__.SoapServices) ... ok | |
| test_ReturnTransactionRequest (__main__.SoapServices) ... ok |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ------- GIVEN -------- | |
| Given(/^I go to a brand page$/) do | |
| find_by(IDs.container["Brand List"]).click() | |
| end | |
| # ------- WHEN -------- | |
| When(/^user clicks link of "([^"]*)"$/) do |item| | |
| find_by(IDs.header[item]).click() | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| When(/^user submits the registration form with valid user information$/) do | |
| enter_text IDs.items["Name"], "John" | |
| enter_text IDs.items["Surname"], "Doe" | |
| enter_text IDs.items["Email"], "[email protected]" | |
| enter_text IDs.items["Password"], "Password1213" | |
| touch IDs.items["Male"] | |
| select_from_list IDs.items["Birt"], "1990" | |
| touch IDs.items["Terms and Condition"] | |
| touch IDs.items["Register"] | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'capybara/dsl'; | |
| require 'capybara/poltergeist' | |
| include Capybara::DSL; | |
| Capybara.register_driver :chrome do |app| | |
| Capybara::Selenium::Driver.new(app, :browser => :chrome) | |
| end | |
| Capybara.register_driver :poltergeist do |app| | |
| options = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # run it: ruby udemy.rb | |
| require 'capybara/dsl'; | |
| require 'capybara/poltergeist' | |
| include Capybara::DSL; | |
| Capybara.register_driver :poltergeist do |app| | |
| options = { | |
| :js_errors => false , | |
| :js => true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import re, sys | |
| import os | |
| MIN_RESPONSE_TIME = int(os.environ['min_response_time']) | |
| MAX_RESPONSE_TIME = int(os.environ['max_response_time']) | |
| AVG_RESPONSE_TIME = int(os.environ['avg_response_time']) | |
| print("\n---- Test Parameters -----\n") | |
| print("MIN_RESPONSE_TIME: %d" % MIN_RESPONSE_TIME) | |
| print("MAX_RESPONSE_TIME: %d" % MAX_RESPONSE_TIME) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DesiredCapabilities capabilities = new DesiredCapabilities(); | |
| capabilities.setCapability("deviceName", "MOTO G 2"); | |
| capabilities.setCapability("platformName", "Android"); | |
| capabilities.setCapability(CapabilityType.BROWSER_NAME, "Chrome"); | |
| capabilities.setCapability("platformVersion", "5.0.2"); | |
| capabilities.setCapability("appPackage", "com.android.chrome"); | |
| capabilities.setCapability("appActivity","com.google.android.apps.chrome.ChromeTabbedActivity"); | |
| driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| n = 15 | |
| chr = ' +' | |
| for i in xrange(n): | |
| line = '' | |
| if i == 0 or i == n - 1 or i == (n / 2): | |
| line = n * chr | |
| else: | |
| if i < n / 2: | |
| middle = i * 2 - 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| n = 15 | |
| chr = ' +' | |
| for i in xrange(n): | |
| line = '' | |
| if i == 0 or i == n - 1 or i == (n / 2): | |
| line = n * chr | |
| else: | |
| if i < n / 2: | |
| middle = i * 2 - 1 |