Skip to content

API page-object suites

A page-object suite is the set of page objects InsightJet keeps for one application (see POM suites). You want a script to read it, run it, bring it up to date after new tests, or publish it to GitHub. A suite, a crawl or a suite run that is not yours is 404 not_found. The commands assume the variables from Tickets and ticket runs.

Terminal window
curl "$BASE/apps" -H "Authorization: Bearer $INSIGHTJET_API_KEY"
{ "suites": [ { "appId": 5, "hostname": "shop.example.com", "displayName": null, "pageCount": 4 } ] }

One suite for each application. appId is what the other suite operations take.

Expected result: status 200 and a suites array.

Terminal window
curl "$BASE/apps/5/pom-suite" -H "Authorization: Bearer $INSIGHTJET_API_KEY"

The suite’s current version, its last reconcile, and its page objects with their locator and method counts. The field names are not confirmed.

Expected result: status 200 and the suite; 404 not_found for an application with no suite.

Terminal window
curl "$BASE/apps/5/pom-pages/LoginPage" -H "Authorization: Bearer $INSIGHTJET_API_KEY"
curl "$BASE/apps/5/pom-pages/LoginPage/history" -H "Authorization: Bearer $INSIGHTJET_API_KEY"

pageKey is the page object’s key or class name, up to 200 characters. The first answer holds the page object’s locators, methods and generated source code; the second, how it changed across reconciles, with the diffs. The field names are not confirmed.

Expected result: status 200 for each. A key that is not in the suite is 404 not_found.

Terminal window
curl -X POST "$BASE/crawls/42/pom-suite-runs" \
-H "Authorization: Bearer $INSIGHTJET_API_KEY" \
-H "Content-Type: application/json" \
-d '{"specTestCaseIds": [301, 302]}'
{ "suiteRunId": 88, "specCount": 2, "status": "running", "insightjetLink": "https://insightjet.ai/..." }

Runs the page-object suite of the crawl’s application on the crawler’s Playwright runner. specTestCaseIds (up to 500) chooses the specs; leave the body out, or leave the field out, to run every runnable spec. The answer comes at once; Location is /api/v1/pom-suite-runs/88. The application’s login must be saved in Settings; the API never takes one. A run uses agent-hours.

Expected result: status 202, status: "running" and a suiteRunId. Failures: 409 no_runnable_specs, 409 needs_app_credentials (details.missing), 402 out_of_hours, 429 all_agents_working.

Terminal window
curl "$BASE/pom-suite-runs/88" -H "Authorization: Bearer $INSIGHTJET_API_KEY"

One suite run with its per-spec results: which specs passed or failed, durations, errors and video addresses, and why the run ended as it did when it could not start. Ask again until it has finished. The field names and the status values are not confirmed here; the Suite runs page lists the statuses the app shows.

To list an application’s recent runs, newest first (10 by default, at most 50):

Terminal window
curl "$BASE/apps/5/pom-suite-runs?limit=5" -H "Authorization: Bearer $INSIGHTJET_API_KEY"

Expected result: status 200. The list answers { "runs": [...] } with an insightjetLink.

Terminal window
curl -X POST "$BASE/crawls/42/pom-suite/reconcile" -H "Authorization: Bearer $INSIGHTJET_API_KEY"
{ "reconciled": 4, "applied": 4, "suiteVersion": 12 }

Merges the page objects of the crawl’s latest page-object test cases into the application’s suite, as a new version. A changed page object’s code and methods are replaced; earlier versions stay in its history. Reconciles of one application run one after another.

Expected result: status 200 with reconciled, applied and suiteVersion (which can be null). 409 no_runnable_specs when there is nothing to reconcile; 503 application_unresolved when the application of the crawl could not be found just now.

Terminal window
curl -X POST "$BASE/apps/5/pom-suite/github-publication" \
-H "Authorization: Bearer $INSIGHTJET_API_KEY" \
-H "Content-Type: application/json" \
-d '{"repo": "acme/shop-tests", "branch": "main", "directory": "e2e"}'

Publishes the suite (page objects, latest specs and scaffolding) through your own GitHub connection, replacing any file already at the same path. GitHub must be connected in InsightJet’s Settings. repo is owner/name and branch and directory are optional; the configured default repository is used when repo is left out, and the default branch or main when branch is. The answer lists what was published; its field names are not confirmed.

Expected result: status 200. 409 no_page_objects when the suite is empty; 502 github_failed or 502 bundle_failed when it could not be published.