Skip to content

Commit

Permalink
fix: 'Showing a warning as unable to take screenshots when running th…
Browse files Browse the repository at this point in the history
…e test in Lambda Test' (close #6887) (#6897)
  • Loading branch information
miherlosev committed Feb 28, 2022
1 parent a18dc6a commit e001405
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .publishrc
Expand Up @@ -8,7 +8,7 @@
"gitTag": true
},
"confirm": false,
"publishTag": "latest",
"publishTag": "alpha",
"prePublishScript": "gulp test-server",
"postPublishScript": "gulp docker-publish"
}
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -2,7 +2,7 @@
"name": "testcafe",
"description": "Automated browser testing for the modern web development stack.",
"license": "MIT",
"version": "1.18.4",
"version": "1.18.5-alpha.1",
"author": {
"name": "Developer Express Inc.",
"url": "https://www.devexpress.com/"
Expand Down
2 changes: 1 addition & 1 deletion src/screenshots/utils.js
Expand Up @@ -17,7 +17,7 @@ const ALPHABET = '01';

export function generateScreenshotMark () {
// NOTE: 32-bit id
const id = customAlphabet(ALPHABET, MARK_LENGTH);
const id = customAlphabet(ALPHABET, MARK_LENGTH)();

// NOTE: array of RGB values
const markSeed = flatten(map(id, bit => bit === '0' ? [0, 0, 0, 255] : [255, 255, 255, 255]));
Expand Down
10 changes: 10 additions & 0 deletions test/server/util-test.js
Expand Up @@ -22,6 +22,7 @@ const { replaceLeadingSpacesWithNbsp } = require('../../lib/errors/test-run/util
const createTempProfile = require('../../lib/browser/provider/built-in/dedicated/chrome/create-temp-profile');
const parseUserAgent = require('../../lib/utils/parse-user-agent');
const diff = require('../../lib/utils/diff');
const { generateScreenshotMark } = require('../../lib/screenshots/utils');

const {
buildChromeArgs,
Expand Down Expand Up @@ -605,4 +606,13 @@ describe('Utils', () => {
expect(preferences.profile.content_settings.exceptions.popups).to.be.undefined;
});
});

it('generateScreenshotMark', () => {
const { markSeed } = generateScreenshotMark();

expect(markSeed.length).eql(128);

for (const markPixel of markSeed)
expect(markPixel === 0 || markPixel === 255).is.true;
});
});

0 comments on commit e001405

Please sign in to comment.