Skip to content

Commit

Permalink
CA APItest issue hunt
Browse files Browse the repository at this point in the history
  • Loading branch information
mmertama committed Mar 19, 2024
1 parent 05bb9c1 commit de31ca7
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions gempyrelib/include/gempyre.h
Original file line number Diff line number Diff line change
Expand Up @@ -457,11 +457,14 @@ namespace Gempyre {
/// test if Element can be accessed. Note that in false it's may be in HTML, but not available in DOM tree.
bool available(const std::string& id) const;


/// @cond INTERNAL
// for testing
void resume();
// for testing
void suspend();
// for testing
bool ui_available() const;
/// @endcond

private:
Expand Down
4 changes: 4 additions & 0 deletions gempyrelib/src/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,3 +519,7 @@ void Ui::flush() {
m_ui->shoot_requests();
}

bool Ui::ui_available() const {
return m_ui->is_connected() && m_ui->is_running();
}

1 change: 1 addition & 0 deletions gempyrelib/src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,7 @@ int GempyreUtils::execute(const std::string& executable, const std::string& para
return static_cast<int>((hi > 32 || hi < 0) ? 0 : hi); //If the function succeeds, it returns a value greater than 32. If the function fails, it returns an error value that indicates the cause of the failure.
}
#else
std::cout << std::endl; // flush
return std::system((executable + " " + parameters + " &").c_str());
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion test/apitests/gempyre_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ void TestUi::SetUp() {
});
const auto wait_start = GempyreUtils::wait_expire(30s, []() {
GempyreUtils::log(GempyreUtils::LogLevel::Error, "Chrome not start");
FAIL() << "Chrome not start!";
FAIL() << "Chrome not start!" << " ui:" << (m_ui->ui_available() ? "ok" : "nok");
std::exit(2);
});
m_ui->on_open([wait_start](){
Expand Down
2 changes: 1 addition & 1 deletion test/apitests/mock_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ constexpr auto WaitExpireTimeout = 10s;


//#define HANDLE_EXPIRE ui.exit()
#define HANDLE_EXPIRE std::abort()
#define HANDLE_EXPIRE FAIL() << "Chrome not start!" << " ui:" << (ui.ui_available() ? "ok" : "nok"); std::abort();

TEST(TestMockUi, openPage_with_page_browser) {
constexpr auto htmlPage = TEST_HTML;
Expand Down

0 comments on commit de31ca7

Please sign in to comment.