Skip to content

Commit

Permalink
Screenshot to snapshot rename
Browse files Browse the repository at this point in the history
  • Loading branch information
Que3216 committed Sep 7, 2023
1 parent 563cae9 commit efe91b2
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ inputs:
required: false
max-retries-on-failure:
description: |
The number of times to re-run any replays that give a screenshot diff. If any of the retryed replays differs from that in the first replay
The number of times to re-run any replays that give a visual diff. If any of the retryed replays differs from that in the first replay
then the original diff will be marked as a flake, and ignored.
Setting to 0 disables this feature.
Expand All @@ -51,7 +51,7 @@ inputs:
required: true
default: 0.01
max-allowed-proportion-of-changed-pixels:
description: Maximum acceptable proportion of pixels that exceed the `max-allowed-color-difference`, as a number between 0 and 1. Differences in a smaller or equal proportional of pixels to this will be ignored. Defaults to 0.00001, or about 20 pixels in a 1920 x 1080 px screenshot.
description: Maximum acceptable proportion of pixels that exceed the `max-allowed-color-difference`, as a number between 0 and 1. Differences in a smaller or equal proportional of pixels to this will be ignored. Defaults to 0.00001, or about 20 pixels in a 1920 x 1080 px visual snapshot.
required: true
default: 0.00001
test-suite-id:
Expand Down
6 changes: 3 additions & 3 deletions src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,18 @@ export const runMeticulousTestsAction = async (): Promise<void> => {

if (shaToCompareAgainst != null && event.type === "pull_request") {
logger.info(
`Comparing screenshots for the commit head of this PR, ${shortSha(
`Comparing visual snapshots for the commit head of this PR, ${shortSha(
head
)}, against ${shortSha(shaToCompareAgainst)}`
);
} else if (shaToCompareAgainst != null) {
logger.info(
`Comparing screenshots for commit ${shortSha(
`Comparing visual snapshots for commit ${shortSha(
head
)} against commit ${shortSha(shaToCompareAgainst)}}`
);
} else {
logger.info(`Generating screenshots for commit ${shortSha(head)}`);
logger.info(`Generating visual snapshots for commit ${shortSha(head)}`);
}

const resultsReporter = new ResultsReporter({
Expand Down
4 changes: 2 additions & 2 deletions src/utils/ensure-base-exists.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ const waitForWorkflowCompletionAndThrowIfFailed = async ({
finalWorkflowRun.conclusion !== "success"
) {
throw new Error(
`Comparing against screenshots taken on ${commitSha}, but the corresponding workflow run [${finalWorkflowRun.id}] did not complete successfully. See: ${finalWorkflowRun.html_url}`
`Comparing against visual snapshots taken on ${commitSha}, but the corresponding workflow run [${finalWorkflowRun.id}] did not complete successfully. See: ${finalWorkflowRun.html_url}`
);
}
};
Expand Down Expand Up @@ -236,7 +236,7 @@ const waitForWorkflowCompletionAndSkipComparisonsIfFailed = async ({
finalWorkflowRun.conclusion !== "success"
) {
logger.warn(
`Comparing against screenshots taken on ${commitSha}, but the corresponding workflow run [${finalWorkflowRun.id}] did not complete successfully. See: ${finalWorkflowRun.html_url}. Running without comparisons.`
`Comparing against visual snapshots taken on ${commitSha}, but the corresponding workflow run [${finalWorkflowRun.id}] did not complete successfully. See: ${finalWorkflowRun.html_url}. Running without comparisons.`
);
return { shaToCompareAgainst: null };
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/get-base-and-head-commit-shas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const tryGetMergeBaseOfTemporaryMergeCommit = (
`The head commit SHA (${headCommitSha}) does not equal GITHUB_SHA environment variable (${mergeCommitSha}).
This is likely because a custom ref has been passed to the 'actions/checkout' action. We're assuming therefore
that the head commit SHA is not a temporary merge commit, but rather the head of the branch. Therefore we're
using the base of the pull request (${pullRequestBaseSha}) to compare screenshots against, and not the base
using the base of the pull request (${pullRequestBaseSha}) to compare the visual snapshots against, and not the base
of GitHub's temporary merge commit.`
);
return null;
Expand Down
4 changes: 2 additions & 2 deletions src/utils/results-reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export class ResultsReporter {
if (totalScreenshotsTaken === 0) {
await this.setStatusComment({
createIfDoesNotExist: true,
body: `❌ Meticulous replayed ${testCaseResults.length} user sessions, but no screenshots were taken. This likely means there was an error replaying the sessions. Please view the logs of the Github workflow.`,
body: `❌ Meticulous replayed ${testCaseResults.length} user sessions, but no visual snapshots were taken. This likely means there was an error replaying the sessions. Please view the logs of the Github workflow.`,
});
} else {
const baseRefStr = this.options.baseRef
Expand All @@ -129,7 +129,7 @@ export class ResultsReporter {
// Usually this means that the user has just set up Meticulous and is running it for the first time.
await this.setStatusComment({
createIfDoesNotExist: true,
body: `🤖 Meticulous replayed ${testCaseResults.length} user sessions and [took ${totalScreenshotsTaken} screenshots](${testRun.url}). Meticulous did not run on ${this.options.baseRef} of the ${baseRefStr} branch and so there was nothing to compare against.
body: `🤖 Meticulous replayed ${testCaseResults.length} user sessions and [took ${totalScreenshotsTaken} visual snapshots](${testRun.url}). Meticulous did not run on ${this.options.baseRef} of the ${baseRefStr} branch and so there was nothing to compare against.
\nPlease merge your pull request for setting up Meticulous in CI and ensure that it’s running on push events to the ${baseRefStr} branch.`,
});
}
Expand Down
6 changes: 3 additions & 3 deletions src/utils/workflow.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const startNewWorkflowRun = async ({
`Could not trigger a workflow run on commit ${shortSha(
commitSha
)} of the base branch (${ref}) to compare against, because there was no Meticulous workflow with the 'workflow_dispatch' trigger on the ${ref} branch.` +
` Screenshots of the new flows will be taken, but no comparisons will be made.` +
` Visual snapshots of the new flows will be taken, but no comparisons will be made.` +
` If you haven't merged the PR to setup Meticulous in Github Actions to the ${ref} branch yet then this is expected.` +
` Otherwise please check that Meticulous is running on the ${ref} branch, that it has a 'workflow_dispatch' trigger, and has the appropiate permissions.` +
` See ${DOCS_URL} for the correct setup.`
Expand All @@ -74,7 +74,7 @@ export const startNewWorkflowRun = async ({
// https://docs.github.com/en/rest/overview/permissions-required-for-github-apps?apiVersion=2022-11-28#repository-permissions-for-actions
logger.error(
`Missing permission to trigger a workflow run on the base branch (${ref}).` +
` Screenshots of the new flows will be taken, but no comparisons will be made.` +
` Visual snapshots of the new flows will be taken, but no comparisons will be made.` +
` Please add the 'actions: write' permission to your workflow YAML file: see ${DOCS_URL} for the correct setup.`
);
logger.debug(err);
Expand All @@ -85,7 +85,7 @@ export const startNewWorkflowRun = async ({
`Could not trigger a workflow run on commit ${shortSha(
commitSha
)} of the base branch (${ref}) to compare against.` +
` Screenshots of the new flows will be taken, but no comparisons will be made.` +
` Visual snapshots of the new flows will be taken, but no comparisons will be made.` +
` Please check that Meticulous is running on the ${ref} branch, that it has a 'workflow_dispatch' trigger, and has the appropiate permissions.` +
` See ${DOCS_URL} for the correct setup.`,
err
Expand Down

0 comments on commit efe91b2

Please sign in to comment.