Test
The Cursion CLI has 3 commands to work with the Test
object:
Command | Description |
---|---|
test-site | create tests of all pages of a specific site |
test-page | create a test of a specific page |
get-tests | get one or more tests |
Tips
For information about the Test
object, please see Test Overview.
Test a Site
test-site
This command will create a new Test
object for each Page
object associated with the passed <site-id>
. This command runs synchronously in the terminal and will resolve with a success message or raise an Exception if the resulting Test.score
is lower than the passed --threshold
. Ideally, this command is designed for use in a CI/CD action - terminating the run if a Test
"fails".
The full command to Test
a Site
is the following:
cursion test-site <site-id>
View Full Output
checking site availablity...
✔ site is available
retrieving pages...
✔ retrieved pages
checking pre_scans for each page...
✔ scan completed -> 22da7327-a163-4698-92aa-9a037d5dab1c
✔ scan completed -> af4f0dd9-3770-40ab-af52-4e51b2867bff
creating post_scans for each page...
✔ post_scans created
checking post_scans for each page...
✔ scan completed -> fcfab733-ee07-43e8-8dc9-c133485eed45
✔ scan completed -> 140c8a95-50c3-4840-bf59-a90daaaa94f1
testing page https://example.com/terms
test_id : 40590f9a-7ca8-4b5f-8861-455811c6d18a
pre_scan : 22da7327-a163-4698-92aa-9a037d5dab1c
post_scan : 140c8a95-50c3-4840-bf59-a90daaaa94f1
testing page https://example.com/pricing
test_id : 111bd5d2-1ece-4b2f-8559-b81e0d3d98c9
pre_scan : af4f0dd9-3770-40ab-af52-4e51b2867bff
post_scan : fcfab733-ee07-43e8-8dc9-c133485eed45
checking test completion for each page...
✔ test completed -> 40590f9a-7ca8-4b5f-8861-455811c6d18a
✔ test completed -> 111bd5d2-1ece-4b2f-8559-b81e0d3d98c9
Test results:
✔ passed 99.98% : https://app.cursion.dev/test/40590f9a-7ca8-4b5f-8861-455811c6d18a
✔ passed 99.87% : https://app.cursion.dev/test/111bd5d2-1ece-4b2f-8559-b81e0d3d98c9
Test a Page
test-page
This command will create a new Test
object for the Page
object associated with the passed <page-id>
.
The full command to Test
a Page
is the following:
cursion test-page --page-id=<page-id> --pre-scan-id=<pre-scan-id> --post-scan-id=<post-scan-id>
View Full Output
✔ Success
{
'success': True,
'message': 'Tests are being created in the background',
'ids': ['04892cw95-5f8f-9213-874b-0192b229a234']
}
Retrieve Tests
get-tests
This command will retrieve one or more Test
objects associated with the passed --page-id=<page-id>
or --test-id=<test-id>
.
The full command to retrieve a Test
is the following:
cursion get-tests --test-id=<test-id>
View Full Output
✔ Success
{
'id': '3e03e5d8-2891-4a2a-a4bf-8d803a02eb34',
'site': '5ec5041a-bf5f-440c-a95b-1ae43c91da7d',
'page': '347d5acd-57a9-4f78-87cd-956ce3c81bd5',
'time_created': '2024-02-26T21:59:14.006240Z',
'time_completed': '2024-02-26T22:01:09.502528Z',
'pre_scan': '8c91da08-0e89-40de-9af6-fc77b3f3b842',
'post_scan': 'e3597294-68f5-4f09-8dbf-ec8cb95cdb63',
'score': 100.0,
'lighthouse_delta': {
'scores': {
'pwa_delta': 0,
'seo_delta': 0,
'crux_delta': 0,
'average_delta': 0.0,
'current_average': 60.2,
'performance_delta': 0,
'accessibility_delta': 0,
'best_practices_delta': 0
}
},
'yellowlab_delta': {
'scores': {
'fonts_delta': 0,
'badCSS_delta': 0,
'jQuery_delta': 0,
'average_delta': 3,
'requests_delta': 0,
'current_average': 88,
'pageWeight_delta': 0,
'serverConfig_delta': 0,
'badJavascript_delta': 0,
'cssComplexity_delta': 0,
'domComplexity_delta': 0,
'javascriptComplexity_delta': 26
}
},
'tags': None,
'component_scores': {'vrt': 100.0, 'html': 100.0, 'logs': 100.0, 'yellowlab': 100, 'lighthouse': 100.0}
}