Commit 6c7e97e6 by Vi Huynh

init

parents
source 'https://rubygems.org'
group :development, :test do
# gem 'rspec-rails'
# gem 'capybara-webkit'
gem 'poltergeist', '1.6.0'
gem 'turnip'
# gem 'spork'
# gem 'spork-rails'
gem 'guard'
end
GEM
remote: https://rubygems.org/
specs:
capybara (2.4.4)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
celluloid (0.16.0)
timers (~> 4.0.0)
cliver (0.3.2)
coderay (1.1.0)
diff-lcs (1.2.5)
ffi (1.9.6)
formatador (0.2.5)
gherkin (2.12.2)
multi_json (~> 1.3)
guard (2.8.0)
formatador (>= 0.2.4)
listen (~> 2.7)
lumberjack (~> 1.0)
pry (>= 0.9.12)
thor (>= 0.18.1)
hitimes (1.2.2)
listen (2.7.11)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
lumberjack (1.0.9)
method_source (0.8.2)
mime-types (2.6.1)
mini_portile (0.6.2)
multi_json (1.10.1)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
poltergeist (1.6.0)
capybara (~> 2.1)
cliver (~> 0.3.1)
multi_json (~> 1.0)
websocket-driver (>= 0.2.0)
pry (0.10.1)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
rack (1.6.4)
rack-test (0.6.3)
rack (>= 1.0)
rb-fsevent (0.9.4)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
rspec (3.1.0)
rspec-core (~> 3.1.0)
rspec-expectations (~> 3.1.0)
rspec-mocks (~> 3.1.0)
rspec-core (3.1.7)
rspec-support (~> 3.1.0)
rspec-expectations (3.1.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.1.0)
rspec-mocks (3.1.3)
rspec-support (~> 3.1.0)
rspec-support (3.1.2)
slop (3.6.0)
thor (0.19.1)
timers (4.0.1)
hitimes
turnip (1.2.4)
gherkin (>= 2.5)
rspec (>= 2.14.0, < 4.0)
websocket-driver (0.6.2)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
xpath (2.0.0)
nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
guard
poltergeist (= 1.6.0)
turnip
BUNDLED WITH
1.10.6
# How to install phantomjs
sudo apt-get install -y build-essential chrpath git-core libssl-dev libfontconfig1-dev
git clone git://github.com/ariya/phantomjs.git
cd phantomjs
git checkout 2.0
echo y | ./build.sh
ln -s /home/vagrant/phantomjs/bin/phantomjs /usr/local/bin/phantomjs
cd ..
# How to run test
```
$ brew install phantomjs
$ cd arubaito-ex/e2e
$ rbenv local 2.1.2
$ bundle install
$ bundle exec rspec spec/features/index.feature
```
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
ArubaitoE2eTest::Application.load_tasks
#!/usr/bin/env ruby
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
load Gem.bin_path('bundler', 'bundle')
Feature: page
Scenario: PC city_town/:prefecture_code
Given access development
When visit '/city_town/13'
Then response code is '200'
And check metatag 'robots' with 'noindex,follow'
Scenario: PC town_list/:city_code
Given access development
When visit '/town_list/13101'
Then response code is '200'
And check metatag 'robots' with 'noindex,follow'
Scenario: SP city_town/:prefecture_code
Given access development
Given use smartphone
When visit '/city_town/13'
Then response code is '200'
Scenario: SP town_list/:city_code
Given access development
Given use smartphone
When visit '/town_list/13101'
Then response code is '200'
Dir.glob("spec/steps/*_steps.rb") { |f| load f, true }
require 'capybara/dsl'
require 'capybara/rspec'
require 'capybara/poltergeist'
require 'turnip'
require 'turnip/capybara'
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app,
phantomjs: 'phantomjs',
js_errors: false,
debug: false,
phantomjs_options: ['--load-images=no', '--disk-cache=true'],
timeout: 10
)
end
Capybara.run_server = false
Capybara.default_driver = :poltergeist
Capybara.javascript_driver = :poltergeist
# Capybara.default_driver = :webkit
RSpec.configure do |config|
end
step 'access production' do
Capybara.app_host = 'http://arubaito-ex.jp'
end
step 'access production_ssl' do
Capybara.app_host = 'https://arubaito-ex.jp'
end
step 'access staging' do
Capybara.app_host = 'http://staging.arubaito-ex.jp'
end
step 'access development' do
Capybara.app_host = 'http://localhost:3001'
end
# Get ZIGExN's job item and get it ID
step 'get_sample_job_id' do
visit "http://arubaito-ex.jp/jobs/search_result?keywords=%E6%A0%AA%E5%BC%8F%E4%BC%9A%E7%A4%BE%E3%81%98%E3%81%92%E3%82%93" #=> 株式会社じげん
first(:css, '.jobsResult .jobInfo h2 a')[:href] =~ %r{/jobs/(\d+)}
@latest_job_id = $1.to_i
end
# entry page
step 'visit_sample_entry_page' do
visit "/entries/new?job_ids%5B%5D=#{@latest_job_id}"
end
# jobs page
step 'visit_sample_job_page' do
visit "/jobs/#{@latest_job_id}"
end
step 'check_cookies_has_sample_job' do
expect(page.driver.cookies["history"].value.to_i).to eq(@latest_job_id)
end
step 'have_link_with_sample_job' do
expect(page).to have_selector(%Q{a[href="/jobs/#{@latest_job_id}"]})
end
step 'visit :path' do |path|
visit path
end
step 'response code is :code' do |code|
expect(page.status_code).to eq(code.to_i)
end
step 'response include :string' do |string|
expect(page).to have_content(string)
end
step 'h1 include :string' do |string|
expect(page.find('h1')).to have_content(string)
end
step 'h2 include :string' do |string|
expect(page.find('h2')).to have_content(string)
end
step 'textbox include :string' do |string|
expect(page).to have_selector("input[value=#{string}]")
end
step 'table include :string' do |string|
expect(page).to have_selector("li[value=#{string}]")
end
step 'click link :link' do |link|
first(:xpath, "//a[@href='" + link + "']").click
end
step 'fill in :field_name with :value' do |field_name, value|
fill_in field_name, with: value, :match => :first
end
step 'click button by class :class_name' do |class_name|
first(:xpath, '//input[@class="' + class_name + '"]').click
end
step 'click input button by text :text' do |text|
first(:xpath, '//input[@value="' + text + '"]').click
end
step 'checked with id :id' do |id|
find("##{id}").set(true)
end
step 'selected :field with :value' do |field, value|
select(value, from: field)
end
step 'fill in email' do
fill_in 'user_data[email]', with: "abc#{Time.now.to_i}@gmail.com"
end
step 'use smartphone' do
page.driver.headers = { "User-Agent" => "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53" }
end
step 'check metatag :field with :value' do |field, value|
tag = %Q(meta[name="#{field}"][content="#{value}"])
expect(page).to have_css(tag, visible: false)
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment