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

Me 18059 esm tests over preview build #727

Merged
merged 38 commits into from
Nov 4, 2024

Conversation

ShayLevi
Copy link
Contributor

The change is to run on the ESM test over deploy preview build instead from edge.
Local tests (if needed to run from the branch) will be executed against latest EDGE (https://cld-vp-esm-pages.netlify.app/)
Also added waitForDeployPreviewUrl function to check if deploy URL is ready

Relevant task: https://cloudinary.atlassian.net/browse/ME-18059

Copy link

netlify bot commented Oct 30, 2024

Deploy Preview for cld-video-player ready!

Name Link
🔨 Latest commit 636a3ca
🔍 Latest deploy log https://app.netlify.com/sites/cld-video-player/deploys/67287695ed709400084cadf8
😎 Deploy Preview https://deploy-preview-727--cld-video-player.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Oct 30, 2024

Deploy Preview for cld-vp-esm-pages ready!

Name Link
🔨 Latest commit 636a3ca
🔍 Latest deploy log https://app.netlify.com/sites/cld-vp-esm-pages/deploys/672876954a549e00084de63d
😎 Deploy Preview https://deploy-preview-727--cld-vp-esm-pages.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ShayLevi ShayLevi marked this pull request as ready for review October 30, 2024 18:32
@ShayLevi ShayLevi requested a review from a team as a code owner October 30, 2024 18:32
Copy link
Contributor

@ehab-cl ehab-cl left a comment

Choose a reason for hiding this comment

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

LGTM 💪
I am not approving since i think Refael knows better about Playwright APIs than me

@@ -6,7 +6,7 @@ import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testMatch: /test\/e2e\/specs\/.*(\.spec.ts)/,

timeout: 45000,
timeout: 150000,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you have to increase the timeout?
(just curious why you needed this change)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok i see now it is for the deployment preview to be loaded

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. The page can take some time to be loaded so the timeout was increased.


const EDGE_ESM_URL = 'https://cld-vp-esm-pages.netlify.app/';
// On PR level it will use the preview deploy URL and locally it will use the latest EDGE.
const ESM_URL = process.env.PREVIEW_URL || EDGE_ESM_URL;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const ESM_URL = process.env.PREVIEW_URL || EDGE_ESM_URL;
const ESM_URL = process.env.PREVIEW_URL ?? EDGE_ESM_URL;

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. Thanks.

// On PR level it will use the preview deploy URL and locally it will use the latest EDGE.
const ESM_URL = process.env.PREVIEW_URL || EDGE_ESM_URL;
// Flag to indicate if the deploy preview URL is ready
let PREVIEW_URL_LOADED = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

since this is a changing variable i think it is better to name it like isPreviewURLLoaded... since a snake case is often associated with constant variables

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. Thanks

* Waits for a deploy preview URL to become available by making repeated requests and check that link is visible.
*/
async function waitForDeployPreviewUrl(link: ExampleLinkType, page: Page): Promise<void> {
console.log('Waiting for deploy preview to be ready...');
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
console.log('Waiting for deploy preview to be ready...');

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The print was added to get indication that we're waiting for the preview and not just wait long time without any indication which can feel like something is stuck.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Print was removed

@ShayLevi ShayLevi merged commit e6c9a9c into edge Nov 4, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants