Skip to content

koddsson/dpxdt-server

Repository files navigation

Depicted—dpxdt

Build Status Coverage Status

Make continuous deployment safe by comparing before and after webpage screenshots for each release. Depicted shows when any visual, perceptual differences are found. This is the ultimate, automated end-to-end test.

API Reference

All of these requests are POSTs with URL-encoded or multipart/form-data bodies and require HTTP Basic Authentication using your API key as the username and secret as the password. All responses are JSON. The 'success' key will be present in all responses and true if the request was successful. If 'success' isn't present, a human-readable error message may be present in the response under the key 'error'.

Endpoints:

/api/create_release

Creates a new release candidate for a build.

Parameters
build_id
ID of the build.
release_name
Name of the new release.
url
URL of the homepage of the new release. Only present for humans who need to understand what a release is for.
Returns
build_id
ID of the build.
release_name
Name of the release that was just created.
release_number
Number assigned to the new release by the system.
url
URL of the release's homepage.

/api/find_run

Finds the last good run of the given name for a release. Returns an error if no run previous good release exists.

Parameters
build_id
ID of the build.
run_name
Name of the run to find the last known-good version of.
Returns
build_id
ID of the build.
release_name
Name of the last known-good release for the run.
release_number
Number of the last known-good release for the run.
run_name
Name of the run that was found. May be null if a run could not be found.
url
URL of the last known-good release for the run. May be null if a run could not be found.
image
Artifact ID (SHA1 hash) of the screenshot image associated with the run. May be null if a run could not be found.
log
Artifact ID (SHA1 hash) of the log file from the screenshot process associated with the run. May be null if a run could not be found.
config
Artifact ID (SHA1 hash) of the config file used for the screenshot process associated with the run. May be null if a run could not be found.

/api/request_run

Requests a new run for a release candidate. Causes the API system to take screenshots and do pdiffs. When ref_url and ref_config are supplied, the system will run two sets of captures (one for the baseline, one for the new release) and then compare them. When rel_url and ref_config are not specified, the last good run for this build is found and used for comparison.

Parameters
build_id
ID of the build.
release_name
Name of the release.
release_number
Number of the release.
url
URL to request as a run.
config
JSON data that is the config for the new run.
ref_url
URL of the baseline to request as a run.
ref_config
JSON data that is the config for the baseline of the new run.
Format of config

The config passed to the request_run function may have any or all of these fields. All fields are optional and have reasonably sane defaults.

{
    "viewportSize": {
        "width": 1024,
        "height": 768
    },
    "injectCss": ".my-css-rules-here { display: none; }",
    "injectJs": "document.getElementById('foobar').innerText = 'foo';",
    "resourceTimeoutMs": 60000
}
Returns
build_id
ID of the build.
release_name
Name of the release.
release_number
Number of the release.
run_name
Name of the run that was created.
url
URL that was requested for the run.
config
Artifact ID (SHA1 hash) of the config file that will be used for the screenshot process associated with the run.
ref_url
URL that was requested for the baseline reference for the run.
ref_config
Artifact ID (SHA1 hash) of the config file used for the baseline screenshot process of the run.

/api/upload

Uploads an artifact referenced by a run.

Parameters
build_id
ID of the build.
(a single file in the multipart/form-data)
Data of the file being uploaded. Should have a filename in the mime headers so the system can infer the content type of the uploaded asset.
Returns
build_id
ID of the build.
sha1sum
Artifact ID (SHA1 hash) of the file that was uploaded.
content_type
Content type of the artifact that was uploaded.

/api/report_run

Reports data for a run for a release candidate. May be called multiple times as progress is made for a run. Should not be called once the screenshot image for the run has been assigned.

Parameters
build_id
ID of the build.
release_name
Name of the release.
release_number
Number of the release.
run_name
Name of the run.
url
URL associated with the run.
image
Artifact ID (SHA1 hash) of the screenshot image associated with the run.
log
Artifact ID (SHA1 hash) of the log file from the screenshot process associated with the run.
config
Artifact ID (SHA1 hash) of the config file used for the screenshot process associated with the run.
ref_url
URL associated with the run's baseline release.
ref_image
Artifact ID (SHA1 hash) of the screenshot image associated with the run's baseline release.
ref_log
Artifact ID (SHA1 hash) of the log file from the screenshot process associated with the run's baseline release.
ref_config
Artifact ID (SHA1 hash) of the config file used for the screenshot process associated with the run's baseline release.
diff_image
Artifact ID (SHA1 hash) of the perceptual diff image associated with the run.
diff_log
Artifact ID (SHA1 hash) of the log file from the perceptual diff process associated with the run.
diff_failed
Present and non-empty string when the diff process failed for some reason. May be missing when diff ran and reported a log but may need to retry for this run.
run_failed
Present and non-empty string when the run failed for some reason. May be missing when capture ran and reported a log but may need to retry for this run.
distortion
Float amount of difference found in the diff that was uploaded, as a float between 0 and 1
Returns

Nothing but success on success.

/api/runs_done

Marks a release candidate as having all runs reported.

Parameters
build_id
ID of the build.
release_name
Name of the release.
release_number
Number of the release.
Returns
results_url
URL where a release candidates run status can be viewed in a web browser by a build admin.

About

Abstracted the API server out from dpxdt and stuck it in docker.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published