diff options
author | Janek Bevendorff <janek@jbev.net> | 2020-05-06 23:36:11 +0300 |
---|---|---|
committer | Janek Bevendorff <janek@jbev.net> | 2020-05-07 00:10:41 +0300 |
commit | ad1b333601e32483773d12051ab47bf7c8996ca2 (patch) | |
tree | 904edcc28e868b1b7fe59830302af6a5ad4a88b0 | |
parent | 071cc856da12437fbb555e7a565669297007c54d (diff) |
Make CLI clip test more reliable
-rw-r--r-- | tests/TestCli.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/TestCli.cpp b/tests/TestCli.cpp index 4ebc2f4e6..23b7a007e 100644 --- a/tests/TestCli.cpp +++ b/tests/TestCli.cpp @@ -482,7 +482,7 @@ void TestCli::testClip() QSKIP("Clip test skipped due to missing clipboard tool"); } - QCOMPARE(clipboard->text(), QString("Password")); + QTRY_COMPARE(clipboard->text(), QString("Password")); m_stdoutFile->readLine(); // skip prompt line QCOMPARE(m_stdoutFile->readLine(), QByteArray("Entry's \"Password\" attribute copied to the clipboard!\n")); @@ -493,18 +493,18 @@ void TestCli::testClip() m_stdoutFile->seek(pos); // Output should be empty when quiet option is set. QCOMPARE(m_stdoutFile->readAll(), QByteArray("")); - QCOMPARE(clipboard->text(), QString("Password")); + QTRY_COMPARE(clipboard->text(), QString("Password")); // Username Utils::Test::setNextPassword("a"); clipCmd.execute({"clip", m_dbFile->fileName(), "/Sample Entry", "-a", "username"}); - QCOMPARE(clipboard->text(), QString("User Name")); + QTRY_COMPARE(clipboard->text(), QString("User Name")); // TOTP Utils::Test::setNextPassword("a"); clipCmd.execute({"clip", m_dbFile->fileName(), "/Sample Entry", "--totp"}); - QVERIFY(isTOTP(clipboard->text())); + QTRY_VERIFY(isTOTP(clipboard->text())); // Password with timeout Utils::Test::setNextPassword("a"); @@ -514,8 +514,8 @@ void TestCli::testClip() QStringList{"clip", m_dbFile->fileName(), "/Sample Entry", "1"}); // clang-format on - QTRY_COMPARE_WITH_TIMEOUT(clipboard->text(), QString("Password"), 500); - QTRY_COMPARE_WITH_TIMEOUT(clipboard->text(), QString(""), 1500); + QTRY_COMPARE(clipboard->text(), QString("Password")); + QTRY_COMPARE_WITH_TIMEOUT(clipboard->text(), QString(""), 2000); future.waitForFinished(); @@ -525,8 +525,8 @@ void TestCli::testClip() static_cast<int (Clip::*)(const QStringList&)>(&DatabaseCommand::execute), QStringList{"clip", m_dbFile->fileName(), "/Sample Entry", "1", "-t"}); - QTRY_VERIFY_WITH_TIMEOUT(isTOTP(clipboard->text()), 500); - QTRY_COMPARE_WITH_TIMEOUT(clipboard->text(), QString(""), 1500); + QTRY_VERIFY(isTOTP(clipboard->text())); + QTRY_COMPARE_WITH_TIMEOUT(clipboard->text(), QString(""), 2000); future.waitForFinished(); |