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

Wait for Installation Settings screen to be loaded #13990

Merged

Conversation

OleksandrOrlov
Copy link
Contributor

@OleksandrOrlov OleksandrOrlov commented Jan 11, 2022

validate_ssh_service_enabled test module checked that Installation
Screen is loaded by ensuring that widget with "id=proposal" is shown on
the screen. Then 'assert_true' is called immediately and it failed,
because the content of 'proposal' widget was not loaded.

The commit ensures that the the content is loaded before validating that
the port is opened.

@@ -14,6 +14,7 @@ use Test::Assert 'assert_true';

sub run {
my $installation_settings = $testapi::distri->get_installation_settings();
$installation_settings->wait_for_overview_content_to_be_loaded();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about to run this method after the action that we know cause a refreshment, so basically we could do it internally after changing the service or the port, the test doesn't know about refreshments let's say, but we can go with this if you want it is a good workaround without having the solution in server side, wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But in this case we don't do changes that cause the refreshment on Installation Setting. It's just initial page load when navigating from previous screen to Installation Settings.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason why not to put it in get_overview_content ? At least I would have put it there :) but yeah, just to gathering feedback from you as I'm not sure about this and I had the same situation in my previous PRs. We can merge either way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason is that if we will need to create a test that checks, that the page has placeholders when it is loading, we'll not be able to do so. For sure that may never be the case, but we'll keep single responsibility principle which is also keep our solution more consistent.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahm I was referring to is_shown() which means that if the screen is loaded, I guess that method should be more complicated in this particular case, so we can break the single principle because we don't have the proper server solution. For the rest of screen we don't need to do that because there is not refreshment. With this approach we always have to add this new method to test (which we are not supposed to change much). Does it convince you? :)

Copy link
Member

@ge0r ge0r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I also would argue that a wait for the content to load should not be visible to the test but it makes sense to have the option to test the page before the overview has been appeared.

validate_ssh_service_enabled test module checked that Installation
Screen is loaded by ensuring that widget with "id=proposal" is shown on
the screen. Then 'assert_true' is called immediately and it failed,
because the content of 'proposal' widget was not loaded.

The commit ensures that the the content is loaded before validating that
the port is opened.

Related issue: https://progress.opensuse.org/issues/104703
@OleksandrOrlov OleksandrOrlov force-pushed the 104703_wait_for_inst_settings_load branch from 2eede62 to f5ac701 Compare January 12, 2022 15:48
@@ -29,9 +29,18 @@ sub init {
sub get_installation_settings_page {
my ($self) = @_;
die "Installation Settings Page is not displayed" unless $self->{InstallationSettingsPage}->is_shown();
die "Overview content on Installation Settings Page is not loaded completely" unless $self->{InstallationSettingsPage}->is_loaded_completely();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we merge these two lines? are not the same thing? is_shown, is_loaded are the same to me, but check my comment below.

return $self->{InstallationSettingsPage};
}

sub wait_for_overview_content_to_be_loaded {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this still in use, or you forgot to delete it?

sub is_loaded_completely {
my ($self) = @_;
my $result;
eval {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so you silent the method with the eval I think this was a no-go, only should be used in the client itself, other contributors claimed it was bad practice in Perl, it doesn't behave so well as try/catch in other language (some modern languages even avoid try/catch as a build-in feature of the language).

I think it would be easier just to use the is_shown and add to wait_until a non-failure feature so we do the hack at the inner level, the only problem is the error if we die or not to use it for what I can see ... wdyt?

@jknphy
Copy link
Contributor

jknphy commented Jan 25, 2022

Given that #14022 is still not done, in order to not block it for more time, let's merge it. Anyway the approach with the eval was also used in the past.

@jknphy jknphy merged commit a286405 into os-autoinst:master Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants