1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2025-02-16 12:34:32 +00:00
os-autoinst-distri-fedora/tests/applications/accessibility/accessibility_menu.pm
2024-11-14 14:17:39 -08:00

105 lines
2.8 KiB
Perl

use base "installedtest";
use strict;
use testapi;
use utils;
# This script checks some of the accessibility features that can
# be accessed via the Desktop menu in the upper corner.
sub open_menu {
# This subroutine opens the Accessibility menu.
assert_and_click('acc_accessibility_menu');
assert_screen('acc_accessibility_menu_shown');
}
sub check_item {
# This subroutine checks if an item is switched on or off
# in the accessibility menu.
my ($item, $switch) = @_;
assert_and_click("acc_$item");
if ($switch eq "off") {
sleep(5);
die("$item should be off but is still visible.") if check_screen("acc_${item}_enabled");
}
else {
assert_screen("acc_${item}_enabled");
}
}
sub click_type {
# This subroutine provides typing ability on a graphical
# keyboard when string needs to be converted into a series
# of assertions and clicks.
my $text = shift;
my @letters = split("", $text);
foreach my $letter (@letters) {
assert_and_click("acc_keyboard_$letter");
}
}
sub run {
my $self = shift;
# Open Firefox and go the Fedora home page to test some font changes.
menu_launch_type('firefox');
assert_screen('apps_run_firefox');
send_key('ctrl-l'); # Focus address bar
type_string('www.fedoraproject.org');
send_key('ret');
assert_screen('acc_fedora_homepage');
# Check high contrast.
open_menu();
check_item('high_contrast');
open_menu();
check_item('high_contrast', 'off');
# Check "zoom".
open_menu();
check_item('zoom');
send_key('alt-super-8');
# Check "bigger_text".
open_menu();
check_item('largetext');
open_menu();
check_item('largetext', 'off');
# Check "keyboard_on_screen".
open_menu();
assert_and_click('keyboard_on_screen');
# Click into a text field (FF search bar)
# and type something on the screen
# using the on-screen keyboard.
assert_and_click('firefox_search_bar');
assert_screen('acc_onscreen_keyboard_visible');
send_key('ctrl-a');
# Type and a new address.
# Note, we do not want to include non-word
# characters to the typing string in order not
# to produce needles with non-word characters
# in their name.
click_type('ask');
assert_and_click('acc_keyboard_dot');
click_type('fedoraproject');
assert_and_click('acc_keyboard_dot');
click_type('org');
assert_and_click('acc_keyboard_enter');
# Check that we have arrived on a Fedora homepage
# Yes, we are aware that there is some risk that
# the server will be down but most of the time,
# this should be fine.
assert_screen('acc_askfedora_homepage');
}
sub test_flags {
return {fatal => 0, always_rollback => 1};
}
1;
# vim: set sw=4 et: