Create an automated test to test printing on Desktop
Add functions to test on KDE, too. Signed-off-by: Adam Williamson <awilliam@redhat.com>
15
needles/gnome/printing_check_sentence.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 363,
|
||||||
|
"ypos": 143,
|
||||||
|
"width": 187,
|
||||||
|
"height": 17,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"printing_check_sentence"
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/gnome/printing_check_sentence.png
Normal file
After Width: | Height: | Size: 21 KiB |
15
needles/gnome/printing_print.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"printing_print"
|
||||||
|
],
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 790,
|
||||||
|
"ypos": 134,
|
||||||
|
"width": 40,
|
||||||
|
"height": 19,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/gnome/printing_print.png
Normal file
After Width: | Height: | Size: 49 KiB |
15
needles/gnome/printing_print_completed.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"printing_print_completed"
|
||||||
|
],
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 356,
|
||||||
|
"ypos": 49,
|
||||||
|
"width": 76,
|
||||||
|
"height": 16,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/gnome/printing_print_completed.png
Normal file
After Width: | Height: | Size: 24 KiB |
15
needles/gnome/printing_select_pdfprinter.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"printing_select_pdfprinter"
|
||||||
|
],
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 185,
|
||||||
|
"ypos": 270,
|
||||||
|
"width": 99,
|
||||||
|
"height": 19,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/gnome/printing_select_pdfprinter.png
Normal file
After Width: | Height: | Size: 46 KiB |
15
needles/kde/printing_check_sentence_kde.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"printing_check_sentence"
|
||||||
|
],
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 252,
|
||||||
|
"ypos": 134,
|
||||||
|
"width": 300,
|
||||||
|
"height": 24,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/kde/printing_check_sentence_kde.png
Normal file
After Width: | Height: | Size: 417 KiB |
15
needles/kde/printing_check_sentence_kde_alt.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"printing_check_sentence"
|
||||||
|
],
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 247,
|
||||||
|
"ypos": 136,
|
||||||
|
"width": 305,
|
||||||
|
"height": 20,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/kde/printing_check_sentence_kde_alt.png
Normal file
After Width: | Height: | Size: 54 KiB |
15
needles/kde/printing_check_sentence_kde_alt_2-20191204.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"type": "match",
|
||||||
|
"xpos": 246,
|
||||||
|
"height": 20,
|
||||||
|
"width": 305,
|
||||||
|
"ypos": 136
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"printing_check_sentence"
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/kde/printing_check_sentence_kde_alt_2-20191204.png
Normal file
After Width: | Height: | Size: 46 KiB |
22
needles/kde/printing_pdfprinter_ready_kde.json
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"printing_pdfprinter_ready"
|
||||||
|
],
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 377,
|
||||||
|
"ypos": 98,
|
||||||
|
"width": 69,
|
||||||
|
"height": 18,
|
||||||
|
"type": "match"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"xpos": 377,
|
||||||
|
"ypos": 97,
|
||||||
|
"width": 69,
|
||||||
|
"height": 20,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/kde/printing_pdfprinter_ready_kde.png
Normal file
After Width: | Height: | Size: 433 KiB |
15
needles/kde/printing_print_kde.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"printing_print"
|
||||||
|
],
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 561,
|
||||||
|
"ypos": 229,
|
||||||
|
"width": 57,
|
||||||
|
"height": 19,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/kde/printing_print_kde.png
Normal file
After Width: | Height: | Size: 433 KiB |
43
templates
@ -458,6 +458,28 @@
|
|||||||
},
|
},
|
||||||
test_suite => { name => "desktop_terminal" },
|
test_suite => { name => "desktop_terminal" },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
machine => { name => "64bit" },
|
||||||
|
prio => 20,
|
||||||
|
product => {
|
||||||
|
arch => "x86_64",
|
||||||
|
distri => "fedora",
|
||||||
|
flavor => "Workstation-live-iso",
|
||||||
|
version => "*",
|
||||||
|
},
|
||||||
|
test_suite => { name => "desktop_printing" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
machine => { name => "64bit" },
|
||||||
|
prio => 20,
|
||||||
|
product => {
|
||||||
|
arch => "x86_64",
|
||||||
|
distri => "fedora",
|
||||||
|
flavor => "KDE-live-iso",
|
||||||
|
version => "*",
|
||||||
|
},
|
||||||
|
test_suite => { name => "desktop_printing" },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
machine => { name => "64bit" },
|
machine => { name => "64bit" },
|
||||||
prio => 22,
|
prio => 22,
|
||||||
@ -1930,6 +1952,18 @@
|
|||||||
},
|
},
|
||||||
test_suite => { name => "desktop_terminal" },
|
test_suite => { name => "desktop_terminal" },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
group_name => "Fedora PowerPC",
|
||||||
|
machine => { name => "ppc64le" },
|
||||||
|
prio => 20,
|
||||||
|
product => {
|
||||||
|
arch => "ppc64le",
|
||||||
|
distri => "fedora",
|
||||||
|
flavor => "Workstation-live-iso",
|
||||||
|
version => "*",
|
||||||
|
},
|
||||||
|
test_suite => { name => "desktop_printing" },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
group_name => "Fedora PowerPC",
|
group_name => "Fedora PowerPC",
|
||||||
machine => { name => "ppc64le" },
|
machine => { name => "ppc64le" },
|
||||||
@ -5391,6 +5425,15 @@
|
|||||||
{ key => "HDD_1", value => "disk_%FLAVOR%_%MACHINE%.qcow2" },
|
{ key => "HDD_1", value => "disk_%FLAVOR%_%MACHINE%.qcow2" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name => "desktop_printing",
|
||||||
|
settings => [
|
||||||
|
{ key => "POSTINSTALL", value => "desktop_printing" },
|
||||||
|
{ key => "START_AFTER_TEST", value => "install_default_upload" },
|
||||||
|
{ key => "BOOTFROM", value => "c" },
|
||||||
|
{ key => "HDD_1", value => "disk_%FLAVOR%_%MACHINE%.qcow2" },
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name => "desktop_terminal",
|
name => "desktop_terminal",
|
||||||
settings => [
|
settings => [
|
||||||
|
80
tests/desktop_printing.pm
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
use base "installedtest";
|
||||||
|
use strict;
|
||||||
|
use testapi;
|
||||||
|
use utils;
|
||||||
|
|
||||||
|
sub run {
|
||||||
|
my $self = shift;
|
||||||
|
# Prepare the environment:
|
||||||
|
#
|
||||||
|
# Become root
|
||||||
|
$self->root_console(tty=>3);
|
||||||
|
|
||||||
|
# Create a text file with content to print
|
||||||
|
script_run "cd /home/test/";
|
||||||
|
assert_script_run "echo 'A quick brown fox jumps over a lazy dog.' > testfile.txt";
|
||||||
|
script_run "chmod 666 testfile.txt";
|
||||||
|
# Install the Cups-PDF package to use the Cups-PDF printer
|
||||||
|
assert_script_run "dnf -y install cups-pdf", 180;
|
||||||
|
# Leave the root terminal and switch back to desktop.
|
||||||
|
desktop_vt();
|
||||||
|
my $desktop = get_var("DESKTOP");
|
||||||
|
# some simple variances between desktops. defaults are for GNOME
|
||||||
|
my $editor = "gedit";
|
||||||
|
my $viewer = "evince";
|
||||||
|
my $maximize = "super-up";
|
||||||
|
if ($desktop eq "kde") {
|
||||||
|
$editor = "kwrite";
|
||||||
|
$viewer = "okular";
|
||||||
|
$maximize = "super-pgup";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Open the text editor and print the file.
|
||||||
|
send_key "alt-f2";
|
||||||
|
wait_still_screen(stilltime=>5, similarity_level=>45);
|
||||||
|
type_safely "$editor /home/test/testfile.txt\n";
|
||||||
|
wait_still_screen(stilltime=>5, similarity_level=>44);
|
||||||
|
# Print the file using the Cups-PDF printer
|
||||||
|
send_key "ctrl-p";
|
||||||
|
wait_still_screen(stilltime=>5, similarity_level=>45);
|
||||||
|
if ($desktop eq 'gnome') {
|
||||||
|
assert_and_click "printing_select_pdfprinter";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
# It seems that on newly installed KDE systems with no
|
||||||
|
# printer, the Cups-PDF printer is already pre-selected.
|
||||||
|
# We only check that it is correct.
|
||||||
|
assert_screen "printing_pdfprinter_ready";
|
||||||
|
}
|
||||||
|
wait_still_screen(stilltime=>2, similarity_level=>45);
|
||||||
|
assert_and_click "printing_print";
|
||||||
|
# Exit the application
|
||||||
|
send_key "alt-f4";
|
||||||
|
# Wait out confirmation on GNOME
|
||||||
|
if (check_screen "printing_print_completed", 1) {
|
||||||
|
sleep 30;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Open the pdf file and check the print
|
||||||
|
send_key "alt-f2";
|
||||||
|
wait_still_screen(stilltime=>5, similarity_level=>45);
|
||||||
|
type_safely "$viewer /home/test/Desktop/testfile.pdf\n";
|
||||||
|
wait_still_screen(stilltime=>5, similarity_level=>45);
|
||||||
|
# Resize the window, so that the size of the document fits the bigger space
|
||||||
|
# and gets more readable.
|
||||||
|
send_key $maximize;
|
||||||
|
wait_still_screen(stilltime=>2, similarity_level=>45);
|
||||||
|
# make sure we're at the start of the document
|
||||||
|
send_key "ctrl-home" if ($desktop eq "kde");
|
||||||
|
# Check the printed pdf.
|
||||||
|
assert_screen "printing_check_sentence";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub test_flags {
|
||||||
|
return { fatal => 1 };
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
# vim: set sw=4 et:
|