ex.
UIImage *sumIm = [UIImage imageNamed:@"259-list.png"];
UIBarButtonItem *summaryBtn = [[UIBarButtonItem alloc]
initWithImage:sumIm
style:UIBarButtonItemStyleBordered
target:self
action:@selector(buttonTouchedSummary:)];
summaryBtn.accessibilityLabel = @"checkin summary";
[self.navigationItem setRightBarButtonItem:summaryBtn animated:YES];
then i use the following navigation bar steps (that i wrote):
# will not work to detect left/right buttons
def index_of_navbar_button (name)
titles = query("navigationButton", :accessibilityLabel)
titles.index(name)
end
def should_see_navbar_button (name)
idx = index_of_navbar_button name
if idx.nil?
screenshot_and_raise "there should be a navbar button named #{name}"
end
end
def should_not_see_navbar_button (name)
idx = index_of_navbar_button name
unless idx.nil?
screenshot_and_raise "i should not see a navbar button named #{name}"
end
end
Then /^I should (not see|see) (?:the|an?) "([^"]*)" button in the navbar$/ do |visibility, name|
if visibility.eql? "see"
should_see_navbar_button name
else
should_not_see_navbar_button name
end
end
ex.
Then I should not see the "summary" button in the navbar
Then I should see a "export" button in the navbar
i hope this helps.
jjm