Open monsieuremre opened 5 months ago
It is also trivial to call the script from a github workflow and set it to trigger after every push, needless to say. I can continue with this and push the test script if the current state is satisfactory. Else, I can look into more intricate options that I mentioned.
@monsieuremre please try with pytest-qt. As a test file use the following one: https://github.com/rwth-iat/aas-compliance-tool/blob/main/test/files/test_demo_full_example.json
I have managed to use pytest and qtbot to emulate some stuff. The test has to be called with pytest -s now, so it is not executed directly. We still do the iterating the old way as implemented. We also test if the window becomes visible with the bot as the first test, very basic.
Any further function is still a weak concept because these widgets are very detailed objects and I do not which one to choose and how to interact, since there is no documentation. I still figured out 'some' ways by trial and error and reverse engineering.
I have implemented several functions to find and select buttons based on their names. When I click these buttons, unfortunately, I can't get the expected behavior. I am not sure of the reason but I will look into it. I highly suspect I have to do a little more than just clicking or I'm clicking on the wrong widget. I will need to read the source code more in detail to understand the exact reason.
Solves https://github.com/rwth-iat/aas_manager/issues/27.
First three points are solved in completion. For it to work, the script test.py should be called like one normally would.
python3 test.py /path/to/test.aasx
. A custom test.aasx has to be pushed also as the subject. It can have any format, it does not need to be hardcoded or anything.Potential solution for the last part is also added but commented out, because there is no direct way of closing the dialog window properly. I have implemented a time out mechanism here. Which is a nice workaround, but it is a sub-optimal solution at best.
More intricate ways are possible, still in code, but this would come with more disadvantages than what it would provide. A not so much complicated solution would be maybe using pytest-qt. This would mean that we can just emulate user keyboard strokes and mouse clicks. This would actually be very good solution, but it would force some hardcoding of sorts. We can change our ways to this if it would be desired.