Skip to content

Instantly share code, notes, and snippets.

View gunesmes's full-sized avatar
🎯
Focusing

Mesut Güneş gunesmes

🎯
Focusing
View GitHub Profile
Feature: As a customer
In order to buy something
From the amazon.com
I want to login the page
Scenario: User goes to login page
Given I am on home page of Amazon
When I click "Hello. Sign in" button
Then I should see login form
require 'rubygems'
require 'capybara'
require 'capybara-webkit'
require 'capybara/dsl'
require 'capybara/rspec'
require 'capybara/poltergeist'
Capybara.run_server = false
Capybara.app_host = 'http://www.amazon.com'
Capybara.default_driver = :selenium
@gunesmes
gunesmes / coupon.py
Last active January 4, 2019 08:49
This example shows the importance of the static test techniques.Requirement: if the user doesn't have any coupon, he can not cancel coupons
coupon = user.get_coupon()
if coupon <= 1:
#if the user doesn't have any coupon, give warning
message = "You don/'t have any coupon to cancel"
else:
#open coupon cancellation page
show_cancellation_page()
def new_member_form_check(self):
self.setUp()
driver = self.driver
m = TestData()
email = m.createEmail()
testCase = TestCase(901)
testCase.result = "PASS"
driver.get(self.baseUrl + "/member/")
@gunesmes
gunesmes / myhabit_sign_up_watir.rb
Last active December 12, 2015 00:18
a sample and simple test framework for selenium (in python) and watir (in ruby) entegration
require "watir"
require "json"
def sign_up(url, name, email, password)
print "watir will run the internet explorer"
browser = Watir::Browser.start url
browser.link(:xpath, "/html/body/div/div[2]/div/div/div[4]/a").click
browser.link(:id, "registrationLink").click
browser.text_field(:id, "ap_customer_name").set(name)
browser.text_field(:id, "ap_email").set(email)
@gunesmes
gunesmes / browsers.py
Last active December 11, 2015 15:18
using different browsers via selenium webdrivers
class ProjectName(unittest.TestCase):
def __init__(self, browser):
if browser == "firefox":
self.driver = webdriver.Firefox()
elif browser == "ie":
self.driver = webdriver.Ie()
elif browser == "chrome":
self.driver = webdriver.Chrome()
else:
print( "browsers: firefox, ie, chrome" )