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

Add GUI call functionality to scauto CLI #147

Merged
merged 5 commits into from
Jan 3, 2025

Conversation

spoore1
Copy link
Contributor

@spoore1 spoore1 commented Nov 18, 2024

Add CLI GUI commands to make direct calls to the GUI model library functions necessary for some manual and remotely executed test steps.

As a part of the change to run GUI functions from the CLI, we also need to move the initialization of the screen object in init instead of enter.

resolves #146

Todo:

  • Fix logging

@GeorgePantelakis
Copy link
Collaborator

Please don't mind the unit test failures since unit tests are still a work in progress and they are not reliable yet. I will review the PR ASAP!

Copy link
Collaborator

@GeorgePantelakis GeorgePantelakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are some concerns that I have regarding the introduction of the GUI command.

SCAutolib/cli_commands.py Outdated Show resolved Hide resolved
SCAutolib/cli_commands.py Outdated Show resolved Hide resolved
SCAutolib/cli_commands.py Outdated Show resolved Hide resolved
SCAutolib/cli_commands.py Outdated Show resolved Hide resolved
SCAutolib/cli_commands.py Outdated Show resolved Hide resolved
SCAutolib/models/gui.py Show resolved Hide resolved
@GeorgePantelakis
Copy link
Collaborator

The other problem that I see is that without initialization of the controller, a lot of required packages and modules that are installed dynamically are not installed. So I guess we can skip configuration (by changing the code) but we need to run at least the setup in the controller (and maybe even cleanup).

Add CLI GUI commands to make direct calls to the GUI model library
functions necessary for some manual and remotely executed test steps.

As a part of the change to run GUI functions from the CLI, we also need
to move the initialization of the screen object in __init__ instead of
__enter__.

resolves redhat-qe-security#146
kb_write sent the text directly two keyboard.write() which doesn't
handle uppercase characters.   A workaround is to use keyboard.sent()
to send shift+<char> for the uppercase characters and rely on
keyboard.write() to send the rest.
Copy link
Collaborator

@GeorgePantelakis GeorgePantelakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late review, I was fighting with some other stuff but now it is over. Really great approach, I like it. I have a couple of concerns but it is definitely the right path. I will need to also do more testing with previous tests to see that everything is in order.

SCAutolib/cli_commands.py Outdated Show resolved Hide resolved
SCAutolib/cli_commands.py Outdated Show resolved Hide resolved
SCAutolib/cli_commands.py Outdated Show resolved Hide resolved
SCAutolib/cli_commands.py Outdated Show resolved Hide resolved
SCAutolib/cli_commands.py Show resolved Hide resolved
SCAutolib/cli_commands.py Show resolved Hide resolved
SCAutolib/cli_commands.py Outdated Show resolved Hide resolved
SCAutolib/models/gui.py Show resolved Hide resolved
Copy link
Collaborator

@GeorgePantelakis GeorgePantelakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more change, but I run our tests in the current state of the code and they are passing!!

SCAutolib/cli_commands.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@Jakuje Jakuje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no concerns from my side.

@spoore1 spoore1 force-pushed the cli_add_gui branch 2 times, most recently from e194d89 to 35be8db Compare December 5, 2024 23:40
@spoore1
Copy link
Contributor Author

spoore1 commented Dec 5, 2024

@GeorgePantelakis

One side question for you. I took the NaturalOrderGroup class from here:

pallets/click#513 (comment)

Should I add a note in a commit message or a comment in the cli_commands.py file itself?

@GeorgePantelakis
Copy link
Collaborator

@spoore1 I am not 100% sure how that code works but it won't hurt to add a reference somewhere. I don't mind if it is a comment or in the commit message.

@spoore1 spoore1 force-pushed the cli_add_gui branch 3 times, most recently from 5f2cfab to 482abf4 Compare December 6, 2024 13:29
Updates patch that fix Controller and cli to better handle setup.

Follow up changes per PR review also added to cli_commands.py.

Add note about where NaturalOrderGroup in cli_commands came from.
@ep69
Copy link
Member

ep69 commented Dec 11, 2024

@spoore1 @GeorgePantelakis We just talked with @Jakuje and came up with an idea that it would be really great to have an example and/or documentation and/or tests for the new functionality being added. Motivation behind this is that somebody won't break some of your use-cases in future.

@GeorgePantelakis
Copy link
Collaborator

GeorgePantelakis commented Dec 11, 2024

Hello @ep69 @Jakuje,
I am not sure what you mean by example. Can you, please, elaborate more on that?
For documentation, are you thinking of some kind of readme file for the project? Maybe some improvements on the help message?
For the test part, this is an ongoing problem of SCAutolib (we do not have working unit tests) and it is an item for the near future to create reliable tests and a CI to run them. Created #148

@ep69
Copy link
Member

ep69 commented Dec 11, 2024

Example/documentation/test were only ideas. The important thing from my POV is demonstrating how is this functionality we are adding in this PR used, because it wasn't clear to me (but I am not familiar with the tooling).

I'd like to prevent the situation that 1. this is merged 2. our team uses and develops SCAutolib further and forgets about this use-case 3. we break something for Scott or his team.

Copy link
Collaborator

@GeorgePantelakis GeorgePantelakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run all the tests again with the latest code and everything passes, the logging works (it is not perfect but it is good enough for this stage) and the code seems in order. The Linder fails seem relevant but after the changes we can merge. For the documentation I have created #149 so we can do that in a different PR, doesn't have to be in this one.

@spoore1 spoore1 force-pushed the cli_add_gui branch 2 times, most recently from e1c1c9e to 091f11a Compare December 20, 2024 17:26
@spoore1
Copy link
Contributor Author

spoore1 commented Dec 20, 2024

@GeorgePantelakis ok, I fixed the linter issues but, I had to update the flake8 github workflow to install krb5-config to do so. Is that how it should be fixed or is there something else I should do instead for that?

.github/workflows/flake8.yaml Outdated Show resolved Hide resolved
Copy link
Collaborator

@GeorgePantelakis GeorgePantelakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, @spoore1 if you don't have anything else to add we can merge!

Update to fix logging to work better when multiple scauto commands may
be run.
@spoore1
Copy link
Contributor Author

spoore1 commented Dec 23, 2024

@GeorgePantelakis I found a small issue when I tried setup on a new system. the /tmp/SC-tests directory wasn't created. I added the Path.mkdir() for the html_directory to the logging commit. So far, that's the only thing I've found with a fresh install so I think it's good now.

@spoore1 spoore1 changed the title WIP: Add GUI call functionality to scauto CLI Add GUI call functionality to scauto CLI Dec 23, 2024
@GeorgePantelakis
Copy link
Collaborator

LGTM, if we are okay we can merge

@GeorgePantelakis GeorgePantelakis merged commit 4cd3784 into redhat-qe-security:master Jan 3, 2025
2 of 3 checks passed
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.

Extend CLI to make GUI calls
4 participants