8000 Rename WaitForPath to WaitForItem by faaxm · Pull Request #131 · faaxm/spix · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Rename WaitForPath to WaitForItem #131

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

Merged
merged 1 commit into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ set(SOURCES
src/Commands/SetProperty.h
src/Commands/Wait.cpp
src/Commands/Wait.h
src/Commands/WaitForPath.cpp
src/Commands/WaitForPath.h
src/Commands/WaitForItem.cpp
src/Commands/WaitForItem.h

src/CommandExecuter/CommandEnvironment.cpp
src/CommandExecuter/CommandEnvironment.h
Expand Down
2 changes: 1 addition & 1 deletion lib/include/Spix/TestServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class SPIX_EXPORT TestServer {
Rect getBoundingBox(ItemPath path);
bool existsAndVisible(ItemPath path);
std::vector<std::string> getErrors();
bool waitForPath(ItemPath path, std::chrono::milliseconds maxWaitTime);
bool waitForItem(ItemPath path, std::chrono::milliseconds maxWaitTime);

void takeScreenshot(ItemPath targetItem, std::string filePath);
std::string takeScreenshotAsBase64(ItemPath targetItem);
Expand Down
6 changes: 3 additions & 3 deletions lib/src/AnyRpcServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ AnyRpcServer::AnyRpcServer(int anyrpcPort)
"Returns true if the given object exists | existsAndVisible(string path) : bool exists_and_visible",
[this](std::string path) { return existsAndVisible(std::move(path)); });

utils::AddFunctionToAnyRpc<bool(std::string, int)>(methodManager, "waitForPath",
"Returns true if the given object exists and the time is not expired | waitForPath(string path, int "
utils::AddFunctionToAnyRpc<bool(std::string, int)>(methodManager, "waitForItem",
"Returns true if the given object exists and the time is not expired | waitForItem(string path, int "
"millisecondsToWait) : bool exists_and_visible",
[this](std::string path, int ms) { return waitForPath(std::move(path), std::chrono::milliseconds(ms)); });
[this](std::string path, int ms) { return waitForItem(std::move(path), std::chrono::milliseconds(ms)); });

utils::AddFunctionToAnyRpc<std::vector<std::string>()>(methodManager, "getErrors",
"Returns internal errors that occurred during test execution | getErrors() : (strings) [error1, ...]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@
* See LICENSE.txt file in the project root for full license information.
****/

#include "WaitForPath.h"
#include "WaitForItem.h"
#include <Scene/Scene.h>

namespace spix {
namespace cmd {

WaitForPath::WaitForPath(ItemPath path, std::chrono::milliseconds maxWaitTime, std::promise<bool> promise)
WaitForItem::WaitForItem(ItemPath path, std::chrono::milliseconds maxWaitTime, std::promise<bool> promise)
: m_path(std::move(path))
, m_promise(std::move(promise))
, m_maxWaitTime(std::move(maxWaitTime))
{
}

void WaitForPath::execute(CommandEnvironment& env)
void WaitForItem::execute(CommandEnvironment& env)
{
m_promise.set_value(m_itemFound);
}

bool WaitForPath::canExecuteNow(CommandEnvironment& env)
bool WaitForItem::canExecuteNow(CommandEnvironment& env)
{
if (!m_timerInitialized) {
m_timerInitialized = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
namespace spix {
namespace cmd {

class WaitForPath : public Command {
class WaitForItem : public Command {
public:
WaitForPath(ItemPath path, std::chrono::milliseconds maxWaitTime, std::promise<bool> promise);
WaitForItem(ItemPath path, std::chrono::milliseconds maxWaitTime, std::promise<bool> promise);

void execute(CommandEnvironment&) override;
bool canExecuteNow(CommandEnvironment&) override;
Expand Down
6 changes: 3 additions & 3 deletions lib/src/TestServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <Commands/ScreenshotBase64.h>
#include <Commands/SetProperty.h>
#include <Commands/Wait.h>
#include <Commands/WaitForPath.h>
#include <Commands/WaitForItem.h>

#include <Spix/Events/Identifiers.h>

Expand Down Expand Up @@ -174,11 +174,11 @@ std::vector<std::string> TestServer::getErrors()
return result.get();
}

bool TestServer::waitForPath(ItemPath path, std::chrono::milliseconds maxWaitTime)
bool TestServer::waitForItem(ItemPath path, std::chrono::milliseconds maxWaitTime)
{
std::promise<bool> promise;
auto result = promise.get_future();
auto cmd = std::make_unique<cmd::WaitForPath>(path, maxWaitTime, std::move(promise));
auto cmd = std::make_unique<cmd::WaitForItem>(path, maxWaitTime, std::move(promise));
m_cmdExec->enqueueCommand(std::move(cmd));

return result.get();
Expand Down
0