I writing a UI test. It’s purpose is to test that all elements of my ability bar are clickable. To give the context:
I have an ability bar widget which is just a container for Ability item widgets.
Having looked at the documentation for Automation Driver and Automation Spec I set up my tests to find those elements and also test if they can be focused. These tests are succesfull.
However, when I try to MoveToElement and Click, it locates the element however, I get an error saying that the element is not under the cursor. It seems that the game never receives focus (cursor texture stays as the default Windows texture) and because of that, the cursor never moves to my element. IsHovered also fails the test
And here is another point to take into consideration. I am then manually checking the cursor position through the Driver, and my widget’s position and they match, which to me doesnt make sense. Here is the code for that too:
int32 x = Driver->GetCursorPosition().X;
int32 y = Driver->GetCursorPosition().Y;
FText FX = FText::AsNumber(x);
FText FY = FText::AsNumber(y);
int32 ax = SAbilityItem->GetAbsolutePosition().X;
int32 ay = SAbilityItem->GetAbsolutePosition().Y;
FText AX = FText::AsNumber(x);
FText AY = FText::AsNumber(y);
UE_LOG(MyLog, Log, TEXT("Cursor position is %s x, %s y and ability item absolute position is %s x, %s y"), *FX.ToString(), *FY.ToString(), *AX.ToString(), *AY.ToString());
Any help or suggestions will be greatly appreciated.
Update: On 4.25 the main issue is fixed and now the Automation Driver successfully takes control and simulates the input. There is still an issue, where the tests fail the first time. The error is the following:
Failed to load cursor ‘…/…/…/Hannibal/Content/Slate/Cursor/DefaultCursor’ [C:\gamedev\hannibal\main\ue4\Engine\Source\Runtime\Engine\Private\GameViewportClient.cpp(3776)]
It seems the first time it’s trying to load a Hardware cursor through the AutomatedApplication::CreateCursorFromRGBABuffer which is not implemented and returns a null which then gives the above error.
It appears to be an issue of loading the test level/game after the test has started whereas to my understanding it should be the other way around.
So to bypass this issue as a temp solution, run the test once, keep the PIE window open (should stay open on its own), run the test again and it works.
Hi, I’m a novice on Automation Driver and ue4. I am confused on how to create a c++ file to write the test case. I create use the engine editor but it build failed and shows could not found the include file. I just write these lines:
Hi RickMortis2 i know this was a few years back but I was wondering if you where using the automation driver with UMG widgets or had you originally created them from slate? if it was UMG widgets how were you finding the elements? i’ve managed to implement the automation driver with slate but when ever i try with UMG i cant find a way to tag them with the FDriverMetaData ID.