[tools] testbot/web: Override the default form actions instead of appending.

Francois Gouget fgouget at codeweavers.com
Thu Mar 3 11:16:32 CST 2022


Note that the parent FormPage class has no action anyway.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
I cannot think of any case where it would make sense to add a default
set of actions to the base FormPage class that would make sense in any
of these pages. So simplify the implementation by just specifying the
set of actions that these web pages support.
---
 testbot/web/Feedback.pl          |  8 ++------
 testbot/web/ForgotPassword.pl    |  8 ++------
 testbot/web/Login.pl             |  5 +----
 testbot/web/ResetPassword.pl     |  8 ++------
 testbot/web/Stats.pl             |  7 ++-----
 testbot/web/Submit.pl            | 28 +++++-----------------------
 testbot/web/admin/Log.pl         |  8 ++------
 testbot/web/admin/SpecialJobs.pl |  7 ++-----
 8 files changed, 18 insertions(+), 61 deletions(-)

diff --git a/testbot/web/Feedback.pl b/testbot/web/Feedback.pl
index b43397fda0..9eba086ace 100644
--- a/testbot/web/Feedback.pl
+++ b/testbot/web/Feedback.pl
@@ -72,12 +72,8 @@ sub GetHeaderText($)
 
 sub GetActions($)
 {
-  my ($self) = @_;
-
-  my $Actions = $self->SUPER::GetActions();
-  push @$Actions, "Send";
-
-  return $Actions;
+  #my ($self) = @_;
+  return ["Send"];
 }
 
 sub OnSend($)
diff --git a/testbot/web/ForgotPassword.pl b/testbot/web/ForgotPassword.pl
index 4e1c508b23..cc0cd455d3 100644
--- a/testbot/web/ForgotPassword.pl
+++ b/testbot/web/ForgotPassword.pl
@@ -58,12 +58,8 @@ sub GetHeaderText($)
 
 sub GetActions($)
 {
-  my ($self) = @_;
-
-  my $Actions = $self->SUPER::GetActions();
-  push @$Actions, "Reset password";
-
-  return $Actions;
+  #my ($self) = @_;
+  return ["Reset password"];
 }
 
 sub OnResetPassword($)
diff --git a/testbot/web/Login.pl b/testbot/web/Login.pl
index 3c93dd869d..ef3f4cb064 100644
--- a/testbot/web/Login.pl
+++ b/testbot/web/Login.pl
@@ -89,10 +89,7 @@ sub GetActions($)
 {
   my ($self) = @_;
 
-  my $Actions = $self->SUPER::GetActions();
-  push @$Actions, "Log in";
-
-  return $Actions;
+  return ["Log in"];
 }
 
 sub OnLogIn($)
diff --git a/testbot/web/ResetPassword.pl b/testbot/web/ResetPassword.pl
index 1e2b94d031..81655e0c4f 100644
--- a/testbot/web/ResetPassword.pl
+++ b/testbot/web/ResetPassword.pl
@@ -73,12 +73,8 @@ sub GetInputType($$)
 
 sub GetActions($)
 {
-  my ($self) = @_;
-
-  my $Actions = $self->SUPER::GetActions();
-  push @$Actions, "Change password";
-
-  return $Actions;
+  #my ($self) = @_;
+  return ["Change password"];
 }
 
 sub Validate($)
diff --git a/testbot/web/Stats.pl b/testbot/web/Stats.pl
index 803fc59f9f..ab086976f7 100644
--- a/testbot/web/Stats.pl
+++ b/testbot/web/Stats.pl
@@ -394,11 +394,8 @@ sub GetDisplayValue($$)
 
 sub GetActions($)
 {
-  my ($self) = @_;
-
-  my $Actions = $self->SUPER::GetActions();
-  push @$Actions, "Update";
-  return $Actions;
+  #my ($self) = @_;
+  return ["Update"];
 }
 
 sub OnAction($$)
diff --git a/testbot/web/Submit.pl b/testbot/web/Submit.pl
index 76069bbc3f..9a7ac0b3e7 100644
--- a/testbot/web/Submit.pl
+++ b/testbot/web/Submit.pl
@@ -913,29 +913,11 @@ sub GetActions($)
 {
   my ($self) = @_;
 
-  my $Actions = $self->SUPER::GetActions();
-  if ($self->{Page} == 0)
-  {
-    push @$Actions, "OK";
-  }
-  elsif ($self->{Page} == 1)
-  {
-    push @$Actions, "Single Page", "Next >";
-  }
-  elsif ($self->{Page} == 2)
-  {
-    push @$Actions, "< Prev", "Next >";
-  }
-  elsif ($self->{Page} == 3)
-  {
-    push @$Actions, "< Prev", "Submit";
-  }
-  elsif ($self->{Page} == 4)
-  {
-    push @$Actions, "Submit";
-  }
-
-  return $Actions;
+  return ["Single Page", "Next >"] if ($self->{Page} == 1);
+  return ["< Prev", "Next >"] if ($self->{Page} == 2);
+  return ["< Prev", "Submit"] if ($self->{Page} == 3);
+  return ["Submit"] if ($self->{Page} == 4);
+  return ["OK"]; # Page == 0 (error case)
 }
 
 sub DisplayProperty($$)
diff --git a/testbot/web/admin/Log.pl b/testbot/web/admin/Log.pl
index f0ac524681..cb253bd03e 100644
--- a/testbot/web/admin/Log.pl
+++ b/testbot/web/admin/Log.pl
@@ -64,12 +64,8 @@ sub GetHeaderText($)
 
 sub GetActions($)
 {
-  my ($self) = @_;
-
-  my $Actions = $self->SUPER::GetActions();
-  push @$Actions, "Download";
-
-  return $Actions;
+  #my ($self) = @_;
+  return ["Download"];
 }
 
 sub OnDownload($)
diff --git a/testbot/web/admin/SpecialJobs.pl b/testbot/web/admin/SpecialJobs.pl
index c5a8f6587f..534336c483 100644
--- a/testbot/web/admin/SpecialJobs.pl
+++ b/testbot/web/admin/SpecialJobs.pl
@@ -145,11 +145,8 @@ sub GenerateFields($)
 
 sub GetActions($)
 {
-  my ($self) = @_;
-
-  my $Actions = $self->SUPER::GetActions();
-  push @$Actions, "Submit";
-  return $Actions;
+  #my ($self) = @_;
+  return ["Submit"];
 }
 
 
-- 
2.30.2




More information about the wine-devel mailing list