Skip to content

Commit

Permalink
revert back to previous selenium driver setup
Browse files Browse the repository at this point in the history
  • Loading branch information
amtuannguyen committed Aug 27, 2024
1 parent 5a14853 commit 8254a3d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
19 changes: 8 additions & 11 deletions test/application_system_test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,31 @@ def setup
Capybara.default_max_wait_time = 5
Capybara.save_path = "tmp/test-screenshots"

options = Selenium::WebDriver::Chrome::Options.new
super

user = FactoryGirl.create(:user)
login_as(user, role: User::STAFF)
end

driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400] do |options|
options.add_argument('--disable-gpu')
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--window-size=1280,800')

# Add preferences
options.add_preference(:download, {
prompt_for_download: false,
default_directory: File.join(Rails.root, 'tmp')
})
options.add_preference(:browser, set_download_behavior: { behavior: 'allow' })

# Remote driver setup
Capybara.register_driver :my_selenium do |app|
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app,
browser: :remote,
url: "http://#{ENV.fetch('SELENIUM_SERVER')}:4444",
options: options
)
end

super

user = FactoryGirl.create(:user)
login_as(user, role: User::STAFF)
end

driven_by :my_selenium

end
2 changes: 1 addition & 1 deletion test/system/theses_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ThesesTest < ApplicationSystemTestCase
click_link("Under Review Theses")
assert_selector 'a', text: 'Download Excel'
click_link("Download Excel")
filename = File.join(Rails.root, "tmp/theses_report.xlsx")
filename = "tmp/theses_report.xlsx"
wait_for_download(filename)
assert File.exist?(filename), "Expected file #{filename} to be downloaded"
File.delete(filename)
Expand Down

0 comments on commit 8254a3d

Please sign in to comment.