Skip to content

Commit d6dc86e

Browse files
Added capture screenshot from CLI changes as per review
1 parent f7f79e8 commit d6dc86e

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

accessibility/plugin/index.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ const Accessibility = (on, config) => {
5353
convertScreenshotToBase64(filePath) {
5454
try {
5555
const fullPath = path.resolve(filePath);
56-
console.log(`Looking for screenshot at: ${fullPath}`);
5756

5857
if (fs.existsSync(fullPath)) {
5958
const imageBuffer = fs.readFileSync(fullPath);
@@ -76,11 +75,8 @@ const Accessibility = (on, config) => {
7675
deleteFile(filePath) {
7776
try {
7877
const fullPath = path.resolve(filePath);
79-
console.log(`Attempting to delete file: ${fullPath}`);
80-
8178
if (fs.existsSync(fullPath)) {
8279
fs.unlinkSync(fullPath);
83-
console.log(`File deleted successfully: ${filePath}`);
8480
return true;
8581
} else {
8682
console.log(`File not found for deletion: ${filePath}`);

accessibility/scanner/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,19 @@ const performNewLambdaScan = (originalFn, Subject, stateType, ...args) => {
5050
.performScanSubjectQuery(cypressCommandChain, setTimeout)
5151
.then({ timeout: 30000 }, (newSubject) => {
5252
const updatedArgs = updateSubj(args, stateType, newSubject);
53-
const screenshotName = 'accessibility-screenshot';
53+
const screenshotId= crypto.randomUUID();
54+
const screenshotName = 'accessibility-screenshot-'+ screenshotId;
5455
cy.screenshot(screenshotName, { capture: 'fullPage' });
5556
cy.task('convertScreenshotToBase64', `cypress/screenshots/${Cypress.spec.name}/${screenshotName}.png`).then((result) => {
5657
if (result && result.base64) {
5758
const imageUrl = `data:image/png;base64,${result.base64}`;
5859
const imageResolution = result.resolution;
59-
6060
// Create screenshots array
6161
const screenshots = [
6262
{
6363
image_url: imageUrl,
6464
image_resolution: `${imageResolution.width}x${imageResolution.height}`,
65-
screenshotId: crypto.randomUUID()
65+
screenshotId: screenshotId
6666
}
6767
];
6868
// Store globally for use in processAccessibilityReport

0 commit comments

Comments
 (0)