Hi all,
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
Code snippet:
FDriverElementRef a = Driver->FindElement(By::Id(Tag));
FDriverSequenceRef Sequence = Driver->CreateSequence();
Sequence->Actions()
.Wait(Until::ElementExists(a, FWaitTimeout::InSeconds(3)))
.MoveToElement(a)
.Click(a);
TEST_TRUE(Sequence->Perform());
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.
Thank you in advance,
Kind regards,
Paris