[pve-devel] [PATCH gui-tests] add create ceph install wizard screenshots
Tim Marx
t.marx at proxmox.com
Fri Apr 5 10:40:27 CEST 2019
Signed-off-by: Tim Marx <t.marx at proxmox.com>
---
Proxmox/GUITester.pm | 22 ++++++++++
create_ceph_install_wizard_screenshots | 78 ++++++++++++++++++++++++++++++++++
2 files changed, 100 insertions(+)
create mode 100755 create_ceph_install_wizard_screenshots
diff --git a/Proxmox/GUITester.pm b/Proxmox/GUITester.pm
index a8dda1f..7e02cbc 100644
--- a/Proxmox/GUITester.pm
+++ b/Proxmox/GUITester.pm
@@ -334,6 +334,28 @@ sub extjs_activate_tab {
return $self->component_query_single("panel[itemId='$itemid']", $tabpanel);
}
+sub extjs_set_active_tab_by_index {
+ my ($self, $tabpanel, $index) = @_;
+
+ my $driver = $self->{driver};
+
+ my $js = "var comp = Ext.getCmp(arguments[0].id);" .
+ "var tab = comp.items.getAt(arguments[1]);".
+ "tab.enable();".
+ "comp.setActiveTab(tab);";
+ my $res = $driver->execute_script($js, $tabpanel, $index);
+}
+
+sub extjs_inject_viewmodel_data {
+ my ($self, $component, $key, $value) = @_;
+
+ my $driver = $self->{driver};
+
+ my $js = "Ext.getCmp(arguments[0].id).getViewModel().set(arguments[1],arguments[2]);";
+ my $res = $driver->execute_script($js, $component, $key, $value);
+
+}
+
sub reload {
my ($self) = @_;
diff --git a/create_ceph_install_wizard_screenshots b/create_ceph_install_wizard_screenshots
new file mode 100755
index 0000000..4ecd952
--- /dev/null
+++ b/create_ceph_install_wizard_screenshots
@@ -0,0 +1,78 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use lib '.';
+
+use Data::Dumper;
+use PVE::GUITester;
+
+sub create_ceph_install_wizard_screenshots {
+ my ($gui) = @_;
+
+ my $conn = $gui->apiclient();
+
+ $gui->show_advanced(1);
+
+ $gui->set_inner_window_size(900, 1024);
+
+ my $res = $conn->get("/nodes");
+ my @nodes = map { $_->{node} } @$res;
+
+ # keep in mind that this must be a node without ceph ;)
+ my $nodename = $nodes[0];
+
+ $gui->select_tree_item("node/$nodename");
+
+ my $panel = $gui->component_query_single('pvePanelConfig');
+
+ $gui->select_config_item($panel, 'ceph');
+
+ sleep(1);
+
+ $gui->element_screenshot("gui-node-ceph-install.png", $panel);
+
+ my $window = $gui->component_query_single("pveCephInstallWindow");
+
+ $gui->find_button('Install Ceph-luminous', $window)->click();
+
+ my $wizard = $gui->component_query_single("pveCephInstallWizard");
+
+ $gui->element_screenshot("gui-node-ceph-install-wizard-step0.png", $wizard);
+
+ $gui->find_button('Start installation', $wizard)->click();
+
+ sleep(5); # wait for terminal to load
+
+ $gui->element_screenshot("gui-node-ceph-install-wizard-step1.png", $wizard);
+ $gui->extjs_inject_viewmodel_data($wizard, "configuration", 0);
+
+ my $tabpanel = $gui->component_query_single("tabpanel", $wizard);
+
+ # skip the actual installation
+ $gui->extjs_set_active_tab_by_index($tabpanel, 2);
+
+ $gui->setValue($wizard, 'network', "10.10.10.0/24");
+ $gui->element_screenshot("gui-node-ceph-install-wizard-step2.png", $wizard);
+
+
+
+}
+
+my $gui;
+
+eval {
+
+ local $SIG{TERM} = $SIG{QUIT} = $SIG{INT} = sub { die "got interrupt"; };
+
+ $gui = PVE::GUITester->new(login => 1);
+
+ create_ceph_install_wizard_screenshots($gui);
+};
+my $err = $@;
+
+$gui->quit() if $gui;
+
+die $err if $err;
+
+exit(0);
--
2.11.0
More information about the pve-devel
mailing list