Skip to content

Commit

Permalink
Moving window resize to the configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
carolyncole committed Feb 9, 2023
1 parent 83c0f8a commit 53d51f1
Show file tree
Hide file tree
Showing 20 changed files with 7 additions and 40 deletions.
6 changes: 6 additions & 0 deletions spec/support/system_specs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@
else
driven_by(:selenium_chrome_headless)
end

# Make the screen larger so the save button is alway on screen. This avoids random `Element is not clickable` errors
Capybara.page.driver.browser.manage.window.resize_to(2000, 2000)
end
config.before(:each, type: :system, js: true, in_browser: true) do
driven_by(:selenium_chrome)

# Make the screen larger so the save button is alway on screen. This avoids random `Element is not clickable` errors
Capybara.page.driver.browser.manage.window.resize_to(2000, 2000)
end
end
2 changes: 0 additions & 2 deletions spec/system/authz_submitter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
Collection.create_defaults
stub_s3
stub_datacite(host: "api.datacite.org", body: datacite_register_body(prefix: "10.34770"))
# Make the screen larger so the save button is alway on screen. This avoids random `Element is not clickable` errors
page.driver.browser.manage.window.resize_to(2000, 2000)
end

it "should not be able to edit someone else's work" do
Expand Down
2 changes: 0 additions & 2 deletions spec/system/authz_super_admin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

before do
stub_datacite(host: "api.datacite.org", body: datacite_register_body(prefix: "10.34770"))
# Make the screen larger so the save button is alway on screen. This avoids random `Element is not clickable` errors
page.driver.browser.manage.window.resize_to(2000, 2000)
end

it "should be able to edit someone else's work" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
let(:file_upload) { Pathname.new(fixture_path).join("dataspace_migration", "attention", "Attention_Awareness_Dorsal_Attention_README.txt").to_s }

before do
page.driver.browser.manage.window.resize_to(2000, 2000)
stub_datacite(host: "api.datacite.org", body: datacite_register_body(prefix: "10.34770"))
stub_request(:get, "https://handle.stage.datacite.org/10.34770/9425-b553")
.to_return(status: 200, body: "", headers: {})
Expand Down
1 change: 0 additions & 1 deletion spec/system/data_migration/baldwin_form_submission_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
let(:doi) { "10.34770/xajd-5n64" }

before do
page.driver.browser.manage.window.resize_to(2000, 2000)
stub_datacite(host: "api.datacite.org", body: datacite_register_body(prefix: "10.34770"))
stub_request(:get, "https://handle.stage.datacite.org/10.34770/xajd-5n64")
.to_return(status: 200, body: "", headers: {})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
let(:doi) { "10.34770/zztk-f783" }

before do
page.driver.browser.manage.window.resize_to(2000, 2000)
stub_datacite(host: "api.datacite.org", body: datacite_register_body(prefix: "10.34770"))
stub_request(:get, "https://handle.stage.datacite.org/10.34770/zztk-f783")
.to_return(status: 200, body: "", headers: {})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
let(:keywords) { "bitKlavier, sample library, piano" }

before do
page.driver.browser.manage.window.resize_to(2000, 2000)
stub_datacite(host: "api.datacite.org", body: datacite_register_body(prefix: "10.34770"))
stub_request(:get, "https://handle.stage.datacite.org/10.34770/r75s-9j74")
.to_return(status: 200, body: "", headers: {})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
let(:keywords) { "de novo genes, synthetic biology, Next-generation sequencing, DNA library" }

before do
page.driver.browser.manage.window.resize_to(2000, 2000)
stub_datacite(host: "api.datacite.org", body: datacite_register_body(prefix: "10.34770"))
stub_request(:get, "https://handle.stage.datacite.org/10.34770/gg40-tc15")
.to_return(status: 200, body: "", headers: {})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
let(:relation_type) { "IsCitedBy" }

before do
page.driver.browser.manage.window.resize_to(2000, 2000)
stub_datacite(host: "api.datacite.org", body: datacite_register_body(prefix: "10.34770"))
stub_request(:get, "https://handle.stage.datacite.org/10.34770/r2dz-ys12")
.to_return(status: 200, body: "", headers: {})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
let(:keywords) { "shock compression, forsterite, phase transition, amorphization" }

before do
page.driver.browser.manage.window.resize_to(2000, 2000)
stub_datacite(host: "api.datacite.org", body: datacite_register_body(prefix: "10.34770"))
stub_request(:get, "https://handle.stage.datacite.org/10.34770/gg40-tc15")
.to_return(status: 200, body: "", headers: {})
Expand Down
1 change: 0 additions & 1 deletion spec/system/data_migration/flume_form_submission_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
let(:keywords) { "vegetation canopy turbulence, flume experiments, scalar diffusion, land-atmosphere interactions" }

before do
page.driver.browser.manage.window.resize_to(2000, 2000)
stub_datacite(host: "api.datacite.org", body: datacite_register_body(prefix: "10.34770"))
stub_request(:get, "https://handle.stage.datacite.org/10.34770/7hyr-rf67")
.to_return(status: 200, body: "", headers: {})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
end

before do
page.driver.browser.manage.window.resize_to(2000, 2000)
stub_datacite(host: "api.datacite.org", body: datacite_register_body(prefix: "10.34770"))
stub_request(:get, "https://handle.stage.datacite.org/10.34770/r75s-9j74")
.to_return(status: 200, body: "", headers: {})
Expand Down
2 changes: 0 additions & 2 deletions spec/system/external_ids_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
before do
stub_datacite(host: "api.datacite.org", body: datacite_register_body(prefix: "10.34770"))
stub_s3
# Make the screen larger so the save button is alway on screen. This avoids random `Element is not clickable` errors
page.driver.browser.manage.window.resize_to(2000, 2000)
end

it "Mints a DOI, but does not mint an ark at any point in the wizard proccess" do
Expand Down
4 changes: 0 additions & 4 deletions spec/system/migrate_submission_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@
end

it "produces and saves a valid datacite record" do
# Make the screen larger so the save button is alway on screen. This avoids random `Element is not clickable` errors
page.driver.browser.manage.window.resize_to(2000, 2000)
sign_in user
visit user_path(user)
click_on(user.uid)
Expand Down Expand Up @@ -69,8 +67,6 @@
end

it "returns the user to the new page so they can recover from an error" do
# Make the screen larger so the save button is alway on screen. This avoids random `Element is not clickable` errors
page.driver.browser.manage.window.resize_to(2000, 2000)
sign_in user
visit user_path(user)
click_on(user.uid)
Expand Down
1 change: 0 additions & 1 deletion spec/system/work_comment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
let(:message) { "@#{user2.uid} Look at this work!" }

before do
page.driver.browser.manage.window.resize_to(2000, 2000)
sign_in user
visit work_path(work)
end
Expand Down
2 changes: 0 additions & 2 deletions spec/system/work_create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@

before do
stub_datacite(host: "api.datacite.org", body: datacite_register_body(prefix: "10.34770"))
# Make the screen larger so the save button is alway on screen. This avoids random `Element is not clickable` errors
page.driver.browser.manage.window.resize_to(2000, 2000)
end
context "happy path" do
it "produces and saves a valid datacite record", js: true do
Expand Down
5 changes: 0 additions & 5 deletions spec/system/work_edit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

before do
stub_datacite(host: "api.datacite.org", body: datacite_register_body(prefix: "10.34770"))
page.driver.browser.manage.window.resize_to(2000, 2000)
end

let(:contents1) do
Expand Down Expand Up @@ -71,8 +70,6 @@

it "allows users to delete one of the uploads" do
allow(ActiveStorage::PurgeJob).to receive(:new).and_call_original
# Make the screen larger so the save button is alway on screen. This avoids random `Element is not clickable` errors
page.driver.browser.manage.window.resize_to(2000, 2000)
expect(page).to have_content "Filename"
expect(page).to have_content "Created At"
expect(page).to have_content "Replace Upload"
Expand All @@ -88,8 +85,6 @@

it "allows users to replace one of the uploads" do
allow(ActiveStorage::PurgeJob).to receive(:new).and_call_original
# Make the screen larger so the save button is alway on screen. This avoids random `Element is not clickable` errors
page.driver.browser.manage.window.resize_to(2000, 2000)
expect(page).to have_content "Filename"
expect(page).to have_content "Created At"
expect(page).to have_content "Replace Upload"
Expand Down
1 change: 0 additions & 1 deletion spec/system/work_show_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

before do
stub_s3
page.driver.browser.manage.window.resize_to(2000, 2000)
end

it "displays related identifiers" do
Expand Down
8 changes: 0 additions & 8 deletions spec/system/work_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@ def value_for(label)
end

it "allows users to modify the order of the creators", js: true do
# Make the screen larger so the save button is alway on screen. This avoids random `Element is not clickable` errors
page.driver.browser.manage.window.resize_to(2000, 2000)
creator = draft_work.resource.creators.first
sign_in user
visit edit_work_path(draft_work)
Expand Down Expand Up @@ -202,8 +200,6 @@ def value_for(label)
end

it "allows users to modify the order of the contributors", js: true do
# Make the screen larger so the save button is alway on screen. This avoids random `Element is not clickable` errors
page.driver.browser.manage.window.resize_to(2000, 2000)
sign_in user
visit edit_work_path(draft_work)
click_on "Additional Metadata"
Expand Down Expand Up @@ -269,8 +265,6 @@ def value_for(label)
end

it "shows the uploads before and after errors", js: true do
# Make the screen larger so the save button is alway on screen. This avoids random `Element is not clickable` errors
page.driver.browser.manage.window.resize_to(2000, 2000)
expect(page).to have_content "us_covid_2019.csv"
fill_in "title_main", with: ""
click_on "Save Work"
Expand All @@ -279,8 +273,6 @@ def value_for(label)
end

it "shows the uploads before and after a valid metadata save", js: true do
# Make the screen larger so the save button is alway on screen. This avoids random `Element is not clickable` errors
page.driver.browser.manage.window.resize_to(2000, 2000)
expect(page).to have_content "us_covid_2019.csv"
fill_in "title_main", with: "updated title"
click_on "Save Work"
Expand Down
5 changes: 1 addition & 4 deletions spec/system/work_upload_max_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
RSpec.describe "File selection", type: :system do
let(:work) { FactoryBot.create :draft_work }
let(:user) { work.created_by_user }
before do
# Make the screen larger so the save button is alway on screen. This avoids random `Element is not clickable` errors
page.driver.browser.manage.window.resize_to(2000, 2000)
end

it "errors when more than 20 files are attached in the wizard", js: true do
sign_in user
visit work_file_upload_path(work)
Expand Down

0 comments on commit 53d51f1

Please sign in to comment.