iOS XCUITest isAccessibilityElement always false - ios

Simple test case for UILabel
Given UILabel has following properties set:
label.accessibilityLabel = "Hello"
label.accessibilityTraits = .staticText
label.isAccessibilityElement = false
This test is successful despite "isAccessibilityElement = false", this test gives false positive result - if I run app Voiceover won't read this element.
XCTAssert(app.staticTexts["Hello"].exists)
So I thought adding additional check for isAccessibilityElement, but running UI test it is always false(also when label.isAccessibilityElement = true).
XCTAssert( app.staticTexts["Hello"].isAccessibilityElement) // always false
Am I missing something or "isAccessibilityElement" is not testable?
Is there any other approach how to check if element will be actually picked up by assistant e.g. Voiceover?

Related

changing global variable value neovim

I am trying to define a custom lua configuration for the nvim-qt GUI. In order to do so, I would first like to toggle fullscreen on and off, but I encounter some pretty weird behavior.
vim.g.nvim_qt = {
fullscreen = false,
fontsize = 14,
font_name = 'Iosevka\\ NF:h'
}
local toggle_fullscreen = function ()
vim.g.nvim_qt.fullscreen = not vim.g.nvim_qt.fullscreen
if vim.g.nvim_qt.fullscreen then
return '1'
else
return '0'
end
end
--vim.cmd('call GuiWindowFullScreen(' .. toggle_fullscreen() ..')')
vim.keymap.set('n', '<F11>', ':call GuiWindowFullScreen(' .. toggle_fullscreen() ..')<CR>')
What I would expect, is the value of fullscreen to be toggled on each function call. It however always remains false. Can anyone explain why this happens?
I'm not 100% familiar with the Neovim-qt framework, but your toggle_fullscreen() function does seems to work fine. When running this locally, I get the toggling behavior.
Could you provide some more information how the keymap exactly works? My guess is that the set() function simple runs the toggle_fullscreen once and saves it in the keymap as ":call GuiWindowFullScreen(0)", which leads you to always calling the function with a false value.

How can I find the default value of a property that is part of an Apple framework?

I made a VNRecognizeTextRequest which is part of the Apple's Vision framework.
let request = VNRecognizeTextRequest()
request.customWords = ["Weird word"]
The description of customWords says that it will be ignored if "language correction is disabled."
I assume they are talking about usesLanguageCorrection.
let request = VNRecognizeTextRequest()
request.customWords = ["Weird word"]
request.usesLanguageCorrection = true /// here
I could just set it to true myself. However, I want to know the default value of this -- whether it will be true or false if I don't set it myself.
I could just print it out, but it would be nice if there was something like Jump to Definition:

UITest iOS waitForExistence returns false but element is visible

I am a litte new in iOS UITest so apologises if something does not make sense.
I am trying to assert if a staticText is visible but it always returns false despite being shown.
The Screen looks like this:
The test function code looks like this:
func verifyBlockedAccountsEmptyState() {
print(profileListScreen.app.navigationBars["Blocked Accounts"].waitForExistence(timeout: 5))
print(profileListScreen.app.staticTexts.element.label)
print(profileListScreen.app.staticTexts["No blocked accounts"].waitForExistence(timeout: 5))
var elementLabels = [String]()
for i in 0..<profileListScreen.app.staticTexts.count {
elementLabels.append (profileListScreen.app.staticTexts.element(boundBy: i).label)
}
print("staticTexts -> ", elementLabels)
}
And the output:
true
12:25 PM
false
staticTexts -> ["12:25 PM"]
Any idea?
Thank you
EDIT
If I try to record the XCUIElement I get the following error:
Timestamped Event Matching Error: Failed to find matching element
A problem may be caused by using the wrong element type.
You probably should add a breakpoint and inspect this screen with lldb.
Type po print(app.debugDescription) to print the whole hierarchy of elements and their actual types.
It sounds like you should be assigning an AccessiblityId to part of the view you are interested in. You can see what's available in a given view by getting the container XCUIElement's debugDescription.

LUA - OnUpdate shift modifier

I'm changing something in an Addon for World of Warcraft which are written in Lua.
There is a simple boolean variable which determines if some "all" frames are shown or only specific one.
So when = true then it will only show specific frames
when = false it will show all frames
I want to make a modifier with the shift key to show all frames when the shiftkey is pressed and hide them again when shift is realeased.
if IsShiftKeyDown() then
cfg.aura.onlyShowPlayer = false
else
cfg.aura.onlyShowPlayer = true
end
This is my very simple solution for it which works. The problem here is though it only works on starting of the script. You see in WoW everytime the interface gets loaded it will run the script if not told otherwise. That is not very efficent because I would send my user into a loadingscreen.
OnUpdate should fix my problem here which will run this specific code everytime a frame gets rendered which is pretty handy and is what I want to accomplish.
So this is what I made
local function onUpdate(self,elapsed)
if IsShiftKeyDown() then
cfg.aura.onlyShowPlayer = false
else
cfg.aura.onlyShowPlayer = true
end
end
local shiftdebuffs = CreateFrame("frame")
shiftdebuffs:SetScript("OnUpdate", onUpdate)
My problem is now that it doesn't work. I new to the onUpdate stuff and only copy pasted it from another addon I did which worked fine.
Right it goes straight to = false, which is only happening I think because it is the default.
thanks for the help
Right it goes straight to = false, which is only happening I think because it is the default.
No, there is no "default" branch in the if statement. For the control to get to the then branch the condition has to be evaluated to true. You need to check the logic, but if the script executed cfg.aura.onlyShowPlayer = false, it means that IsShiftKeyDown() was evaluated as true.

World of Warcraft Lua - Changing frame:SetAttribute()

I'm working on an addon for World of Warcraft that completely overhauls the interface to adapt to my play style.
In this addon, I would like to have a large button that acts as a "main dps rotation" for my mage. I would like it to change what spell it casts based on what is optimal at any given time. It doesn't cast the spell automatically, it just presents the next best option for the user.
Here is my code so far:
print "Interface Overhaul : LOADED"
heatingUpIsActive = false
print(heatingUpIsActive)
local Button = CreateFrame("Button", "MyButton", UIParent,"SecureActionButtonTemplate")
Button:SetWidth(256)
Button:SetHeight(256)
Button:SetFrameStrata("HIGH")
Button:SetPoint("LEFT")
Button:SetText("Main Rotation")
Button:RegisterForClicks("AnyUp")
Button:SetAttribute("type", "spell")
Button:SetAttribute("spell", "Fireball")
Button:RegisterEvent("UNIT_AURA");
local function auraGained(self, event, ...)
if (UnitAura("player", "Heating Up")) then
if (heatingUpIsActive == false) then
heatingUpIsActive = true
print (heatingUpIsActive)
print ("Heating Up is active!")
Button:SetAttribute("spell", "Inferno Blast")
end
else
heatingUpIsActive = false
print("Heating Up is NOT active.")
print(heatingUpIsActive)
end
end
Button:SetScript("OnEvent", auraGained);
local tex = Button:CreateTexture("ARTWORK");
tex:SetPoint("LEFT")
tex:SetWidth(256)
tex:SetHeight(256)
tex:SetTexture("Interface\\AddOns\\InterfaceOverhaul\\Button2")
If heatingUpIsActive == true, I would like the button to cast ("spell", "Inferno Blast") instead of ("spell", "Fireball"), but it doesn't work if I place that into the correct part of the if statements.
Any thoughts?
As Mud said, you cannot rebind buttons in combat anymore. Blizzard made this change to prevent bots from being able to automate combat. Notably, in order to cast a spell you need to use one of the secure templates, and these secure templates only allow modification of the attributes that control what they do when you're not in combat. So you cannot have one button change spells mid-combat. Similarly, they also prevent you from modifying attributes like their position or visibility, so you cannot move buttons under the mouse either.
The best you can do is display a visual indicator of what spell should be cast, but rely on the user to actually press the correct button.

Resources