silence 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 69487eaf00ccb24d6c55962e07eaa881eef9e6c9
4
+ data.tar.gz: 1e026f3612b216d9172932b90fccd00655f4d10f
5
+ SHA512:
6
+ metadata.gz: 9a65453db17d062b9d94ec58518e7c725097de927ea9ba0267207ca871b0165bb6cdbe11d2c403309f0e37d2d3bc0da3e7d5c3364e0199c03c34e392863b8079
7
+ data.tar.gz: cc5c62d29bdb98f41d691a502e63964305458feb19a6ac59a0814b166a63bb696917cb8a6d3c39c9d7b2fb05ef86c54084068b65029064c5e551890a45f34285
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in silence.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 gorodni4ij
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Silence
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/silence`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'silence'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install silence
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ 1. Fork it ( https://github.com/[my-github-username]/silence/fork )
36
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
37
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
38
+ 4. Push to the branch (`git push origin my-new-feature`)
39
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+
3
+
4
+ desc 'Spec all functionality of gem'
5
+ task :setup do
6
+ p "1"
7
+ #system("rspec spec/*/")
8
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "silence"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
data/bin/silence ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ #require "bundler/setup"
4
+ require "silence"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+ Silence::Setup.start( ARGV )
data/lib/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ ruby '2.2.0'
4
+
5
+ gem 'rake'
6
+ gem 'cucumber', '~> 2.0.0.rc.4'
7
+ gem 'watir-webdriver'
8
+ gem 'page-object'
9
+ gem 'headless'
10
+ gem 'faker'
11
+ gem 'rspec'
12
+ gem 'require_all'
13
+ gem 'data_magic'
@@ -0,0 +1,6 @@
1
+ dev:
2
+ default:
3
+ example_page: http://www.passport.wapstart.ru/registration/?lang=en
4
+ #example_page: http://eurail.ecodev.d7.acquia.adyax.com/
5
+ en:
6
+ example_page: http://google.ru
@@ -0,0 +1,10 @@
1
+ registration_form:
2
+ email: ~email_address(name = 'test_user')
3
+ show_password: true
4
+ password: ~characters(character_count = 8)
5
+ know_about_us: From friend
6
+ first_last_name: ~full_name
7
+ telephone: ~phone_number
8
+ language: ~randomize ['English', 'Русский']
9
+ purpose_of_registration: Place the ads in WapStart ad network
10
+ accept: true
data/lib/cucumber.yml ADDED
@@ -0,0 +1,16 @@
1
+ # ENVIRONMENT is ...
2
+ # BROWSER ...
3
+ # BROWSER_PATH is ...
4
+ # HEADLESS ...
5
+ # BROWSER_PROFILE_PATH ...
6
+
7
+ #<% browser_profile_path = "BROWSER_PROFILE_PATH=/config/browser_profiles/profile.default" %>
8
+
9
+ <% browser_profile_path = "" %> #"BROWSER_PROFILE_PATH=/config/browser_profile/7jrq1qjp.mufe" %>
10
+ <% browser = "BROWSER=firefox" %>
11
+ <% browser_path = "BROWSER_PATH=/opt/firefox_28/firefox" %>
12
+ <% env = "ENVIRONMENT=dev" %>
13
+ <% hdls = "HEADLESS=true" %>
14
+ <% format = "--format SilenceHtml --out reports/report.html --format pretty" %>
15
+
16
+ default: <%= "#{env} #{browser} #{browser_profile_path} #{hdls} #{browser_path} #{format}" %> --backtrace
@@ -0,0 +1,22 @@
1
+ Feature: Example feature
2
+ In order to learn more
3
+ As an information seeker
4
+ I want to find more information
5
+
6
+ Background:
7
+ Given I set "en" subdomain
8
+
9
+ @known_bug
10
+ Scenario: I go to google home page
11
+ Given I go to the "Example" page
12
+ Then I fill registration form
13
+
14
+ @tag
15
+ @tag2
16
+ Scenario: Wrong wait_until
17
+ Given I go to the "Example" page
18
+ Then I wait wrong element
19
+
20
+ @tag3
21
+ Scenario: Broken page
22
+ Given I open broken page
@@ -0,0 +1,19 @@
1
+ class ExamplePage < Page
2
+
3
+ text_field :email, :id => 'mail'
4
+ checkbox :show_password, :id => 'showPassword'
5
+ text_field :password, :id => 'visible-password'
6
+ select_list :know_about_us, :name => 'informationSource'
7
+ text_field :first_last_name, :name => 'fio'
8
+ text_field :telephone, :name => 'phone'
9
+ select_list :language, :name => 'language'
10
+ select_list :purpose_of_registration, :name => 'registrationPurpose'
11
+ checkbox :accept, :id => 'agreement'
12
+
13
+ def fill_registration_form
14
+ DataMagic.load 'user_registration_dataset.yml'
15
+ populate_page_with data_for :registration_form
16
+ end
17
+
18
+ end
19
+
@@ -0,0 +1,9 @@
1
+ require_all "features/pages/widgets/"
2
+
3
+ class Page
4
+ include PageObject
5
+ include DataMagic
6
+
7
+ page_url "<%=params[:url]%>"
8
+
9
+ end
@@ -0,0 +1,14 @@
1
+ class ExampleWidget < PageObject::Elements::Div
2
+
3
+ def example_action
4
+ hello
5
+ end
6
+
7
+ protected
8
+
9
+ def hello
10
+ "Hello, I am the widget"
11
+ end
12
+
13
+ PageObject.register_widget :example_widget, ExampleWidget, :div
14
+ end
@@ -0,0 +1,19 @@
1
+ Then(/^I see social panel$/) do
2
+ p @current_page.social_panel_element #.example_action
3
+ expect(@current_page.social_panel_element.exists?).to be true
4
+ end
5
+
6
+ Then /^I fill registration form$/ do
7
+ filled_data = @current_page.fill_registration_form
8
+ @current_page.submit_form
9
+ end
10
+
11
+ Then /^I wait wrong element$/ do
12
+ @browser.wait_until(1, "Error") do
13
+ @browser.div(:id => 'asd').exists?
14
+ end
15
+ end
16
+
17
+ Then /^I open broken page$/ do
18
+ @browser.goto("http://eurail.ecodev.d7.acquia.adyax.com/")
19
+ end
@@ -0,0 +1,18 @@
1
+ Given /^I go to the "(.*)" page$/ do |page_name|
2
+ raise "Subdomain is not defined." if @subdomain.nil?
3
+ steps %{ Given I go to the "#{page_name}" page on "#{@subdomain}" subdomain }
4
+ end
5
+
6
+ Given /^I go to the "(.*)" page on "(.*)" subdomain$/ do |page_name, subdomain|
7
+ @subdomain = subdomain
8
+ page_name_class = generate_page_class_name(page_name)
9
+ page_name_key = generate_page_name_key page_name
10
+ visit_page page_name_class, :using_params =>{:url => project_urls[subdomain][page_name_key]} do |page|
11
+ puts "I am on #{page.current_url}"
12
+ end
13
+ end
14
+
15
+ Given /^I set "(.*)" subdomain$/ do |subdomain|
16
+ puts "I am on #{subdomain} subdomain"
17
+ @subdomain = subdomain
18
+ end
@@ -0,0 +1,50 @@
1
+ require 'rspec/expectations'
2
+ require 'page-object'
3
+ require 'watir-webdriver'
4
+ require 'require_all'
5
+ require 'headless'
6
+
7
+ # require all necessary classes
8
+ require_all 'features/pages'
9
+ require_all 'features/support/lib'
10
+
11
+ #setup_env_params
12
+
13
+ if ENV['HEADLESS'] == "true"
14
+ headless = Headless.new.start
15
+ end
16
+
17
+ if ENV['BROWSER_PATH']
18
+ Selenium::WebDriver::Firefox.path = ENV['BROWSER_PATH']
19
+ end
20
+
21
+ if ENV['BROWSER'] == 'firefox'
22
+ if ENV['PROFILE_NAME']
23
+ browser = Watir::Browser.new :firefox, :profile => ENV['PROFILE']
24
+ elsif ENV['BROWSER_PROFILE_PATH']
25
+ profile_path = "#{Dir.getwd}#{ENV['BROWSER_PROFILE_PATH']}"
26
+ profile = Selenium::WebDriver::Firefox::Profile.new(profile_path)
27
+ browser = Watir::Browser.new :firefox, :profile => profile
28
+ else
29
+ browser = Watir::Browser.new :ff
30
+ end
31
+
32
+ end
33
+
34
+ browser.driver.manage.timeouts.implicit_wait=10
35
+
36
+ # Include framework modules
37
+ World PageObject::PageFactory
38
+
39
+ Before do |scenario|
40
+ @browser = browser
41
+ end
42
+
43
+ After do |scenario|
44
+ screenshot_timestamp = Time.now.strftime("%Y-%m-%d %H:%M:%S").gsub(" ", "_")
45
+ embed_screenshot("reports/#{screenshot_timestamp}screenshot.png") if scenario.failed?
46
+ end
47
+
48
+ at_exit do
49
+ browser.close
50
+ end
@@ -0,0 +1,155 @@
1
+ require 'cucumber/formatter/html.rb'
2
+
3
+ # Very simple report with execution status for each scenario without steps description.
4
+ class SilenceHtml < Cucumber::Formatter::Html
5
+
6
+ def tag_name(tag_name)
7
+ @tags = [] if @tags.nil?
8
+ @tags << tag_name
9
+ end
10
+
11
+ def scenario_name(keyword, name, file_colon_line, source_indent)
12
+ @builder.span(:class => 'scenario_file') do
13
+ @builder << file_colon_line
14
+ end
15
+ @listing_background = false
16
+ unless @tags.nil?
17
+ if @tags.include? "@known_bug"
18
+ @known_bug_h3 = "known_bug_title"
19
+ else
20
+ @known_bug_h3 = "normal_title"
21
+ end
22
+ end
23
+ @builder.h3(:id => "scenario_#{@scenario_number}", :class => @known_bug_h3) do
24
+ @builder.span(keyword + ':', :class => 'keyword')
25
+ @builder.text!(' ')
26
+ @builder.span(name, :class => 'val')
27
+ @builder.text!(' ')
28
+ @builder.span("")
29
+ tags_in_title(@tags)
30
+ end
31
+ @tags = nil
32
+ end
33
+
34
+ def build_exception_detail(exception)
35
+ backtrace = Array.new
36
+ @builder.div(:class => 'message') do
37
+ message = exception.message
38
+
39
+ unless exception.instance_of?(RuntimeError)
40
+ message = "#{message} (#{exception.class})"
41
+ end
42
+
43
+ @builder.pre do
44
+ @builder.text!(message)
45
+ end
46
+ end
47
+ @builder.div(:class => 'backtrace') do
48
+ @builder.a("backtrace", :class => 'backtrace_toggle')
49
+ @builder.pre(:class => 'backtrace_details', style: "display:none") do
50
+ exception.backtrace.each { |trace|
51
+ if trace.include? Dir.getwd
52
+ @builder.span(style: "font-weight:bold;") do
53
+ @builder << "#{trace}\n"
54
+ end
55
+ else
56
+ @builder.span(style: "color: #303030;") do
57
+ @builder << "#{trace}\n"
58
+ end
59
+ end
60
+ }
61
+ end
62
+ end
63
+ extra = extra_failure_content(exception.backtrace)
64
+ @builder.div do
65
+ @builder.a("ruby code", :class => 'ruby_error_toggle')
66
+ @builder.div(:class => "ruby_error", :style => "display:none;") do
67
+ @builder << extra unless extra == ""
68
+ end
69
+ end
70
+ end
71
+
72
+ def tags_in_title(tags)
73
+ unless tags.nil?
74
+ tags.each do |tag|
75
+ @builder.span(tag, :class => 'tag_in_title')
76
+ end
77
+ end
78
+ end
79
+
80
+ def before_steps(steps)
81
+ @builder << '<ol style="display:none;">'
82
+ end
83
+
84
+ def inline_css
85
+ super
86
+ @builder.style(:type => 'text/css') do
87
+ @builder << File.read(File.dirname(__FILE__) + '/inline_css.css')
88
+ end
89
+ end
90
+
91
+ # Adds custom inline JavaScript code
92
+ def inline_js_content
93
+ File.read(File.dirname(__FILE__) + '/inline_js.js')
94
+ end
95
+
96
+ def inline_js_content
97
+ <<-EOF
98
+ SCENARIOS = "h3[id^='scenario_'],h3[id^=background_]";
99
+ $(document).ready(function() {
100
+ $(SCENARIOS).css('cursor', 'pointer');
101
+ $(SCENARIOS).click(function() {
102
+ $(this).siblings().toggle(250);
103
+ });
104
+ $("#collapser").css('cursor', 'pointer');
105
+ $("#collapser").click(function() {
106
+ $(SCENARIOS).siblings().hide();
107
+ });
108
+ $("#expander").css('cursor', 'pointer');
109
+ $("#expander").click(function() {
110
+ $(SCENARIOS).siblings().show();
111
+ });
112
+ })
113
+ $(document).ready(function() {
114
+ $(".backtrace_toggle").css('cursor', 'pointer');
115
+ $(".backtrace_toggle").click(function() {
116
+ $(this).siblings().toggle(250);
117
+ });
118
+ $("#collapser").css('cursor', 'pointer');
119
+ $("#collapser").click(function() {
120
+ $(".backtrace_toggle").siblings().hide();
121
+ });
122
+ $("#expander").css('cursor', 'pointer');
123
+ $("#expander").click(function() {
124
+ $(".backtrace_toggle").siblings().show();
125
+ });
126
+ })
127
+ $(document).ready(function() {
128
+ $(".ruby_error_toggle").css('cursor', 'pointer');
129
+ $(".ruby_error_toggle").click(function() {
130
+ $(this).siblings().toggle(250);
131
+ });
132
+ $("#collapser").css('cursor', 'pointer');
133
+ $("#collapser").click(function() {
134
+ $(".ruby_error_toggle").siblings().hide();
135
+ });
136
+ $("#expander").css('cursor', 'pointer');
137
+ $("#expander").click(function() {
138
+ $(".ruby_error_toggle").siblings().show();
139
+ });
140
+ })
141
+ function moveProgressBar(percentDone) {
142
+ $("cucumber-header").css('width', percentDone +"%");
143
+ }
144
+ function makeRed(element_id) {
145
+ $('#'+element_id).css('background', '#660000');
146
+ $('#'+element_id).css('color', '#FFFFFF');
147
+ }
148
+ function makeYellow(element_id) {
149
+ $('#'+element_id).css('background', '#FAF834');
150
+ $('#'+element_id).css('color', '#000000');
151
+ }
152
+ EOF
153
+ end
154
+
155
+ end