This repository has been archived by the owner on Sep 25, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
Selenium-Chrome rspec test integration #283
Open
llja0112
wants to merge
10
commits into
Coursemology:development
Choose a base branch
from
llja0112:master
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9e573a3
Merge pull request #1 from Coursemology/master
llja0112 d2f9c7b
Merge pull request #3 from Coursemology/development
llja0112 2664a9b
Merge pull request #4 from Coursemology/development
llja0112 4aab5e7
Merge branch 'test/hackathon-tests' of https://github.com/wangqiang12…
llja0112 3568ad0
Added selenium and made it worked but it is very buggy
llja0112 64254fd
Merge pull request #5 from Coursemology/development
llja0112 bb9798c
Made selenium driver work with the current rspec tests
llja0112 b761fb5
Merge pull request #6 from Coursemology/development
llja0112 848e903
Merged selenium related changes with development code
llja0112 a88d9f6
Merge branch 'rspec-test'. Can do selenium-chrome tests now.
llja0112 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe "AnnouncementPages", :type => :request do | ||
|
||
let(:admin) {FactoryGirl.create(:admin)} | ||
let(:course) { FactoryGirl.create(:course) } | ||
before do | ||
sign_in admin | ||
create_course course | ||
end | ||
|
||
describe "Announcement Creation", :js => true do | ||
before do | ||
visit course_announcements_path(course) | ||
end | ||
|
||
describe "Test 1" do | ||
it "shows the new button" do | ||
expect(page).to have_link('New', href: new_course_announcement_path(course)) | ||
end | ||
end | ||
|
||
describe "create action" do | ||
before do | ||
click_link 'New' | ||
end | ||
|
||
it "displays the content" do | ||
expect(page).to have_field("announcement_title") | ||
expect(page).to have_selector("iframe.wysihtml5-sandbox") | ||
end | ||
|
||
describe "with valid information" do | ||
let(:announcement) {FactoryGirl.build(:announcement)} | ||
before do | ||
fill_in 'announcement_title', with: announcement.title | ||
page.execute_script("$('#announcement_description').attr('value','abcd');") | ||
end | ||
|
||
it "should create an announcement", :js => true do | ||
expect(page).to have_selector("textarea[value='abcd']", visible: false) | ||
expect { click_button 'Create'}.to change(Announcement, :count).by(1) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
RSpec.configure do |config| | ||
|
||
config.before(:suite) do | ||
DatabaseCleaner.clean_with(:truncation) | ||
load Rails.root + "db/seeds.rb" | ||
# puts "before suite" | ||
end | ||
|
||
config.before(:each) do | ||
DatabaseCleaner.strategy = :transaction | ||
# puts "Before Normal" | ||
end | ||
|
||
config.before(:each, :js => true) do | ||
Capybara.current_driver = :selenium_chrome | ||
DatabaseCleaner.strategy = :truncation | ||
# puts "Before JS" | ||
end | ||
|
||
config.before(:each) do | ||
DatabaseCleaner.start | ||
# puts "Before all" | ||
end | ||
|
||
config.after(:each, :js => true) do | ||
load Rails.root + "db/seeds.rb" | ||
Capybara.use_default_driver | ||
# puts "After JS" | ||
end | ||
|
||
config.after(:each) do | ||
DatabaseCleaner.clean | ||
# puts "After all" | ||
end | ||
|
||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The title must have an actual meaning