Code Monkey home page Code Monkey logo

Comments (15)

sambuddhabasu avatar sambuddhabasu commented on July 23, 2024

@smcgregor Presently, the safari tests run locally and on SauceLabs without the extension.
The next thing I am targeting is to run the selenium tests locally with the extension. I will have to implement a function configure_for_safari_extension but I am not completely sure how to go about it. Can you link me to some documentation or some existing examples which help me do the same?
Thanks

from privly-safari.

sambuddhabasu avatar sambuddhabasu commented on July 23, 2024

@smcgregor The PR regarding running the tests locally on Safari with the extension is privly/privly-applications#260

from privly-safari.

smcgregor avatar smcgregor commented on July 23, 2024

I think Apple may have removed the ability to programmatically install extensions via Selenium for security reasons. I recommend starting with locally testing the browser extension by pre-installing it to Safari. This will mean you can test the extension from Selenium without installing it from Selenium.

Testing on SauceLabs will be trickier, but let's get local testing running before we starting thinking about that.

from privly-safari.

sambuddhabasu avatar sambuddhabasu commented on July 23, 2024

@smcgregor I have found https://code.google.com/p/selenium/wiki/RubyBindings#Safari . Though I am not completely sure if this will work, I am currently trying to make this work.
I will also try as you mentioned, to first install the extension and then run the Selenium tests.

from privly-safari.

sambuddhabasu avatar sambuddhabasu commented on July 23, 2024

@smcgregor Presently, when I install the extension in Safari, I need to know the base URL of the safari extension in order for the tests to run. But, we do not currently get the first run page to know the URL of the extension. What do you think about this?

from privly-safari.

smcgregor avatar smcgregor commented on July 23, 2024

The problem on Chrome is that the URL can cryptographically change depending on whose system they are running their development version on. Is this the case on Safari? Why can't you hard-code the address?

from privly-safari.

sambuddhabasu avatar sambuddhabasu commented on July 23, 2024

@smcgregor The safari extension have a URL such as safari-extension://com.privly.privly-34B3M269R6/32c12845/. The last 8 characters are alpha-numeric characters which change every time the extension is loaded. Hence, the extension URL cannot be hard-coded.
One way to get the extension URL without going through the first-run page, is to send a message to the extension using the JS console and getting the extension base URL as a response. This way, once we know the extension base URL, we can then set that URL as the base URL for all the selenium tests.
What do you think about this?

from privly-safari.

smcgregor avatar smcgregor commented on July 23, 2024

Ah, ok. I think you should create a version of this file. You will need to add a first-run page for it to work. It basically waits for an extension context page to open then grabs the URL from the page.

from privly-safari.

sambuddhabasu avatar sambuddhabasu commented on July 23, 2024

@smcgregor Yes, I have tried creating this file but the first-run page on Safari does not load up for tests as the extension is already previously installed.
I am planning to send a message from the test to the extension and getting the extension base URL as the response.

from privly-safari.

smcgregor avatar smcgregor commented on July 23, 2024

Good point. Another option would be to initiate the posting process and to grab the resulting window's URL.

from privly-safari.

sambuddhabasu avatar sambuddhabasu commented on July 23, 2024

@smcgregor I will open a new PR in the privly-safari repo to support sending a message to the extension and getting back the extension base URL as a response.

from privly-safari.

sambuddhabasu avatar sambuddhabasu commented on July 23, 2024

Getting the URL from the posting process is an option but getting the URL from the extension sendMessage itself is an easier and a safer option.

from privly-safari.

sambuddhabasu avatar sambuddhabasu commented on July 23, 2024

@smcgregor Can you explain how to initiate the posting process presently?

from privly-safari.

smcgregor avatar smcgregor commented on July 23, 2024

from privly-safari.

sambuddhabasu avatar sambuddhabasu commented on July 23, 2024

@smcgregor I have now got the extension URL from the injected application of privly's test page. The commit can be seen at sambuddhabasu/privly-applications@dc8e886
Let me know what you think about this.

from privly-safari.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.