Skip to content

Custom

TestCustomPage

Bases: UccTester

Source code in tests/ui/test_configuration_page_custom_tab.py
 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
class TestCustomPage(UccTester):
    @pytest.mark.execute_enterprise_cloud_true
    @pytest.mark.forwarder
    @pytest.mark.custom
    def test_custom_fields_label_entity(
        self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
    ):
        """Verifies custom fields label"""
        custom = CustomPage(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
        self.assert_util(custom.test_string.get_input_label, "Test String")
        self.assert_util(custom.test_number.get_input_label, "Test Number")
        self.assert_util(custom.test_regex.get_input_label, "Test Regex")
        self.assert_util(custom.test_email.get_input_label, "Test Email")
        self.assert_util(custom.test_ipv4.get_input_label, "Test Ipv4")
        self.assert_util(custom.test_date.get_input_label, "Test Date")
        self.assert_util(custom.test_url.get_input_label, "Test Url")

    @pytest.mark.execute_enterprise_cloud_true
    @pytest.mark.forwarder
    @pytest.mark.custom
    @pytest.mark.sanity_test
    def test_custom_frontend_backend_validation(
        self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper, _reset_configuration
    ):
        """This test case checks the validates frontend save in custom tab"""
        custom = CustomPage(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
        custom.test_string.set_value("test_str")
        custom.test_number.set_value("1")
        custom.test_regex.set_value("test_rex")
        custom.test_email.set_value("test@a.b")
        custom.test_ipv4.set_value("1.10.1.100")
        custom.test_date.set_value("2020-09-18")
        custom.test_url.set_value("https://docs.splunk.com/Documentation")
        self.assert_util(custom.save, True)
        self.assert_util(
            custom.backend_conf.get_stanza,
            {
                "disabled": False,
                "testNumber": "1",
                "testRegex": "test_rex",
                "testString": "test_str",
                "testEmail": "test@a.b",
                "testIpv4": "1.10.1.100",
                "testDate": "2020-09-18",
                "testUrl": "https://docs.splunk.com/Documentation",
            },
        )

    @pytest.mark.execute_enterprise_cloud_true
    @pytest.mark.forwarder
    @pytest.mark.custom
    def test_custom_valid_length_test_string_greater(
        self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
    ):
        """This test case checks length of test string field should be greater than 4"""
        custom = CustomPage(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
        custom.test_string.set_value("test")
        self.assert_util(
            custom.save,
            r"Length of Test String should be greater than or equal to 5",
            left_args={"expect_error": True},
        )

    @pytest.mark.execute_enterprise_cloud_true
    @pytest.mark.forwarder
    @pytest.mark.custom
    def test_custom_valid_length_test_string_less(
        self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
    ):
        """This test case checks length of test string field should be less than 11"""
        custom = CustomPage(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
        custom.test_string.set_value("test_string")
        self.assert_util(
            custom.save,
            r"Length of Test String should be less than or equal to 10",
            left_args={"expect_error": True},
        )

    @pytest.mark.execute_enterprise_cloud_true
    @pytest.mark.forwarder
    @pytest.mark.custom
    def test_custom_valid_input_test_number(
        self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
    ):
        """This test case checks test number field should be integer"""
        custom = CustomPage(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
        custom.test_string.set_value("test_str")
        custom.test_number.set_value("a")
        self.assert_util(
            custom.save,
            r"Field Test Number is not a number",
            left_args={"expect_error": True},
        )

    @pytest.mark.execute_enterprise_cloud_true
    @pytest.mark.forwarder
    @pytest.mark.custom
    def test_custom_valid_range_test_number(
        self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
    ):
        """This test case checks range of test number field should be between 1 to 10"""
        custom = CustomPage(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
        custom.test_string.set_value("test_str")
        custom.test_number.set_value("0")
        self.assert_util(
            custom.save,
            r"Field Test Number should be within the range of [1 and 10]",
            left_args={"expect_error": True},
        )
        custom.test_number.set_value("11")
        self.assert_util(
            custom.save,
            r"Field Test Number should be within the range of [1 and 10]",
            left_args={"expect_error": True},
        )
        custom.test_number.set_value("10")
        self.assert_util(custom.save, True)

    @pytest.mark.execute_enterprise_cloud_true
    @pytest.mark.forwarder
    @pytest.mark.custom
    def test_custom_valid_input_test_regex(
        self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
    ):
        """This test case checks regex of test regex field"""
        custom = CustomPage(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
        custom.test_string.set_value("test_str")
        custom.test_number.set_value("5")
        custom.test_regex.set_value("$$")
        self.assert_util(
            custom.save,
            r"Characters of Name should match regex ^\w+$ .",
            left_args={"expect_error": True},
        )

    @pytest.mark.execute_enterprise_cloud_true
    @pytest.mark.forwarder
    @pytest.mark.custom
    def test_custom_valid_input_test_email(
        self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
    ):
        """This test case checks test email field should be email"""
        custom = CustomPage(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
        custom.test_string.set_value("test_str")
        custom.test_number.set_value("5")
        custom.test_regex.set_value("test_rex")
        custom.test_email.set_value("abc")
        self.assert_util(
            custom.save,
            r"Field Test Email is not a valid email address",
            left_args={"expect_error": True},
        )

    @pytest.mark.execute_enterprise_cloud_true
    @pytest.mark.forwarder
    @pytest.mark.custom
    def test_custom_valid_input_test_ipv4(
        self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
    ):
        """This test case checks test ipv4 field should be valid ipv4"""
        custom = CustomPage(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
        custom.test_string.set_value("test_str")
        custom.test_number.set_value("5")
        custom.test_regex.set_value("test_rex")
        custom.test_email.set_value("test@a.b")
        custom.test_ipv4.set_value("10.1.11")
        self.assert_util(
            custom.save,
            r"Field Test Ipv4 is not a valid IPV4 address",
            left_args={"expect_error": True},
        )

    @pytest.mark.execute_enterprise_cloud_true
    @pytest.mark.forwarder
    @pytest.mark.custom
    def test_custom_valid_input_test_date(
        self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
    ):
        """This test case checks test date field should be in ISO 8601 format"""
        custom = CustomPage(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
        custom.test_string.set_value("test_str")
        custom.test_number.set_value("5")
        custom.test_regex.set_value("test_rex")
        custom.test_email.set_value("test@a.b")
        custom.test_ipv4.set_value("10.1.11.1")
        custom.test_date.set_value("20-10-2020")
        self.assert_util(
            custom.save,
            r"Field Test Date is not a valid date in ISO 8601 format",
            left_args={"expect_error": True},
        )

    @pytest.mark.execute_enterprise_cloud_true
    @pytest.mark.forwarder
    @pytest.mark.custom
    def test_custom_valid_input_test_url(
        self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
    ):
        """This test case checks test url field should be valid url"""
        custom = CustomPage(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
        custom.test_string.set_value("test_str")
        custom.test_number.set_value("5")
        custom.test_regex.set_value("test_rex")
        custom.test_email.set_value("test@a.b")
        custom.test_ipv4.set_value("10.1.11.1")
        custom.test_date.set_value("2020-09-18")
        custom.test_url.set_value("\\\\")
        self.assert_util(
            custom.save,
            r"Field Test Url is not a valid URL",
            left_args={"expect_error": True},
        )

test_custom_fields_label_entity(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)

Verifies custom fields label

Source code in tests/ui/test_configuration_page_custom_tab.py
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@pytest.mark.execute_enterprise_cloud_true
@pytest.mark.forwarder
@pytest.mark.custom
def test_custom_fields_label_entity(
    self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
):
    """Verifies custom fields label"""
    custom = CustomPage(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
    self.assert_util(custom.test_string.get_input_label, "Test String")
    self.assert_util(custom.test_number.get_input_label, "Test Number")
    self.assert_util(custom.test_regex.get_input_label, "Test Regex")
    self.assert_util(custom.test_email.get_input_label, "Test Email")
    self.assert_util(custom.test_ipv4.get_input_label, "Test Ipv4")
    self.assert_util(custom.test_date.get_input_label, "Test Date")
    self.assert_util(custom.test_url.get_input_label, "Test Url")

test_custom_frontend_backend_validation(ucc_smartx_selenium_helper, ucc_smartx_rest_helper, _reset_configuration)

This test case checks the validates frontend save in custom tab

Source code in tests/ui/test_configuration_page_custom_tab.py
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
@pytest.mark.execute_enterprise_cloud_true
@pytest.mark.forwarder
@pytest.mark.custom
@pytest.mark.sanity_test
def test_custom_frontend_backend_validation(
    self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper, _reset_configuration
):
    """This test case checks the validates frontend save in custom tab"""
    custom = CustomPage(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
    custom.test_string.set_value("test_str")
    custom.test_number.set_value("1")
    custom.test_regex.set_value("test_rex")
    custom.test_email.set_value("test@a.b")
    custom.test_ipv4.set_value("1.10.1.100")
    custom.test_date.set_value("2020-09-18")
    custom.test_url.set_value("https://docs.splunk.com/Documentation")
    self.assert_util(custom.save, True)
    self.assert_util(
        custom.backend_conf.get_stanza,
        {
            "disabled": False,
            "testNumber": "1",
            "testRegex": "test_rex",
            "testString": "test_str",
            "testEmail": "test@a.b",
            "testIpv4": "1.10.1.100",
            "testDate": "2020-09-18",
            "testUrl": "https://docs.splunk.com/Documentation",
        },
    )

test_custom_valid_input_test_date(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)

This test case checks test date field should be in ISO 8601 format

Source code in tests/ui/test_configuration_page_custom_tab.py
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
@pytest.mark.execute_enterprise_cloud_true
@pytest.mark.forwarder
@pytest.mark.custom
def test_custom_valid_input_test_date(
    self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
):
    """This test case checks test date field should be in ISO 8601 format"""
    custom = CustomPage(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
    custom.test_string.set_value("test_str")
    custom.test_number.set_value("5")
    custom.test_regex.set_value("test_rex")
    custom.test_email.set_value("test@a.b")
    custom.test_ipv4.set_value("10.1.11.1")
    custom.test_date.set_value("20-10-2020")
    self.assert_util(
        custom.save,
        r"Field Test Date is not a valid date in ISO 8601 format",
        left_args={"expect_error": True},
    )

test_custom_valid_input_test_email(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)

This test case checks test email field should be email

Source code in tests/ui/test_configuration_page_custom_tab.py
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
@pytest.mark.execute_enterprise_cloud_true
@pytest.mark.forwarder
@pytest.mark.custom
def test_custom_valid_input_test_email(
    self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
):
    """This test case checks test email field should be email"""
    custom = CustomPage(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
    custom.test_string.set_value("test_str")
    custom.test_number.set_value("5")
    custom.test_regex.set_value("test_rex")
    custom.test_email.set_value("abc")
    self.assert_util(
        custom.save,
        r"Field Test Email is not a valid email address",
        left_args={"expect_error": True},
    )

test_custom_valid_input_test_ipv4(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)

This test case checks test ipv4 field should be valid ipv4

Source code in tests/ui/test_configuration_page_custom_tab.py
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
@pytest.mark.execute_enterprise_cloud_true
@pytest.mark.forwarder
@pytest.mark.custom
def test_custom_valid_input_test_ipv4(
    self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
):
    """This test case checks test ipv4 field should be valid ipv4"""
    custom = CustomPage(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
    custom.test_string.set_value("test_str")
    custom.test_number.set_value("5")
    custom.test_regex.set_value("test_rex")
    custom.test_email.set_value("test@a.b")
    custom.test_ipv4.set_value("10.1.11")
    self.assert_util(
        custom.save,
        r"Field Test Ipv4 is not a valid IPV4 address",
        left_args={"expect_error": True},
    )

test_custom_valid_input_test_number(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)

This test case checks test number field should be integer

Source code in tests/ui/test_configuration_page_custom_tab.py
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
@pytest.mark.execute_enterprise_cloud_true
@pytest.mark.forwarder
@pytest.mark.custom
def test_custom_valid_input_test_number(
    self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
):
    """This test case checks test number field should be integer"""
    custom = CustomPage(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
    custom.test_string.set_value("test_str")
    custom.test_number.set_value("a")
    self.assert_util(
        custom.save,
        r"Field Test Number is not a number",
        left_args={"expect_error": True},
    )

test_custom_valid_input_test_regex(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)

This test case checks regex of test regex field

Source code in tests/ui/test_configuration_page_custom_tab.py
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
@pytest.mark.execute_enterprise_cloud_true
@pytest.mark.forwarder
@pytest.mark.custom
def test_custom_valid_input_test_regex(
    self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
):
    """This test case checks regex of test regex field"""
    custom = CustomPage(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
    custom.test_string.set_value("test_str")
    custom.test_number.set_value("5")
    custom.test_regex.set_value("$$")
    self.assert_util(
        custom.save,
        r"Characters of Name should match regex ^\w+$ .",
        left_args={"expect_error": True},
    )

test_custom_valid_input_test_url(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)

This test case checks test url field should be valid url

Source code in tests/ui/test_configuration_page_custom_tab.py
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
@pytest.mark.execute_enterprise_cloud_true
@pytest.mark.forwarder
@pytest.mark.custom
def test_custom_valid_input_test_url(
    self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
):
    """This test case checks test url field should be valid url"""
    custom = CustomPage(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
    custom.test_string.set_value("test_str")
    custom.test_number.set_value("5")
    custom.test_regex.set_value("test_rex")
    custom.test_email.set_value("test@a.b")
    custom.test_ipv4.set_value("10.1.11.1")
    custom.test_date.set_value("2020-09-18")
    custom.test_url.set_value("\\\\")
    self.assert_util(
        custom.save,
        r"Field Test Url is not a valid URL",
        left_args={"expect_error": True},
    )

test_custom_valid_length_test_string_greater(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)

This test case checks length of test string field should be greater than 4

Source code in tests/ui/test_configuration_page_custom_tab.py
71
72
73
74
75
76
77
78
79
80
81
82
83
84
@pytest.mark.execute_enterprise_cloud_true
@pytest.mark.forwarder
@pytest.mark.custom
def test_custom_valid_length_test_string_greater(
    self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
):
    """This test case checks length of test string field should be greater than 4"""
    custom = CustomPage(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
    custom.test_string.set_value("test")
    self.assert_util(
        custom.save,
        r"Length of Test String should be greater than or equal to 5",
        left_args={"expect_error": True},
    )

test_custom_valid_length_test_string_less(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)

This test case checks length of test string field should be less than 11

Source code in tests/ui/test_configuration_page_custom_tab.py
86
87
88
89
90
91
92
93
94
95
96
97
98
99
@pytest.mark.execute_enterprise_cloud_true
@pytest.mark.forwarder
@pytest.mark.custom
def test_custom_valid_length_test_string_less(
    self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
):
    """This test case checks length of test string field should be less than 11"""
    custom = CustomPage(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
    custom.test_string.set_value("test_string")
    self.assert_util(
        custom.save,
        r"Length of Test String should be less than or equal to 10",
        left_args={"expect_error": True},
    )

test_custom_valid_range_test_number(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)

This test case checks range of test number field should be between 1 to 10

Source code in tests/ui/test_configuration_page_custom_tab.py
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
@pytest.mark.execute_enterprise_cloud_true
@pytest.mark.forwarder
@pytest.mark.custom
def test_custom_valid_range_test_number(
    self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
):
    """This test case checks range of test number field should be between 1 to 10"""
    custom = CustomPage(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
    custom.test_string.set_value("test_str")
    custom.test_number.set_value("0")
    self.assert_util(
        custom.save,
        r"Field Test Number should be within the range of [1 and 10]",
        left_args={"expect_error": True},
    )
    custom.test_number.set_value("11")
    self.assert_util(
        custom.save,
        r"Field Test Number should be within the range of [1 and 10]",
        left_args={"expect_error": True},
    )
    custom.test_number.set_value("10")
    self.assert_util(custom.save, True)