watir-search 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/Gemfile +3 -0
- data/README.md +27 -0
- data/Rakefile +22 -0
- data/spec/search_spec.rb +38 -0
- data/watir-search.gemspec +16 -0
- metadata +7 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c0d4c1fa963a95c7d7dba70b2e01031ea0d4ab4
|
4
|
+
data.tar.gz: cd3b89676616327c828ffe8da4e325861289caf4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d547f36cdc0decd790f6e8052b09ed913a6b8d30a1c51139aa1430a82ea84a0ec557ff0355b6600e53ec80abcb0b3e94ce2fc6785f5133f10060db48f0cc610
|
7
|
+
data.tar.gz: 243906e53bd11f0c83528f59d9e21da2eeb5b1fff34b784a3f2d771fd9a0fa59505460fc016311a537f94dd8a65323489d69bf7c329be17f54e6529d1c090dd5
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# watir-search
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
- Install Gem
|
6
|
+
|
7
|
+
```bash
|
8
|
+
$ gem install watir-search
|
9
|
+
```
|
10
|
+
|
11
|
+
- Install browser
|
12
|
+
|
13
|
+
[Firefox](https://www.mozilla.org/en-US/firefox/desktop/) is required.
|
14
|
+
|
15
|
+
## Get Started
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
require 'watir-search'
|
19
|
+
|
20
|
+
Watir::Search.new('www.sogou.com').execute('Ruby')
|
21
|
+
```
|
22
|
+
|
23
|
+
## Test
|
24
|
+
|
25
|
+
```bash
|
26
|
+
$ rake spec
|
27
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
task default: %w(test)
|
2
|
+
|
3
|
+
desc 'test'
|
4
|
+
task :spec, :spec_name, :examples do |_t, args|
|
5
|
+
require 'rspec/core/rake_task'
|
6
|
+
execute_spec = lambda do |function_name|
|
7
|
+
RSpec::Core::RakeTask.new do |st|
|
8
|
+
st.rspec_opts = "--format d --color #{@example}"
|
9
|
+
st.pattern = "spec/#{function_name}_spec.rb" if function_name
|
10
|
+
end
|
11
|
+
end
|
12
|
+
if args.spec_name
|
13
|
+
if args.examples
|
14
|
+
@example = ''
|
15
|
+
example_array = args.examples.split(' ')
|
16
|
+
example_array.each { |e| @example += "--example '#{e}' " }
|
17
|
+
end
|
18
|
+
execute_spec.call(args.spec_name)
|
19
|
+
else
|
20
|
+
execute_spec.call(nil)
|
21
|
+
end
|
22
|
+
end
|
data/spec/search_spec.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
require 'watir-search'
|
3
|
+
|
4
|
+
describe 'Watir Search' do
|
5
|
+
before do
|
6
|
+
@initial_browser = -> (url) { @search = Watir::Search.new(url) }
|
7
|
+
end
|
8
|
+
|
9
|
+
after do
|
10
|
+
@search.quit
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'can load view methods' do
|
14
|
+
@initial_browser.call('www.sogou.com')
|
15
|
+
methods = @search.methods
|
16
|
+
%w(search enter).each do |key|
|
17
|
+
expect(methods).to include("general_#{key}".to_sym)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def search_text_and_assert
|
22
|
+
@search.execute('Ruby', timeout: 5)
|
23
|
+
expect(@search.sys.title).to include('Ruby')
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'can search text' do
|
27
|
+
%w(sogou baidu).each do |site|
|
28
|
+
@initial_browser.call("www.#{site}.com")
|
29
|
+
search_text_and_assert
|
30
|
+
@search.quit
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'can search text on google' do
|
35
|
+
@initial_browser.call('www.google.com/ncr')
|
36
|
+
search_text_and_assert
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'watir-search'
|
3
|
+
s.version = '0.0.4'
|
4
|
+
s.date = '2015-07-21'
|
5
|
+
s.summary = 'Watir Search'
|
6
|
+
s.description = 'A simple web search by Watir'
|
7
|
+
s.authors = ['Chao Li']
|
8
|
+
s.email = 'chaoli46@yahoo.com'
|
9
|
+
s.files = `git ls-files`.split("\n")
|
10
|
+
s.homepage = 'https://github.com/chaoli46/watir-search'
|
11
|
+
s.license = 'MIT'
|
12
|
+
|
13
|
+
s.require_paths = ['lib']
|
14
|
+
s.add_runtime_dependency 'watir-webdriver', '~> 0.8'
|
15
|
+
s.add_development_dependency 'rspec', '~> 3.3'
|
16
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: watir-search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chao Li
|
@@ -44,9 +44,15 @@ executables: []
|
|
44
44
|
extensions: []
|
45
45
|
extra_rdoc_files: []
|
46
46
|
files:
|
47
|
+
- ".gitignore"
|
48
|
+
- Gemfile
|
49
|
+
- README.md
|
50
|
+
- Rakefile
|
47
51
|
- lib/watir-search.rb
|
48
52
|
- lib/watir-search/load_view.rb
|
49
53
|
- lib/watir-search/search_engine.yml
|
54
|
+
- spec/search_spec.rb
|
55
|
+
- watir-search.gemspec
|
50
56
|
homepage: https://github.com/chaoli46/watir-search
|
51
57
|
licenses:
|
52
58
|
- MIT
|