diff --git a/Gemfile b/Gemfile index c7fe9fbe3..1fae99a97 100755 --- a/Gemfile +++ b/Gemfile @@ -37,7 +37,6 @@ group :development, :test do gem "pry" gem "rspec-rails" gem "rspec" - gem "selenium-webdriver" gem "simplecov" gem "smarf_doc", git: "https://github.com/RickCarlino/smarf_doc.git" end diff --git a/Gemfile.lock b/Gemfile.lock index f8a59244d..9ef514f12 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -63,8 +63,6 @@ GEM amq-protocol (~> 2.3, >= 2.3.0) case_transform (0.2) activesupport - childprocess (1.0.1) - rake (< 13.0) climate_control (0.2.0) codecov (0.1.14) json @@ -81,7 +79,7 @@ GEM delayed_job_active_record (4.1.4) activerecord (>= 3.0, < 6.1) delayed_job (>= 3.0, < 5) - devise (4.7.0) + devise (4.7.1) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) @@ -98,8 +96,8 @@ GEM factory_bot_rails (5.0.2) factory_bot (~> 5.0.2) railties (>= 4.2.0) - faker (2.1.2) - i18n (>= 0.8) + faker (2.3.0) + i18n (~> 1.6.0) faraday (0.15.4) multipart-post (>= 1.2, < 3) faraday_middleware (0.13.1) @@ -226,7 +224,7 @@ GEM actionpack (>= 5.0) railties (>= 5.0) retriable (3.1.2) - rollbar (2.21.0) + rollbar (2.22.1) rspec (3.8.0) rspec-core (~> 3.8.0) rspec-expectations (~> 3.8.0) @@ -248,14 +246,10 @@ GEM rspec-mocks (~> 3.8.0) rspec-support (~> 3.8.0) rspec-support (3.8.2) - rubyzip (1.2.3) scenic (1.5.1) activerecord (>= 4.0.0) railties (>= 4.0.0) secure_headers (6.1.1) - selenium-webdriver (3.142.3) - childprocess (>= 0.5, < 2.0) - rubyzip (~> 1.2, >= 1.2.2) signet (0.11.0) addressable (~> 2.3) faraday (~> 0.9) @@ -326,7 +320,6 @@ DEPENDENCIES rspec-rails scenic secure_headers - selenium-webdriver simplecov smarf_doc! tzinfo diff --git a/frontend/connectivity/__tests__/index_test.ts b/frontend/connectivity/__tests__/index_test.ts index a17aa63d0..1987a17b7 100644 --- a/frontend/connectivity/__tests__/index_test.ts +++ b/frontend/connectivity/__tests__/index_test.ts @@ -29,7 +29,7 @@ import { handleInbound } from "../auto_sync_handle_inbound"; import { store } from "../../redux/store"; import { DeepPartial } from "redux"; import { Everything } from "../../interfaces"; -import { now } from "../../devices/connectivity/qos"; +import { Actions } from "../../constants"; const NOW = new Date(); const SHORT_TIME_LATER = new Date(NOW.getTime() + 500).getTime(); @@ -67,16 +67,6 @@ describe("dispatchNetworkDown", () => { dispatchNetworkDown("user.api", LONGER_TIME_LATER); expect(store.dispatch).toHaveBeenLastCalledWith(LATER_DOWN); }); - - it("does not falsely mark network of being down", () => { - // This test uses mocked state. - // Please see `jest.mock` calls above. - dispatchNetworkDown("bot.mqtt", now()); - expect(store.dispatch).not.toHaveBeenCalled(); - resetStats(); - dispatchNetworkDown("bot.mqtt", now()); - expect(store.dispatch).toHaveBeenCalled(); - }); }); describe("autoSync", () => { @@ -96,6 +86,6 @@ describe("dispatchQosStart", () => { const id = "hello"; dispatchQosStart(id); expect(store.dispatch) - .toHaveBeenCalledWith({ type: "START_QOS_PING", payload: { id } }); + .toHaveBeenCalledWith({ type: Actions.PING_START, payload: { id } }); }); }); diff --git a/frontend/connectivity/__tests__/ping_mqtt_test.ts b/frontend/connectivity/__tests__/ping_mqtt_test.ts index f878d572c..d19d37cd6 100644 --- a/frontend/connectivity/__tests__/ping_mqtt_test.ts +++ b/frontend/connectivity/__tests__/ping_mqtt_test.ts @@ -1,7 +1,8 @@ jest.mock("../index", () => ({ dispatchNetworkDown: jest.fn(), dispatchNetworkUp: jest.fn(), - dispatchQosStart: jest.fn() + dispatchQosStart: jest.fn(), + pingOK: jest.fn() })); const ANY_NUMBER = expect.any(Number); const mockTimestamp = 0; diff --git a/frontend/connectivity/__tests__/reducer_qos_test.ts b/frontend/connectivity/__tests__/reducer_qos_test.ts index 728cb7e80..d761ae5d4 100644 --- a/frontend/connectivity/__tests__/reducer_qos_test.ts +++ b/frontend/connectivity/__tests__/reducer_qos_test.ts @@ -1,6 +1,5 @@ import { connectivityReducer, DEFAULT_STATE } from "../reducer"; import { Actions } from "../../constants"; -import { networkUp, networkDown } from "../actions"; describe("connectivity reducer", () => { const newState = () => { @@ -19,7 +18,8 @@ describe("connectivity reducer", () => { }); it("handles an `up` QoS ping", () => { - const state = connectivityReducer(newState(), networkUp("bot.mqtt", 1234)); + const action = { type: Actions.PING_OK, payload: { id: "yep", at: 123 } }; + const state = connectivityReducer(newState(), action); const { yep } = state.pings; expect(yep).toBeTruthy(); if (yep) { @@ -28,11 +28,12 @@ describe("connectivity reducer", () => { }); it("handles a `down` QoS ping", () => { - const state = connectivityReducer(newState(), networkDown("bot.mqtt", 1234)); + const action = { type: Actions.PING_OK, payload: { id: "yep" } }; + const state = connectivityReducer(newState(), action); const { yep } = state.pings; expect(yep).toBeTruthy(); if (yep) { - expect(yep.kind).toEqual("timeout"); + expect(yep.kind).toEqual("complete"); } }); }); diff --git a/spec/features/login_spec.rb b/spec/features/login_spec.rb deleted file mode 100644 index f68695d56..000000000 --- a/spec/features/login_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -require "spec_helper" - -describe "the signin process", type: :feature, js: true do - password = "password123" - let!(:user) { FactoryBot.create(:user, password: password) } - login_form_selector = \ - "div.col-sm-5:nth-child(1) > div:nth-child(1) >"\ - " div:nth-child(2) > form:nth-child(1)" - - it "signs me in" do - visit front_page_url - within(login_form_selector) do - fill_in "login_email", with: user.email - fill_in "login_password", with: user.password - fill_in "login_email", with: "" # Trigger blur event - click_button "Login" - end - sleep 3 - expect(page).to have_content "MOTOR COORDINATES (MM)" - end -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d18796fe5..f5976a3e0 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -73,18 +73,6 @@ DatabaseCleaner.strategy = :truncation DatabaseCleaner.clean RSpec.configure do |config| - if DO_INTEGRATION - # Do I need to run `env RAILS_ENV=production npm run build`? - require "capybara/rails" - require "capybara/rspec" - require "selenium/webdriver" - # Be sure to run the server in a separate window! - Capybara.run_server = false - Capybara.app_host = "http://localhost:3000" - Capybara.server_host = "localhost" - Capybara.server_port = "3000" - end - config.color = true # config.fail_fast = 10 config.backtrace_exclusion_patterns = [/gems/]