[CaptivePortalTest] Fix captive portal test flakiness

Bug: 140202697
Test: Verified the changes
Change-Id: If2f516af63fd00bcb6b73786187a52fd098b33f4
diff --git a/acts/tests/google/net/CaptivePortalTest.py b/acts/tests/google/net/CaptivePortalTest.py
index 10240e4..0611640 100644
--- a/acts/tests/google/net/CaptivePortalTest.py
+++ b/acts/tests/google/net/CaptivePortalTest.py
@@ -17,12 +17,12 @@
 
 from acts import asserts
 from acts import base_test
-from acts import signals
 from acts.libs.uicd.uicd_cli import UicdCli
 from acts.test_decorators import test_tracker_info
 from acts.test_utils.net import connectivity_const as cconst
 from acts.test_utils.net import connectivity_test_utils as cutils
 from acts.test_utils.wifi import wifi_test_utils as wutils
+from acts.test_utils.wifi.WifiBaseTest import WifiBaseTest
 
 WifiEnums = wutils.WifiEnums
 IFACE = "InterfaceName"
@@ -31,10 +31,10 @@
 
 
 class CaptivePortalTest(base_test.BaseTestClass):
-    """ Tests for Captive portal """
+    """Tests for Captive portal."""
 
     def setup_class(self):
-        """Setup devices for tests and unpack params
+        """Setup devices for tests and unpack params.
 
         Required params:
           1. rk_captive_portal: SSID of ruckus captive portal network in dict
@@ -57,15 +57,15 @@
         self.gg_workflow_config = "gg_captive_portal_%s" % self.dut.model
 
     def teardown_class(self):
-        """ Reset devices """
+        """Reset devices."""
         cutils.set_private_dns(self.dut, cconst.PRIVATE_DNS_MODE_OPPORTUNISTIC)
 
     def setup_test(self):
-        """ Setup device """
+        """Setup device."""
         self.dut.unlock_screen()
 
     def teardown_test(self):
-        """ Reset to default state after each test """
+        """Reset to default state after each test."""
         wutils.reset_wifi(self.dut)
 
     def on_fail(self, test_name, begin_time):
@@ -74,7 +74,7 @@
     ### Helper methods ###
 
     def _verify_captive_portal(self, network, uicd_workflow):
-        """Connect to captive portal network using uicd workflow
+        """Connect to captive portal network using uicd workflow.
 
         Steps:
             1. Connect to captive portal network
@@ -82,8 +82,8 @@
             3. Verify internet connectivity
 
         Args:
-            1. network: captive portal network to connect to
-            2. uicd_workflow: ui workflow to accept captive portal conn
+            network: captive portal network to connect to
+            uicd_workflow: ui workflow to accept captive portal conn
         """
         # connect to captive portal wifi network
         wutils.start_wifi_connection_scan_and_ensure_network_found(
@@ -103,17 +103,18 @@
             time.sleep(2)
 
         # verify connectivity
-        internet = wutils.validate_connection(self.dut,
-                                              wutils.DEFAULT_PING_ADDR)
-        if not internet:
-            raise signals.TestFailure("Failed to connect to internet on %s" %
-                                      network[WifiEnums.SSID_KEY])
+        try:
+            asserts.assert_true(wutils.validate_connection(self.dut),
+                                "Failed to verify internet connectivity")
+        except Exception as e:
+            asserts.fail("Failed to connect to captive portal: %s" % e)
 
     ### Test Cases ###
 
     @test_tracker_info(uuid="b035b4f9-40f7-42f6-9941-ec27afe15040")
+    @WifiBaseTest.wifi_test_wrap
     def test_ruckus_captive_portal_default(self):
-        """Verify captive portal network
+        """Verify captive portal network.
 
         Steps:
             1. Set default private dns mode
@@ -128,8 +129,9 @@
                                     self.rk_workflow_config)
 
     @test_tracker_info(uuid="8ea18d80-0170-41b1-8945-fe14bcd4feab")
+    @WifiBaseTest.wifi_test_wrap
     def test_ruckus_captive_portal_private_dns_off(self):
-        """Verify captive portal network
+        """Verify captive portal network.
 
         Steps:
             1. Turn off private dns mode
@@ -144,8 +146,9 @@
                                     self.rk_workflow_config)
 
     @test_tracker_info(uuid="e8e05907-55f7-40e5-850c-b3111ceb31a4")
+    @WifiBaseTest.wifi_test_wrap
     def test_ruckus_captive_portal_private_dns_strict(self):
-        """Verify captive portal network
+        """Verify captive portal network.
 
         Steps:
             1. Set strict private dns mode
@@ -163,7 +166,7 @@
 
     @test_tracker_info(uuid="76e49800-f141-4fd2-9969-562585eb1e7a")
     def test_guestgate_captive_portal_default(self):
-        """Verify captive portal network
+        """Verify captive portal network.
 
         Steps:
             1. Set default private dns mode
@@ -178,7 +181,7 @@
 
     @test_tracker_info(uuid="0aea0cac-0f42-406b-84ba-62c1ef74adfc")
     def test_guestgate_captive_portal_private_dns_off(self):
-        """Verify captive portal network
+        """Verify captive portal network.
 
         Steps:
             1. Turn off private dns mode
@@ -193,7 +196,7 @@
 
     @test_tracker_info(uuid="39124dcc-2fd3-4d33-b129-a1c8150b7f2a")
     def test_guestgate_captive_portal_private_dns_strict(self):
-        """Verify captive portal network
+        """Verify captive portal network.
 
         Steps:
             1. Set strict private dns mode