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

Selenium test #5

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Mastercuber
Copy link

@Mastercuber Mastercuber commented Jul 13, 2023

I was a bit curious about selenium and thought I will create a PR from the result.

This is another PR, based on #4, adding a selenium test to the project. For this to work, python needs to be installed. With the setup script, a python environment is created and the needed modules gets installed (requirements.txt). Afterwards the tests can be run with python test.py.

On Ubuntu 22.0.4 with Gnome Desktop Environment the actual flow of opening the browser, navigating to dwds, selecting text and redirect to dwds again, by navigating to - and clicking - the context men item, with the selected text as search term, is working seamlessly.

Unfortunately an "open context menu and click arrow down on the keyboard" with selenium isn't practical for reaching the context menu entries, therefore, pyautogui is also needed.

When problems occur while running this on another OS than Ubuntu, feel free to report.

@adbar
Copy link
Member

adbar commented Jul 13, 2023

Thanks, I'll look at it soon.

@Mastercuber
Copy link
Author

Recently I've added another test to the PR for searching with the omnibox API.

@Mastercuber
Copy link
Author

Actually, this PR is more a representation of functions instead of a test

@Mastercuber
Copy link
Author

Mastercuber commented Jul 15, 2023

Now the tests are also working for Windows 10 (tested in a VM)

@adbar
Copy link
Member

adbar commented Aug 2, 2023

Is the PR ready or still work in progress?

@Mastercuber Mastercuber changed the title [WIP] Selenium test Selenium test Aug 2, 2023
@Mastercuber
Copy link
Author

This PR is working for firefox 116.0 on Windows and on Linux systems.

It could be, that it's for successful execution of the test.py script - on some systems - necessary, to adjust the caret move value (y value) (in select_text_and_click_context_menu_entry function) to actually hit the context menu entry.

That's the reason, why the PR was marked as WIP. But for a feature representation of the plugin, it should be enough, also if the context menu entry is not hit. The test will go on and search with the omnibox API.

So I would say, with this in mind, it is mergable now.

@Mastercuber
Copy link
Author

This commit should clarify what I mean with "adjust the caret move value (y value)"

@adbar
Copy link
Member

adbar commented Aug 2, 2023

Thanks, I will get a look at it as soon as I get a chance.

@Mastercuber
Copy link
Author

Mastercuber commented Aug 2, 2023

@adbar honestly, the selenium tests are not really needed. I was just curious and though I will share this, since it's a feature representation. If the review of this could take too much time, just ignore this PR!

But if python is installed, executing the tests should be pretty easy. There is a script (setup-tests.sh) which sets up a virtual env. On windows, of course, you need to use WSL or write a BAT script.

All steps are documented in the README.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants