Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clash when edit (#108) #109

Merged
merged 5 commits into from
Apr 27, 2020
Merged

Fix clash when edit (#108) #109

merged 5 commits into from
Apr 27, 2020

Conversation

yukihirop
Copy link
Owner

@yukihirop yukihirop commented Apr 27, 2020

Summary

Fix #108

An error occurred when the save ran when the alert was displayed like this

image

2020-04-27 17:10:45 WARN Selenium [DEPRECATION] Selenium::WebDriver::Error::UnhandledAlertError is deprecated. Use Selenium::WebDriver::Error::UnexpectedAlertOpenError (ensure the driver supports W3C WebDriver specification) instead.
Selenium::WebDriver::Error::UnexpectedAlertOpenError: unexpected alert open: {Alert text : Would you like to convert your JSON into YAML?}
  (Session info: chrome=81.0.4044.122)
  (Driver info: chromedriver=80.0.3987.16 (320f6526c1632ad4f205ebce69b99a062ed78647-refs/branch-heads/3987@{#185}),platform=Mac OS X 10.14.5 x86_64)
from /Users/fukudayu/Zenlogic/phoenix-development-kit/projects/leonacore/work/vendor/bundle/ruby/2.3.0/gems/selenium-webdriver-3.142.7/lib/selenium/webdriver/remote/response.rb:72:in `assert_ok'

This is an error to the effect that I want to manage the open alert before accessing the local storage.

Work

  • Exclusive access to local storage to save data (Using Mutex)
  • The fix is ​​to accept the Would you like to convert your JSON into YAML? alert if it's displayed and then save it.
  • As for Selenium error, I gave a version of watir to mute the application warning

I still get some warnings but I can't erase them...

$ PATHS_FILE=./oas_docs/src/paths/api/v2/post.yml bundle exec rake routes:oas:editor
I, [2020-04-27T18:56:25.418364 #9596]  INFO -- : [R2-OAS] start
I, [2020-04-27T18:56:25.507094 #9596]  INFO -- : [Generate OAS schema files] start
I, [2020-04-27T18:56:25.507133 #9596]  INFO -- : [Generate OAS schema files] end
I, [2020-04-27T18:56:25.507144 #9596]  INFO -- : [Generate OAS docs from schema files] start
I, [2020-04-27T18:56:25.508034 #9596]  INFO -- :  Use schema file: 	/Users/yukihirop/RubyProjects/r2-oas/example-523/oas_docs/src/openapi.yml
I, [2020-04-27T18:56:25.508425 #9596]  INFO -- :  Use schema file: 	/Users/yukihirop/RubyProjects/r2-oas/example-523/oas_docs/src/external_docs.yml
I, [2020-04-27T18:56:25.509063 #9596]  INFO -- :  Use schema file: 	/Users/yukihirop/RubyProjects/r2-oas/example-523/oas_docs/src/tags.yml
I, [2020-04-27T18:56:25.509547 #9596]  INFO -- :  Use schema file: 	/Users/yukihirop/RubyProjects/r2-oas/example-523/oas_docs/src/info.yml
I, [2020-04-27T18:56:25.509967 #9596]  INFO -- :  Use schema file: 	/Users/yukihirop/RubyProjects/r2-oas/example-523/oas_docs/src/servers.yml
I, [2020-04-27T18:56:25.511509 #9596]  INFO -- :  Use schema file: 	./oas_docs/src/paths/api/v2/post.yml
I, [2020-04-27T18:56:25.512077 #9596]  INFO -- :  Use schema file: 	/Users/yukihirop/RubyProjects/r2-oas/example-523/oas_docs/src/components/schemas/api/v2/post.yml
I, [2020-04-27T18:56:25.512312 #9596]  INFO -- :  Use schema file: 	/Users/yukihirop/RubyProjects/r2-oas/example-523/oas_docs/src/components/requestBodies/api/v2/post.yml
I, [2020-04-27T18:56:25.532341 #9596]  INFO -- : [Generate OAS docs from schema files] end

wait for signal trap ...
2020-04-27 18:56:58 WARN Selenium [DEPRECATION] Selenium::WebDriver::Error::UnhandledAlertError is deprecated. Use Selenium::WebDriver::Error::UnexpectedAlertOpenError (ensure the driver supports W3C WebDriver specification) instead.

wait for signal trap ...

wait for signal trap ...

wait for signal trap ...

wait for signal trap ...
^CI, [2020-04-27T18:57:59.478160 #9596]  INFO -- : [Analyze OAS file] start
I, [2020-04-27T18:57:59.485069 #9596]  INFO -- : [Analyze OAS file (tags)] start
I, [2020-04-27T18:57:59.486442 #9596]  INFO -- :   Write schema file: 	/Users/yukihirop/RubyProjects/r2-oas/example-523/oas_docs/src/tags.yml
I, [2020-04-27T18:57:59.486465 #9596]  INFO -- : [Analyze OAS file (tags)] end
I, [2020-04-27T18:57:59.486477 #9596]  INFO -- : [Analyze OAS file (paths)] start
I, [2020-04-27T18:57:59.492152 #9596]  INFO -- :   Write schema file: 	/Users/yukihirop/RubyProjects/r2-oas/example-523/oas_docs/src/paths/api/v2/post.yml
I, [2020-04-27T18:57:59.492185 #9596]  INFO -- : [Analyze OAS file (paths)] end
I, [2020-04-27T18:57:59.492235 #9596]  INFO -- : [Analyze OAS file (components)] start
I, [2020-04-27T18:57:59.492250 #9596]  INFO -- : [Analyze OAS file (components/schemas)] start
I, [2020-04-27T18:57:59.495393 #9596]  INFO -- :   Write schema file: 	/Users/yukihirop/RubyProjects/r2-oas/example-523/oas_docs/src/components/schemas/api/v2/post.yml
I, [2020-04-27T18:57:59.495423 #9596]  INFO -- : [Analyze OAS file (components/schemas)] end
I, [2020-04-27T18:57:59.495434 #9596]  INFO -- : [Analyze OAS file (components/requestBodies)] start
I, [2020-04-27T18:57:59.497396 #9596]  INFO -- :   Write schema file: 	/Users/yukihirop/RubyProjects/r2-oas/example-523/oas_docs/src/components/requestBodies/api/v2/post.yml
I, [2020-04-27T18:57:59.497421 #9596]  INFO -- : [Analyze OAS file (components/requestBodies)] end
I, [2020-04-27T18:57:59.497434 #9596]  INFO -- : [Analyze OAS file (components/securitySchemes)] start
I, [2020-04-27T18:57:59.498175 #9596]  INFO -- : [Analyze OAS file (components/securitySchemes)] end
I, [2020-04-27T18:57:59.502677 #9596]  INFO -- : [Analyze OAS file (components/parameters)] start
I, [2020-04-27T18:57:59.503489 #9596]  INFO -- : [Analyze OAS file (components/parameters)] end
I, [2020-04-27T18:57:59.503511 #9596]  INFO -- : [Analyze OAS file (components/responses)] start
I, [2020-04-27T18:57:59.504486 #9596]  INFO -- : [Analyze OAS file (components/responses)] end
I, [2020-04-27T18:57:59.504509 #9596]  INFO -- : [Analyze OAS file (components/examples)] start
I, [2020-04-27T18:57:59.505320 #9596]  INFO -- : [Analyze OAS file (components/examples)] end
I, [2020-04-27T18:57:59.505355 #9596]  INFO -- : [Analyze OAS file (components/headers)] start
I, [2020-04-27T18:57:59.506201 #9596]  INFO -- : [Analyze OAS file (components/headers)] end
I, [2020-04-27T18:57:59.506233 #9596]  INFO -- : [Analyze OAS file (components/links)] start
I, [2020-04-27T18:57:59.506917 #9596]  INFO -- : [Analyze OAS file (components/links)] end
I, [2020-04-27T18:57:59.506940 #9596]  INFO -- : [Analyze OAS file (components/callbacks)] start
I, [2020-04-27T18:57:59.507475 #9596]  INFO -- : [Analyze OAS file (components/callbacks)] end
I, [2020-04-27T18:57:59.507489 #9596]  INFO -- : [Analyze OAS file (components)] end
I, [2020-04-27T18:57:59.507499 #9596]  INFO -- : [Analyze OAS file] end
I, [2020-04-27T18:57:59.698026 #9596]  INFO -- : container id: 8ea16e8c0c8b8ae634470caacfd0bb8737fdd52ceac58e7206b45f1f1722e55a removed
I, [2020-04-27T18:57:59.698745 #9596]  INFO -- : [R2-OAS] end

Offenses:

lib/r2-oas/schema/editor.rb:79:11: C: Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
          return nil unless @browser.exists?
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/r2-oas/schema/editor.rb:83:76: W: Lint/UselessAssignment: Useless assignment to variable - e.
            rescue Selenium::WebDriver::Error::UnexpectedAlertOpenError => e
                                                                           ^
lib/r2-oas/schema/editor.rb:85:15: C: Style/IfUnlessModifier: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
              if alert.text.eql?(ALERT_TEXT)
@yukihirop
Copy link
Owner Author

rspec

Finished in 11.53 seconds (files took 1.94 seconds to load)
198 examples, 0 failures

[Coveralls] Outside the CI environment, not sending data.

rubocop

$ be rubocop
Inspecting 153 files
.........................................................................................................................................................

@yukihirop yukihirop force-pushed the fix_clash_when_edit branch from c036bbd to 02a8f83 Compare April 27, 2020 10:01
@yukihirop yukihirop merged commit 906d068 into master Apr 27, 2020
@yukihirop yukihirop deleted the fix_clash_when_edit branch April 27, 2020 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant