Skip to content

Commit 46b317e

Browse files
committed
test: fix e2e tests regarding recent preview_urls defaulting to false
Fixes existing tests, and adds a new test for `preview_urls = true`.
1 parent 38af559 commit 46b317e

File tree

2 files changed

+43
-9
lines changed

2 files changed

+43
-9
lines changed

packages/wrangler/e2e/provision.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ describe.skipIf(!CLOUDFLARE_ACCOUNT_ID)(
183183
env.R2 (inherited) R2 Bucket
184184
Uploaded tmp-e2e-worker-00000000-0000-0000-0000-000000000000 (TIMINGS)
185185
Worker Version ID: 00000000-0000-0000-0000-000000000000
186-
Version Preview URL: https://tmp-e2e-worker-PREVIEW-URL.SUBDOMAIN.workers.dev
187186
To deploy this version to production traffic use the command wrangler versions deploy
188187
Changes to non-versioned settings (config properties 'logpush' or 'tail_consumers') take effect after your next deployment using the command wrangler versions deploy
189188
Changes to triggers (routes, custom domains, cron schedules, etc) must be applied with the command wrangler triggers deploy"

packages/wrangler/e2e/versions.test.ts

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ describe.skipIf(!CLOUDFLARE_ACCOUNT_ID)(
6969
Worker Startup Time: (TIMINGS)
7070
Uploaded tmp-e2e-worker-00000000-0000-0000-0000-000000000000 (TIMINGS)
7171
Worker Version ID: 00000000-0000-0000-0000-000000000000
72-
Version Preview URL: https://tmp-e2e-worker-PREVIEW-URL.SUBDOMAIN.workers.dev
7372
To deploy this version to production traffic use the command wrangler versions deploy
7473
Changes to non-versioned settings (config properties 'logpush' or 'tail_consumers') take effect after your next deployment using the command wrangler versions deploy
7574
Changes to triggers (routes, custom domains, cron schedules, etc) must be applied with the command wrangler triggers deploy"
@@ -185,7 +184,6 @@ describe.skipIf(!CLOUDFLARE_ACCOUNT_ID)(
185184
Worker Startup Time: (TIMINGS)
186185
Uploaded tmp-e2e-worker-00000000-0000-0000-0000-000000000000 (TIMINGS)
187186
Worker Version ID: 00000000-0000-0000-0000-000000000000
188-
Version Preview URL: https://tmp-e2e-worker-PREVIEW-URL.SUBDOMAIN.workers.dev
189187
To deploy this version to production traffic use the command wrangler versions deploy
190188
Changes to non-versioned settings (config properties 'logpush' or 'tail_consumers') take effect after your next deployment using the command wrangler versions deploy
191189
Changes to triggers (routes, custom domains, cron schedules, etc) must be applied with the command wrangler triggers deploy"
@@ -589,7 +587,6 @@ describe.skipIf(!CLOUDFLARE_ACCOUNT_ID)(
589587
Worker Startup Time: (TIMINGS)
590588
Uploaded tmp-e2e-worker-00000000-0000-0000-0000-000000000000 (TIMINGS)
591589
Worker Version ID: 00000000-0000-0000-0000-000000000000
592-
Version Preview URL: https://tmp-e2e-worker-PREVIEW-URL.SUBDOMAIN.workers.dev
593590
To deploy this version to production traffic use the command wrangler versions deploy
594591
Changes to non-versioned settings (config properties 'logpush' or 'tail_consumers') take effect after your next deployment using the command wrangler versions deploy
595592
Changes to triggers (routes, custom domains, cron schedules, etc) must be applied with the command wrangler triggers deploy"
@@ -631,7 +628,6 @@ describe.skipIf(!CLOUDFLARE_ACCOUNT_ID)(
631628
Worker Startup Time: (TIMINGS)
632629
Uploaded tmp-e2e-worker-00000000-0000-0000-0000-000000000000 (TIMINGS)
633630
Worker Version ID: 00000000-0000-0000-0000-000000000000
634-
Version Preview URL: https://tmp-e2e-worker-PREVIEW-URL.SUBDOMAIN.workers.dev
635631
To deploy this version to production traffic use the command wrangler versions deploy
636632
Changes to non-versioned settings (config properties 'logpush' or 'tail_consumers') take effect after your next deployment using the command wrangler versions deploy
637633
Changes to triggers (routes, custom domains, cron schedules, etc) must be applied with the command wrangler triggers deploy"
@@ -652,6 +648,45 @@ describe.skipIf(!CLOUDFLARE_ACCOUNT_ID)(
652648
`);
653649
});
654650

651+
it("should upload version of Worker with preview_urls enabled", async () => {
652+
await helper.seed({
653+
"wrangler.toml": dedent`
654+
name = "${workerName}"
655+
main = "src/index.ts"
656+
compatibility_date = "2023-01-01"
657+
preview_urls = true
658+
`,
659+
"src/index.ts": dedent`
660+
export default {
661+
fetch(request) {
662+
return new Response("Hello World!")
663+
}
664+
}
665+
`,
666+
"package.json": dedent`
667+
{
668+
"name": "${workerName}",
669+
"version": "0.0.0",
670+
"private": true
671+
}
672+
`,
673+
});
674+
await helper.run("wrangler triggers deploy --force-subdomain-deploy");
675+
const upload = await helper.run(
676+
`wrangler versions upload --message "Upload via e2e test" --tag "e2e-version-with-preview"`
677+
);
678+
expect(normalize(upload.stdout)).toMatchInlineSnapshot(`
679+
"Total Upload: xx KiB / gzip: xx KiB
680+
Worker Startup Time: (TIMINGS)
681+
Uploaded tmp-e2e-worker-00000000-0000-0000-0000-000000000000 (TIMINGS)
682+
Worker Version ID: 00000000-0000-0000-0000-000000000000
683+
Version Preview URL: https://tmp-e2e-worker-PREVIEW-URL.SUBDOMAIN.workers.dev
684+
To deploy this version to production traffic use the command wrangler versions deploy
685+
Changes to non-versioned settings (config properties 'logpush' or 'tail_consumers') take effect after your next deployment using the command wrangler versions deploy
686+
Changes to triggers (routes, custom domains, cron schedules, etc) must be applied with the command wrangler triggers deploy"
687+
`);
688+
});
689+
655690
it("should include version preview url in output file", async () => {
656691
const outputFile = path.join(helper.tmpPath, "output.jsonnd");
657692
const upload = await helper.run(
@@ -677,10 +712,10 @@ describe.skipIf(!CLOUDFLARE_ACCOUNT_ID)(
677712
const { stdout } = await helper.run(`wrangler delete`);
678713

679714
expect(normalize(stdout)).toMatchInlineSnapshot(`
680-
"? Are you sure you want to delete tmp-e2e-worker-00000000-0000-0000-0000-000000000000? This action cannot be undone.
681-
🤖 Using fallback value in non-interactive context: yes
682-
Successfully deleted tmp-e2e-worker-00000000-0000-0000-0000-000000000000"
683-
`);
715+
"? Are you sure you want to delete tmp-e2e-worker-00000000-0000-0000-0000-000000000000? This action cannot be undone.
716+
🤖 Using fallback value in non-interactive context: yes
717+
Successfully deleted tmp-e2e-worker-00000000-0000-0000-0000-000000000000"
718+
`);
684719
});
685720
}
686721
);

0 commit comments

Comments
 (0)