Skip to content

Instantly share code, notes, and snippets.

View gunesmes's full-sized avatar
🎯
Focusing

Mesut Güneş gunesmes

🎯
Focusing
View GitHub Profile
@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" )
@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)
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 / 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()
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
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
@gunesmes
gunesmes / testCases.java
Last active August 29, 2015 14:00
From Java, you can call Python function which creates a new e-mail for testing.
import org.python.antlr.ast.Str;
import org.python.core.PyObject;
import org.python.util.PythonInterpreter;
public class ProjectName{
public String createEmail() {
PythonInterpreter python = new PythonInterpreter();
// full path of the python file
python.execfile("D:\\workspace\\pojectname\\src\\com\\base\\test_data.py");
@gunesmes
gunesmes / new_member.feature
Last active August 29, 2015 14:02
Deterministic Way of Test Automation
Feature: New member
As A user
I Want to become member
So That I buy something
Background: User open sign-up page
Given I go to home page
When I click "sign-up button"
@javascript
@gunesmes
gunesmes / amazon_set_window_size_and_check_css.rb
Last active August 29, 2015 14:02
set the width and heigth of the browser and then check if the width of navigation bar has full length by executing jQuery.
require 'capybara/dsl'
include Capybara::DSL
Capybara.default_driver = :selenium
visit "http://www.amazon.com/"
# the screen size will be fixed as the following resolution
# then navigation bar is expected to fill full size of header.
# if there is a scroll bar, its width shoul be subtracted as 15px.
@gunesmes
gunesmes / test_data.rb
Created June 21, 2014 10:15
With this module, you can create test e-mail address and you can check if you get a related email. You can use this for Google account.
require 'net/imap'
class TestData
def initialize()
@emailBase = "username"
@emailSup = "gmail.com"
@password = "password"
@emails = ""
end