Skip to content

squape.settings

breakOnFailure

breakOnFailure(enabled=True)

Allows using breakOnFailure test setting as context managers. https://doc.qt.io/squish/squish-api.html#bool-testsettings-breakonfailure

Parameters:

Name Type Description Default
enabled bool

Whether to enable the debugger to stop on every failed verification

True

Examples:

with breakOnFailure():
    # code with verifications
Source code in squape/settings.py
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
@contextmanager
def breakOnFailure(enabled: bool = True) -> None:
    """Allows using breakOnFailure test setting as context managers.
    https://doc.qt.io/squish/squish-api.html#bool-testsettings-breakonfailure

    Args:
        enabled (bool): Whether to enable the debugger to stop
            on every failed verification

    Examples:
        ```python
        with breakOnFailure():
            # code with verifications
        ```
    """
    with _ctx_settings("breakOnFailure", enabled):
        yield

defaultOcrLanguage

defaultOcrLanguage(language)

Allows using defaultOcrLanguage test setting as context managers. https://doc.qt.io/squish/squish-api.html#bool-testsettings-defaultocrlanguage

Parameters:

Name Type Description Default
language str

string text representing the Language to be used for OCR Text search

required

Examples:

with defaultOcrLanguage("Polish"):
    waitForOcrText("Dom")
    waitForOcrText("Miasto")
Source code in squape/settings.py
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
@contextmanager
def defaultOcrLanguage(language: str) -> None:
    """Allows using defaultOcrLanguage test setting as context managers.
    https://doc.qt.io/squish/squish-api.html#bool-testsettings-defaultocrlanguage

    Args:
        language (str): string text representing the Language to be used
            for OCR Text search

    Examples:
        ```python
        with defaultOcrLanguage("Polish"):
            waitForOcrText("Dom")
            waitForOcrText("Miasto")
        ```
    """
    with _ctx_settings("defaultOcrLanguage", language):
        yield

imageNotFoundDebugging

imageNotFoundDebugging(enabled)

Allows using imageNotFoundDebugging test setting as context managers. https://doc.qt.io/squish/squish-api.html#bool-testsettings-imagenotfounddebugging

Parameters:

Name Type Description Default
enabled bool

Whether to enable debugging when image is not found.

required

Examples:

with imageNotFoundDebugging(False):
    waitForImage("image1.png")
    waitForImage("image2.png")
Source code in squape/settings.py
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
@contextmanager
def imageNotFoundDebugging(enabled: bool) -> None:
    """Allows using imageNotFoundDebugging test setting as context managers.
    https://doc.qt.io/squish/squish-api.html#bool-testsettings-imagenotfounddebugging

    Args:
        enabled (bool): Whether to enable debugging when image is not found.

    Examples:
        ```python
        with imageNotFoundDebugging(False):
            waitForImage("image1.png")
            waitForImage("image2.png")
        ```
    """
    with _ctx_settings("imageNotFoundDebugging", enabled):
        yield

imageSearchMaxScale

imageSearchMaxScale(max_scale)

Allows using imageSearchMaxScale test setting as context managers. https://doc.qt.io/squish/squish-api.html#number-testsettings-imagesearchmaxscale

Parameters:

Name Type Description Default
max_scale float

A float value indicating the maximum scale for image search.

required

Examples:

with imageSearchMultiscale(), imageSearchMaxScale(150):
    test.imagePresent("image1.png")
    test.imagePresent("image2.png")
Source code in squape/settings.py
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
@contextmanager
def imageSearchMaxScale(max_scale: float) -> None:
    """Allows using imageSearchMaxScale test setting as context managers.
    https://doc.qt.io/squish/squish-api.html#number-testsettings-imagesearchmaxscale

    Args:
        max_scale (float): A float value indicating the maximum scale for image search.

    Examples:
        ```python
        with imageSearchMultiscale(), imageSearchMaxScale(150):
            test.imagePresent("image1.png")
            test.imagePresent("image2.png")
        ```
    """
    with _ctx_settings("imageSearchMaxScale", max_scale):
        yield

imageSearchMinScale

imageSearchMinScale(min_scale)

Allows using imageSearchMinScale test setting as context managers. https://doc.qt.io/squish/squish-api.html#number-testsettings-imagesearchminscale

Parameters:

Name Type Description Default
min_scale float

A float value indicating the minimum scale for image search.

required

Examples:

with imageSearchMultiscale(), imageSearchMinScale(75):
    test.imagePresent("image1.png")
    test.imagePresent("image2.png")
Source code in squape/settings.py
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
@contextmanager
def imageSearchMinScale(min_scale: float) -> None:
    """Allows using imageSearchMinScale test setting as context managers.
    https://doc.qt.io/squish/squish-api.html#number-testsettings-imagesearchminscale

    Args:
        min_scale (float): A float value indicating the minimum scale for image search.

    Examples:
        ```python
        with imageSearchMultiscale(), imageSearchMinScale(75):
            test.imagePresent("image1.png")
            test.imagePresent("image2.png")
        ```
    """
    with _ctx_settings("imageSearchMinScale", min_scale):
        yield

imageSearchMultiscale

imageSearchMultiscale(enabled=True)

Allows using imageSearchMultiscale test setting as context managers. https://doc.qt.io/squish/squish-api.html#bool-testsettings-imagesearchmultiscale

Parameters:

Name Type Description Default
enabled bool

Whether multi-scale image search is enabled. Defaulting to True

True

Examples:

with imageSearchMultiscale(), imageSearchMaxScale(150):
    test.imagePresent("image1.png")
    test.imagePresent("image2.png")
Source code in squape/settings.py
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
@contextmanager
def imageSearchMultiscale(enabled: bool = True) -> None:
    """Allows using imageSearchMultiscale test setting as context managers.
    https://doc.qt.io/squish/squish-api.html#bool-testsettings-imagesearchmultiscale

    Args:
        enabled (bool): Whether multi-scale image search is enabled. Defaulting to True

    Examples:
        ```python
        with imageSearchMultiscale(), imageSearchMaxScale(150):
            test.imagePresent("image1.png")
            test.imagePresent("image2.png")
        ```
    """
    with _ctx_settings("imageSearchMultiscale", enabled):
        yield

imageSearchThreshold

imageSearchThreshold(threshold)

Allows using imageSearchThreshold test setting as context managers. https://doc.qt.io/squish/squish-api.html#number-testsettings-imagesearchthreshold

Parameters:

Name Type Description Default
threshold float

the threshold for image search.

required

Examples:

with imageSearchTolerant(), imageSearchThreshold(95):
    test.imagePresent("image.png")
Source code in squape/settings.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
@contextmanager
def imageSearchThreshold(threshold: float) -> None:
    """Allows using imageSearchThreshold test setting as context managers.
    https://doc.qt.io/squish/squish-api.html#number-testsettings-imagesearchthreshold

    Args:
        threshold (float): the threshold for image search.

    Examples:
        ```python
        with imageSearchTolerant(), imageSearchThreshold(95):
            test.imagePresent("image.png")
        ```
    """
    with _ctx_settings("imageSearchThreshold", threshold):
        yield

imageSearchTolerant

imageSearchTolerant(enabled=True)

Allows using imageSearchTolerant test setting as context managers. https://doc.qt.io/squish/squish-api.html#bool-testsettings-imagesearchtolerant

Parameters:

Name Type Description Default
enabled bool

Whether image search with tolerance is enabled. Defaulting to True.

True

Examples:

with imageSearchTolerant(), imageSearchThreshold(95):
    test.imagePresent()
Source code in squape/settings.py
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
@contextmanager
def imageSearchTolerant(enabled: bool = True) -> None:
    """Allows using imageSearchTolerant test setting as context managers.
    https://doc.qt.io/squish/squish-api.html#bool-testsettings-imagesearchtolerant

    Args:
        enabled (bool): Whether image search with tolerance is enabled.
            Defaulting to True.

    Examples:
        ```python
        with imageSearchTolerant(), imageSearchThreshold(95):
            test.imagePresent()
        ```
    """
    with _ctx_settings("imageSearchTolerant", enabled):
        yield

logScreenshotOnFail

logScreenshotOnFail(enabled=True)

Allows using logScreenshotOnFail test setting as context managers. https://doc.qt.io/squish/squish-api.html#bool-testsettings-logscreenshotonfail

Parameters:

Name Type Description Default
enabled bool

A boolean value indicating whether to enable logging of screenshots on FAIL test result. Defaulting to True.

True

Examples:

with logScreenshotOnFail():
    # code with verifications
Source code in squape/settings.py
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
@contextmanager
def logScreenshotOnFail(enabled: bool = True) -> None:
    """Allows using logScreenshotOnFail test setting as context managers.
    https://doc.qt.io/squish/squish-api.html#bool-testsettings-logscreenshotonfail

    Args:
        enabled (bool): A boolean value indicating whether to enable logging
            of screenshots on FAIL test result. Defaulting to True.

    Examples:
        ```python
        with logScreenshotOnFail():
            # code with verifications
        ```
    """

    with _ctx_settings("logScreenshotOnFail", enabled):
        yield

logScreenshotOnPass

logScreenshotOnPass(enabled=True)

Allows using logScreenshotOnPass test setting as context managers. https://doc.qt.io/squish/squish-api.html#bool-testsettings-logscreenshotonpass

Parameters:

Name Type Description Default
enabled bool

A boolean value indicating whether to enable logging of screenshots on PASS test result. Defaulting to True.

True

Examples:

with logScreenshotOnPass():
    # code with verifications
Source code in squape/settings.py
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
@contextmanager
def logScreenshotOnPass(enabled: bool = True) -> None:
    """Allows using logScreenshotOnPass test setting as context managers.
    https://doc.qt.io/squish/squish-api.html#bool-testsettings-logscreenshotonpass

    Args:
        enabled (bool): A boolean value indicating whether to enable logging
            of screenshots on PASS test result. Defaulting to True.

    Examples:
        ```python
        with logScreenshotOnPass():
            # code with verifications
        ```
    """
    with _ctx_settings("logScreenshotOnPass", enabled):
        yield

logScreenshotOnWarning

logScreenshotOnWarning(enabled=True)

Allows using logScreenshotOnWarning test setting as context managers. https://doc.qt.io/squish/squish-api.html#bool-testsettings-logscreenshotonwarning

Parameters:

Name Type Description Default
enabled bool

A boolean value indicating whether to enable logging of screenshots on warning log entry. Defaulting to True.

True

Examples:

with logScreenshotOnWarning():
    # code where warning messages might happen
Source code in squape/settings.py
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
@contextmanager
def logScreenshotOnWarning(enabled: bool = True) -> None:
    """Allows using logScreenshotOnWarning test setting as context managers.
    https://doc.qt.io/squish/squish-api.html#bool-testsettings-logscreenshotonwarning

    Args:
        enabled (bool): A boolean value indicating whether to enable logging
            of screenshots on warning log entry. Defaulting to True.

    Examples:
        ```python
        with logScreenshotOnWarning():
            # code where warning messages might happen
        ```
    """
    with _ctx_settings("logScreenshotOnWarning", enabled):
        yield

objectNotFoundDebugging

objectNotFoundDebugging(enabled)

Allows using objectNotFoundDebugging test setting as context managers. https://doc.qt.io/squish/squish-api.html#bool-testsettings-objectnotfounddebugging

Parameters:

Name Type Description Default
enabled bool

Whether to enable debugging when object is not found.

required

Examples:

with objectNotFoundDebugging(False):
    waitForObject(names.obj1)
    waitForObject(names.obj2)
Source code in squape/settings.py
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
@contextmanager
def objectNotFoundDebugging(enabled: bool) -> None:
    """Allows using objectNotFoundDebugging test setting as context managers.
    https://doc.qt.io/squish/squish-api.html#bool-testsettings-objectnotfounddebugging

    Args:
        enabled (bool): Whether to enable debugging when object is not found.

    Examples:
        ```python
        with objectNotFoundDebugging(False):
            waitForObject(names.obj1)
            waitForObject(names.obj2)
        ```
    """
    with _ctx_settings("objectNotFoundDebugging", enabled):
        yield

retryDuration

retryDuration(duration_ms)

Allows using retryDuration test setting as context managers. https://doc.qt.io/squish/squish-api.html#integer-testsettings-retryduration

Parameters:

Name Type Description Default
duration_ms int

The duration in milliseconds after which the verification fails

required

Examples:

with retryDuration(5000):
    test.vp("VP1")
Source code in squape/settings.py
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
@contextmanager
def retryDuration(duration_ms: int) -> None:
    """Allows using retryDuration test setting as context managers.
    https://doc.qt.io/squish/squish-api.html#integer-testsettings-retryduration

    Args:
        duration_ms (int): The duration in milliseconds after which
            the verification fails

    Examples:
        ```python
        with retryDuration(5000):
            test.vp("VP1")
        ```
    """
    with _ctx_settings("retryDuration", duration_ms):
        yield

silentVerifications

silentVerifications(enabled=True)

Allows using silentVerifications test setting as context managers. https://doc.qt.io/squish/squish-api.html#bool-testsettings-silentverifications

Parameters:

Name Type Description Default
enabled bool

Whether silent verifications are enabled. Defaulting to True

True

Examples:

with silentVerifications():
    # code with test.vp statements
Source code in squape/settings.py
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
@contextmanager
def silentVerifications(enabled: bool = True) -> None:
    """Allows using silentVerifications test setting as context managers.
    https://doc.qt.io/squish/squish-api.html#bool-testsettings-silentverifications

    Args:
        enabled (bool): Whether silent verifications are enabled. Defaulting to True

    Examples:
        ```python
        with silentVerifications():
            # code with test.vp statements
        ```
    """
    with _ctx_settings("silentVerifications", enabled):
        yield

textNotFoundDebugging

textNotFoundDebugging(enabled)

Allows using textNotFoundDebugging test setting as context managers. https://doc.qt.io/squish/squish-api.html#bool-testsettings-textnotfounddebugging

Parameters:

Name Type Description Default
enabled bool

Whether to enable debugging when a OCR Text is not found.

required

Examples:

with textNotFoundDebugging(False):
    waitForOcrText("Frog")
    waitForOcrText("Alpaca")
Source code in squape/settings.py
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
@contextmanager
def textNotFoundDebugging(enabled: bool) -> None:
    """Allows using textNotFoundDebugging test setting as context managers.
    https://doc.qt.io/squish/squish-api.html#bool-testsettings-textnotfounddebugging

    Args:
        enabled (bool): Whether to enable debugging when a OCR Text is not found.

    Examples:
        ```python
        with textNotFoundDebugging(False):
            waitForOcrText("Frog")
            waitForOcrText("Alpaca")
        ```
    """
    with _ctx_settings("textNotFoundDebugging", enabled):
        yield

throwOnFailure

throwOnFailure(enabled)

Allows using throwOnFailure test setting as context managers. https://doc.qt.io/squish/squish-api.html#bool-testsettings-throwonfailure

Parameters:

Name Type Description Default
enabled bool

Whether to enable to raise a script error on every failed verification

required

Examples:

with throwOnFailure():
    # code with verifications
Source code in squape/settings.py
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
@contextmanager
def throwOnFailure(enabled: bool) -> None:
    """Allows using throwOnFailure test setting as context managers.
    https://doc.qt.io/squish/squish-api.html#bool-testsettings-throwonfailure

    Args:
        enabled (bool): Whether to enable to raise a script error
            on every failed verification

    Examples:
        ```python
        with throwOnFailure():
            # code with verifications
        ```
    """
    with _ctx_settings("throwOnFailure", enabled):
        yield

waitForObjectTimeout

waitForObjectTimeout(timeout_ms)

Allows using waitForObjectTimeout test setting as context managers. https://doc.qt.io/squish/squish-api.html#integer-testsettings-waitforobjecttimeout

Parameters:

Name Type Description Default
timeout_ms int

A integer value indicating the timeout in ms.

required

Examples:

with waitForObjectTimeout(500):
    waitForObject(names.obj1)
    waitForObject(names.obj2)
Source code in squape/settings.py
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
@contextmanager
def waitForObjectTimeout(timeout_ms: int) -> None:
    """Allows using waitForObjectTimeout test setting as context managers.
    https://doc.qt.io/squish/squish-api.html#integer-testsettings-waitforobjecttimeout

    Args:
        timeout_ms (int): A integer value indicating the timeout in ms.

    Examples:
        ```python
        with waitForObjectTimeout(500):
            waitForObject(names.obj1)
            waitForObject(names.obj2)
        ```
    """
    with _ctx_settings("waitForObjectTimeout", timeout_ms):
        yield