15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181 | class TestAlertActions(UccTester):
@pytest.mark.execute_enterprise_cloud_true
@pytest.mark.forwarder
@pytest.mark.alert
def test_action_in_list(self, ucc_smartx_selenium_helper):
alert_page = AlertPage(ucc_smartx_selenium_helper, None)
alert_page.alert_entity.open()
alert_page.alert_entity.add_action_dropdown.wait_for_values()
self.assert_util(
"Test Alert",
alert_page.alert_entity.add_action_dropdown.get_value_list,
"in",
)
@pytest.mark.execute_enterprise_cloud_true
@pytest.mark.forwarder
@pytest.mark.alert
def test_dropdown_list(self, ucc_smartx_selenium_helper):
alert_page = AlertPage(ucc_smartx_selenium_helper, None)
alert_page.alert_entity.open()
alert_page.alert_entity.add_action_dropdown.wait_for_values()
alert_page.alert_entity.add_action_dropdown.select_action("Test Alert")
self.assert_util(
alert_page.action_entity.table_list.list_of_values, ["Incident", "Problem"]
)
@pytest.mark.execute_enterprise_cloud_true
@pytest.mark.forwarder
@pytest.mark.alert
def test_account_functionality(
self, ucc_smartx_selenium_helper, add_delete_account
):
alert_page = AlertPage(ucc_smartx_selenium_helper, None)
alert_page.alert_entity.open()
alert_page.alert_entity.add_action_dropdown.wait_for_values()
alert_page.alert_entity.add_action_dropdown.select_action("Test Alert")
alert_page.action_entity.account.select("TestAccount")
alert_page.action_entity.account.wait_for_values()
self.assert_util(alert_page.action_entity.account.get_value, "TestAccount")
alert_page.action_entity.account.cancel_selected_value()
alert_page.action_entity.account.wait_for_values()
self.assert_util(
alert_page.action_entity.account.get_value, "TestAccount", "!="
)
self.assert_util(
"TestAccount", alert_page.action_entity.account.list_of_values, "in"
)
@pytest.mark.execute_enterprise_cloud_true
@pytest.mark.forwarder
@pytest.mark.alert
def test_checkbox(self, ucc_smartx_selenium_helper):
alert_page = AlertPage(ucc_smartx_selenium_helper, None)
alert_page.alert_entity.open()
alert_page.alert_entity.add_action_dropdown.wait_for_values()
alert_page.alert_entity.add_action_dropdown.select_action("Test Alert")
alert_page.action_entity.all_incident.toggle()
self.assert_util(alert_page.action_entity.all_incident.is_checked, True)
alert_page.action_entity.all_incident.toggle()
self.assert_util(alert_page.action_entity.all_incident.is_checked, False)
@pytest.mark.execute_enterprise_cloud_true
@pytest.mark.forwarder
@pytest.mark.alert
def test_single_select(self, ucc_smartx_selenium_helper):
alert_page = AlertPage(ucc_smartx_selenium_helper, None)
alert_page.alert_entity.open()
alert_page.alert_entity.add_action_dropdown.wait_for_values()
alert_page.alert_entity.add_action_dropdown.select_action("Test Alert")
self.assert_util(
alert_page.action_entity.table_list.list_of_values, ["Incident", "Problem"]
)
alert_page.action_entity.table_list.select("Problem")
self.assert_util(alert_page.action_entity.table_list.get_value, "Problem")
@pytest.mark.execute_enterprise_cloud_true
@pytest.mark.forwarder
@pytest.mark.alert
def test_toggle(self, ucc_smartx_selenium_helper):
alert_page = AlertPage(ucc_smartx_selenium_helper, None)
alert_page.alert_entity.open()
alert_page.alert_entity.add_action_dropdown.wait_for_values()
alert_page.alert_entity.add_action_dropdown.select_action("Test Alert")
alert_page.action_entity.action.select("Delete")
assert alert_page.action_entity.action.get_value() == "delete"
alert_page.action_entity.action.select("Update")
assert alert_page.action_entity.action.get_value() == "update"
@pytest.mark.execute_enterprise_cloud_true
@pytest.mark.forwarder
@pytest.mark.sanity_test
@pytest.mark.alert
def test_alert_action_save(
self, ucc_smartx_selenium_helper, _clean_alert, add_delete_account
):
alert_page = AlertPage(ucc_smartx_selenium_helper, None)
alert_page.alert_entity.open()
alert_page.alert_entity.add_action_dropdown.wait_for_values()
# Add Alert Configs
alert_page.alert_entity.name.set_value("test_alert")
alert_page.alert_entity.search.set_value("| search index=_internal" + "\ue007")
# Open Action
alert_page.alert_entity.add_action_dropdown.select_action("Test Alert")
# Add Action Configs
alert_page.action_entity.name.set_value("test_action")
alert_page.action_entity.all_incident.toggle()
alert_page.action_entity.action.select("Delete")
alert_page.action_entity.account.select("TestAccount")
alert_page.alert_entity.save()
alert_page = AlertPage(ucc_smartx_selenium_helper, None)
alert_page.alert_table.wait_for_rows_to_appear()
assert "test_alert" in alert_page.alert_table.get_column_values("name")
@pytest.mark.execute_enterprise_cloud_true
@pytest.mark.forwarder
@pytest.mark.alert
def test_alert_help_text_entity(self, ucc_smartx_selenium_helper):
alert_page = AlertPage(ucc_smartx_selenium_helper, None)
alert_page.alert_entity.open()
alert_page.alert_entity.add_action_dropdown.wait_for_values()
alert_page.alert_entity.add_action_dropdown.select_action("Test Alert")
self.assert_util(
alert_page.action_entity.name.get_help_text, "Please enter your name"
)
self.assert_util(
alert_page.action_entity.all_incident.get_help_text,
"Tick if you want to update all incidents/problems",
)
self.assert_util(
alert_page.action_entity.table_list.get_help_text, "Please select the table"
)
self.assert_util(
alert_page.action_entity.action.get_help_text,
"Select the action you want to perform",
)
self.assert_util(
alert_page.action_entity.account.get_help_text,
"Select the account from the dropdown",
)
@pytest.mark.execute_enterprise_cloud_true
@pytest.mark.forwarder
@pytest.mark.alert
def test_alert_action_label_entity(
self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
):
"""Verifies the alert field labels"""
alert_page = AlertPage(ucc_smartx_selenium_helper, None)
alert_page.alert_entity.open()
alert_page.alert_entity.add_action_dropdown.wait_for_values()
alert_page.alert_entity.add_action_dropdown.select_action("Test Alert")
self.assert_util(alert_page.action_entity.name.get_input_label, "Name *")
self.assert_util(
alert_page.action_entity.table_list.get_input_label, "Table List"
)
self.assert_util(alert_page.action_entity.action.get_input_label, "Action:")
self.assert_util(
alert_page.action_entity.account.get_input_label, "Select Account *"
)
|