-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Initial Catch2 integration #9199
base: develop
Are you sure you want to change the base?
Conversation
a84a58b
to
e8f3a3d
Compare
Wow that produces a clean test! Do you think this is worth it to keep going? |
Yes, definitely we should keep going. Once I done with both regular and GUI demo tests I will ask you to help with TeamCity to configure the Once we got working environment and couple demo tests I would love to migrate all the rest tests one by one. Yes, this is a long journey, but I like such kind of job. For now I have a blocker to run all tests together - new tests does not create a QT application and fails on not initialized app, but standalone run works fine. Probably there is a conflict or the |
Does this work with all tests? Qt has a bunch of routines that test for conditions repeatedly, executing the event loop in between. |
e8f3a3d
to
8361b22
Compare
Keep moving, the main window is already displayed, will implement a simple GUI test to check a generated phase on not open DB. |
8361b22
to
4aa739c
Compare
@phoerious qt creates that event loop using the macros at the top of test files. Catch2 bunches all tests into one or more exe's, you define the main function and at that point is when you would establish the qt event loop. |
48baab3
to
ee2ba64
Compare
I still have couple ideas to improve tests and add missed test cases for Passphrase Generator but in general it is ready for review. |
You are a machine! This is awesome |
48d7869
to
738910a
Compare
738910a
to
88b905d
Compare
This could happen if you are blocking the event loop, but that would also cause the whole gui to be unresponsive. This can also happen if the button isn't triggering the function you pasted above. Can you set a breakpoint in that function to see if it gets called? |
I made sure the mentioned function is triggered by a breakpoint and additional console logs. void PasswordGeneratorWidget::applyPassword()
{
saveSettings();
m_passwordGenerated = true;
emit appliedPassword(m_ui->editNewPassword->text());
emit closed();
} the first emit closed();
emit appliedPassword(m_ui->editNewPassword->text()); the same the first I think something wrong with this mouse click: AND_WHEN("User clicks Apply Password button")
{
auto* applyPasswordButton = pPwGenWidget->findChild<QPushButton*>("buttonApply");
QTest::mouseClick(applyPasswordButton, Qt::MouseButton::LeftButton);
QApplication::processEvents(); because this variant works fine AND_WHEN("User clicks Apply Password button")
{
// auto* applyPasswordButton = pPwGenWidget->findChild<QPushButton*>("buttonApply");
// QTest::mouseClick(applyPasswordButton, Qt::MouseButton::LeftButton);
// QApplication::processEvents();
QTest::keyClick(pPassPhraseWidget, Qt::Key_Escape); but this one does not work AND_WHEN("User clicks Apply Password button")
{
auto* applyPasswordButton = pPwGenWidget->findChild<QPushButton*>("buttonApply");
QTest::mouseClick(applyPasswordButton, Qt::MouseButton::LeftButton);
QApplication::processEvents();
QTest::keyClick(pPassPhraseWidget, Qt::Key_Escape); even the latest Esc command does not close the widget. I am continue the investigation... |
I think you are getting stuck in the process events call |
The password generator has 3 ways to apply a generated password:
I tried all of them and only this shortcut works fine: QTest::keyClick(pPassPhraseWidget, Qt::Key::Key_S, Qt::ControlModifier); The mouse click does not work as mentioned above. BTW, I found a similar Stackoverflow question. The second shortcut does not work as well: QTest::keyClick(pPassPhraseWidget, Qt::Key::Key_Enter, Qt::ControlModifier); All of these 3 ways work fine in a standalone app. |
This comment was marked as resolved.
This comment was marked as resolved.
88b905d
to
6ad2fbb
Compare
I fixed a crash you had in the fixtureWithDb class. I can replicate the issue with the password generator dialog, but it might be because of sequencing in the test case itself. You should add a wait condition to the "isVisible" check. |
Thank you, you really helped and unblocked me with the crash. |
b9c52e9
to
8b0fec2
Compare
6de6eae
to
b4170fa
Compare
3f59187
to
14d9ba9
Compare
Now the PassphraseGenerator class is covered by 98%.
[Why] With the current implementation it is impossible to get m_wordCount = 0.
This fix is needed for GUI scenario implemented in a single test class. In this case when one scenario is completed and the MainWindow destroyed the next scenario creates another new MainWindow instance but fails on already existent KeeShare instance.
Added new tests, the coverage increased from 50 to 96%.
Added 2 methods will be reused in the following commits.
14d9ba9
to
f2a7dae
Compare
This is a part of migration on Catch2 test framework.
The initial commit includes:
tests2
folder (as temporary name to migrae all tests and then it will be renamed back to the originaltests
)CMakeLists.txt
files for unit and GUI tests.PassphraseGenerator
andTOTP
classes.Supports #5473
Type of change