class TestFMRadioFindStations(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) # launch the FM Radio app self.fm_radio = FmRadio(self.marionette) self.fm_radio.launch() def test_find_next_station(self): """ Find next station https://moztrap.mozilla.org/manage/case/1928/ """ # check the headphone is plugged-in or not self.assertTrue(self.data_layer.is_antenna_available, 'Antenna (headphones) not plugged in') # wait for the radio start-up self.wait_for_condition(lambda m: self.data_layer.is_fm_radio_enabled) # save the current frequency initial_frequency = self.fm_radio.frequency # search next station self.fm_radio.tap_next() # check the ui value and the system value self.assertEqual(self.fm_radio.frequency, float(self.data_layer.fm_radio_frequency)) # check the change of the frequency self.assertNotEqual(initial_frequency, self.fm_radio.frequency) def test_find_prev_station(self): """ Find previous station https://moztrap.mozilla.org/manage/case/1929/ """ # check the headphone is plugged-in or not self.assertTrue(self.data_layer.is_antenna_available, 'Antenna (headphones) not plugged in') # wait for the radio start-up self.wait_for_condition(lambda m: self.data_layer.is_fm_radio_enabled) # save the current frequency current_frequency = self.fm_radio.frequency # check the ui value and the system value self.assertEqual(current_frequency, float(self.data_layer.fm_radio_frequency)) # search prev station self.fm_radio.tap_previous() # check the ui value and the system value self.assertEqual(self.fm_radio.frequency, float(self.data_layer.fm_radio_frequency)) # check the change of the frequency self.assertNotEqual(current_frequency, self.fm_radio.frequency)
class TestFMRadioFindStations(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) # launch the FM Radio app self.fm_radio = FmRadio(self.marionette) self.fm_radio.launch() def test_find_next_previous_station(self): """ Find next station https://moztrap.mozilla.org/manage/case/1928/ Find previous station https://moztrap.mozilla.org/manage/case/1929/ """ # check the headphone is plugged-in or not self.assertTrue(self.data_layer.is_antenna_available, 'Antenna (headphones) not plugged in') # wait for the radio start-up self.wait_for_condition(lambda m: self.data_layer.is_fm_radio_enabled) # save the current frequency initial_frequency = self.fm_radio.frequency # search next station self.fm_radio.tap_next() # check the ui value and the system value self.assertEqual(self.fm_radio.frequency, float(self.data_layer.fm_radio_frequency)) # check the change of the frequency self.assertNotEqual(initial_frequency, self.fm_radio.frequency) # save the current frequency current_frequency = self.fm_radio.frequency # check the ui value and the system value self.assertEqual(current_frequency, float(self.data_layer.fm_radio_frequency)) # search prev station self.fm_radio.tap_previous() # check the ui value and the system value self.assertEqual(self.fm_radio.frequency, float(self.data_layer.fm_radio_frequency)) # check the change of the frequency self.assertNotEqual(current_frequency, self.fm_radio.frequency)
class TestEnduranceFMRadioPlay(GaiaEnduranceTestCase): def setUp(self): GaiaEnduranceTestCase.setUp(self) # launch the FM Radio app self.fm_radio = FmRadio(self.marionette) self.fm_radio.launch() # check the headphone is plugged-in or not self.assertTrue(self.data_layer.is_antenna_available, 'Antenna (headphones) not plugged in') # wait for the radio start-up self.wait_for_condition(lambda m: self.data_layer.is_fm_radio_enabled) # stay on initial station for a few seconds time.sleep(5) def test_endurance_fmradio_play(self): self.drive(test=self.fmradio_play, app='fm_radio') def fmradio_play(self): # Code taken from WebQA's existing FM radio tests (thanks!) # ensure radio is still enabled self.assertTrue(self.fm_radio.is_power_button_on, "FM radio should still be playing") # save the current frequency initial_frequency = self.fm_radio.frequency # go to next station self.fm_radio.tap_next() # check the change of the frequency self.assertNotEqual(initial_frequency, self.fm_radio.frequency) # Stay on new station for awhile; 33 seconds for 100 iterations; with checkpoints # every 10 iterations (radio plays during checkpoints) = 60 minutes of radio play time.sleep(33)