~nik90/ubuntu-clock-app/prep-new-design-part1

« back to all changes in this revision

Viewing changes to tests/autopilot/ubuntu_clock_app/tests/test_clock.py

Transitions the storage of world clocks and current location of user from LocalStorage to U1db.

Approved by Ubuntu Phone Apps Jenkins Bot, Riccardo Padovani.

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
    def tearDown(self):
48
48
        super(TestClock, self).tearDown()
49
49
 
 
50
    def add_local_world_city(self):
 
51
        # Open clock toolbar        
 
52
        self.main_view.open_toolbar()
 
53
 
 
54
        # Click add city toolbar button
 
55
        self.main_view.get_toolbar().click_button('addCityAction')
 
56
 
 
57
        # Click on first city in the list shown and ensure that it was saved
 
58
        city = self.main_view.grab_first_listed_city()
 
59
 
 
60
        city_name = self.main_view.get_city_name(city)
 
61
        self.main_view.select_city(city)
 
62
 
 
63
        return city_name
 
64
 
50
65
    def test_label_value(self):
51
66
        """The clock label must contain the correct time."""
52
67
 
59
74
    def test_add_local_world_city(self):
60
75
        """Test to check if adding a local listed world city works"""
61
76
 
62
 
        # Open clock toolbar        
63
 
        self.main_view.open_toolbar()
64
 
 
65
 
        # Click add city toolbar button
66
 
        self.main_view.get_toolbar().click_button('addCityAction')
67
 
 
68
 
        # Click on first city in the list shown and ensure that it was saved
69
 
        city = self.main_view.grab_first_listed_city()
70
 
        city_name = self.main_view.get_city_name(city)
71
 
        self.main_view.select_city(city)
 
77
        # Add a local world city  
 
78
        city_name = self.add_local_world_city()
 
79
        
72
80
        saved_city_name = self.main_view.get_city_name(self.main_view.grab_first_saved_city())
73
81
        self.assertThat(saved_city_name, Eventually(Equals(city_name)))      
74
82
        
75
83
    def test_delete_local_world_city(self):
76
84
        """Test to check if deleting a saved local world city works"""
77
85
 
78
 
        # Add a local world city        
79
 
        self.test_add_local_world_city()
 
86
        # Add a local world city  
 
87
        city_name = self.add_local_world_city()
80
88
 
81
89
        # Close toolbar and drag page up to see the saved world city list        
82
90
        self.main_view.close_toolbar()