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 / chromedriver_comparison.rb
Created November 5, 2017 00:20
chromedriver headless vs chromedriver
Capybara.register_driver :chrome do |app|
args = ["--start-fullscreen", "--disable-infobars", "--disable-notifications"]
Capybara::Selenium::Driver.new(app, {:browser => :chrome, :args => args})
end
Capybara.register_driver :chrome_headless do |app|
args = ["--window-size=1280,1696", "--no-sandbox", "--headless", "--disable-gpu", "--disable-infobars", "--disable-notifications"]
Capybara::Selenium::Driver.new(app, {:browser => :chrome, :args => args})
end
@gunesmes
gunesmes / AA001_address.feature
Last active February 10, 2017 06:12
using SQLCMD for Capybara for Windows and Unix
Feature: M001 - Adding new addresses
As a member
I Want to create address
So That I can order a product
@javascript @order @test_env
Scenario: Member should successfully add his first address
When I login to to system as "John Doe"
And I ensure that I have no address
And I go to new address page
body {
/* Shifts body so navigation bar does not overlap it.
Make sure to include this after the core Bootstrap CSS. */
padding-top: 60px;
}
h2 {
font-size: 24px;
}
Capybara.register_driver :chrome_no_image do |app|
preferences = {
"profile.managed_default_content_settings.images" => 2,
}
caps = Selenium::WebDriver::Remote::Capabilities.chrome(
'chromeOptions' => {
'prefs' => preferences
}
)
After do |scenario|
if scenario.failed?
take_screenshot(scenario)
end
end
def take_screenshot(scenario)
if RbConfig::CONFIG["host_os"] == "mingw32"
screenshot_path = 'C:\Users\Administrator\Documents\web-automation\features\support\media\\' + '#{scenario.__id__}.png'
else
@gunesmes
gunesmes / ere.rb
Last active July 29, 2016 13:35
re
After do |scenario|
if scenario.failed?
take_screenshot(scenario)
end
end
def take_screenshot(scenario)
# set screenshot path depends on operating system
if RbConfig::CONFIG["host_os"] == "mingw32"
screenshot_path = 'C:\Users\Administrator\Documents\web-automation\features\support\media\\' + '#{scenario.__id__}.png'
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
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
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);
@gunesmes
gunesmes / locust_check_result_file.py
Last active February 25, 2019 13:14
Integration of Locust and Jenkins.
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)