Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement role/formatting/mounting/encryption in libyui #11820

Merged
merged 3 commits into from
Jan 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
41 changes: 41 additions & 0 deletions lib/Installation/Partitioner/LibstorageNG/v4_3/AbstractSizePage.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# SUSE's openQA tests
#
# Copyright © 2021 SUSE LLC
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved. This file is offered as-is,
# without any warranty.

# Summary: Expert Partitioner Page to handles shared functionality
# for partition size. Classes implementing it will provide a new() method
# and its own textbox for 'tb_size' which is different depending on the type
# of partitioning.
# Maintainer: QE YaST <qa-sle-yast@suse.de>

package Installation::Partitioner::LibstorageNG::v4_3::AbstractSizePage;
use strict;
use warnings;

sub init {
my $self = shift;
$self->{rb_custom_size} = $self->{app}->radiobutton({id => 'custom_size'});
$self->{btn_next} = $self->{app}->button({id => 'next'});
return $self;
}

sub set_custom_size {
my ($self, $size) = @_;
if ($size) {
$self->{rb_custom_size}->select();
$self->{tb_size}->set($size);
}
$self->press_next();
}

sub press_next {
my ($self) = @_;
$self->{btn_next}->click();
}

1;
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# SUSE's openQA tests
#
# Copyright © 2020 SUSE LLC
# Copyright © 2020-2021 SUSE LLC
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved. This file is offered as-is,
# without any warranty.

# Summary: The class introduces methods to handle addition of logical
# volumes in Expert Partitioner.
# Summary: Handle page to add a logical volume in Expert Partitioner
# Maintainer: QE YaST <qa-sle-yast@suse.de>

package Installation::Partitioner::LibstorageNG::v4_3::AddLogicalVolumePage;
Expand All @@ -23,58 +22,35 @@ sub new {
my $self = bless {
app => $args->{app}
}, $class;

return $self->init($args);
}

sub init {
my $self = shift;

$self->{tb_lv_name} = $self->{app}->textbox({id => '"Y2Partitioner::Dialogs::LvmLvInfo::NameWidget"'});
$self->{rb_system} = $self->{app}->radiobutton({id => 'system'});
$self->{rb_swap} = $self->{app}->radiobutton({id => 'swap'});
$self->{tb_size} = $self->{app}->textbox({id => '"Y2Partitioner::Dialogs::LvmLvSize::CustomSizeInput"'});
$self->{rb_custom_size} = $self->{app}->radiobutton({id => 'custom_size'});
$self->{btn_next} = $self->{app}->button({id => 'next'});
$self->{rb_thin_pool} = $self->{app}->radiobutton({id => 'thin_pool'});
$self->{rb_thin_volume} = $self->{app}->radiobutton({id => 'thin'});
$self->{btn_next} = $self->{app}->button({id => 'next'});
return $self;
}

sub set_logical_volume_name {
sub enter_name {
my ($self, $lv_name) = @_;
return $self->{tb_lv_name}->set($lv_name);
}

sub set_custom_size {
my ($self, $size) = @_;
$self->{rb_custom_size}->select();
return $self->{tb_size}->set($size);
}

sub select_role {
my ($self, $role) = @_;
$role //= '';
if ($role eq 'operating-system') {
$self->{rb_system}->select();
}
elsif ($role eq 'swap') {
$self->{rb_swap}->select();
}
sub select_type {
my ($self, $type) = @_;
my %types = (
'thin-pool' => $self->{rb_thin_pool},
'thin-volume' => $self->{rb_thin_volume}
);
return $types{$type}->select();
}

sub press_next_button {
sub press_next {
my ($self) = @_;
return $self->{btn_next}->click();
}

sub set_logical_volume_type {
my ($self, $type) = @_;
if ($type eq 'thin_pool') {
$self->{rb_thin_pool}->select();
} elsif ($type eq 'thin_volume') {
$self->{rb_thin_volume}->select();
}
$self->{btn_next}->click();
}

1;
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# SUSE's openQA tests
#
# Copyright © 2021 SUSE LLC
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved. This file is offered as-is,
# without any warranty.

# Summary: Handles encryption of a partition using Expert Partitioner.
# Maintainer: QE YaST <qa-sle-yast@suse.de>

package Installation::Partitioner::LibstorageNG::v4_3::EncryptPartitionPage;
use strict;
use warnings;

sub new {
my ($class, $args) = @_;
my $self = bless {
app => $args->{app}
}, $class;
return $self->init($args);
}

sub init {
my $self = shift;
$self->{tb_pass} = $self->{app}->textbox({id => 'pw1'});
$self->{tb_pass_reenter} = $self->{app}->textbox({id => 'pw2'});
$self->{btn_next} = $self->{app}->button({id => 'next'});
return $self;
}

sub set_encryption {
my ($self) = @_;
$self->enter_password($testapi::password);
$self->reenter_password($testapi::password);
$self->press_next();
}

sub enter_password {
my ($self, $password) = @_;
return $self->{tb_pass}->set($password);
}

sub reenter_password {
my ($self, $password) = @_;
return $self->{tb_pass_reenter}->set($password);
}

sub press_next {
my ($self) = @_;
return $self->{btn_next}->click();
}

1;