Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playwright: add randomly generated integers as suffix for generated test files #55720

Closed
wants to merge 2 commits into from

Conversation

worldomonation
Copy link
Contributor

Changes proposed in this Pull Request

This PR proposes to increase uniqueness of the file name of generated test files by adding a pseudo-random suffix ranging from 100-999.

Testing instructions

Related to #55717, #55674.

@worldomonation worldomonation self-assigned this Aug 25, 2021
@worldomonation worldomonation marked this pull request as ready for review August 25, 2021 16:44
@matticbot
Copy link
Contributor

This PR does not affect the size of JS and CSS bundles shipped to the user's browser.

Generated by performance advisor bot at iscalypsofastyet.com.

@worldomonation worldomonation requested a review from a team August 25, 2021 16:44
@github-actions
Copy link

github-actions bot commented Aug 25, 2021

@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Aug 25, 2021
@worldomonation worldomonation linked an issue Aug 25, 2021 that may be closed by this pull request
Copy link
Contributor

@dpasque dpasque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Had two optional questions. Approved!

@@ -66,7 +66,8 @@ export function createTestFile( {
sourceFileName: string;
testFileName?: string;
} ): string {
let fileName = getTimestamp();
let fileName = `${ getTimestamp() }${ getRandomInteger( 100, 999 ) }`;
console.log( fileName );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you want to keep the log in here? Or was this just for debugging? Either is fine, just wanted to double check :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in dcc4eb5.

@@ -66,7 +66,8 @@ export function createTestFile( {
sourceFileName: string;
testFileName?: string;
} ): string {
let fileName = getTimestamp();
let fileName = `${ getTimestamp() }${ getRandomInteger( 100, 999 ) }`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking about this method of generating names, and wondered: do we want to separate the integer from the timestamp piece? In case we need to make sense of that timestamp piece later?

In other words, it would be something like: ${ getTimestamp() }x${ getRandomInteger( 100, 999 ) }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${ getTimestamp() }-${ getRandomInteger( 100, 999 ) } (a hyphen) would work well with the platform, I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed in dcc4eb5.

@worldomonation
Copy link
Contributor Author

On hold as #55678 is merged and as files are now generated asynchronously, it should help avoid conflicts.

@worldomonation
Copy link
Contributor Author

I've incorporated changes proposed here into #55693.

@worldomonation worldomonation deleted the pw/media-test-file-increase-uniqueness branch September 13, 2021 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Blocked / Hold [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Playwright: Increase uniqueness of test filename
3 participants