test: Add RegExp tests for Next.config.js rewrites#9681
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
|
Thank you for following the naming conventions! 🙏 |
c5e491d to
282cb2a
Compare
| plugins.push(withAxiom); | ||
|
|
||
| /** Needed to rewrite public booking page, gets all static pages but [user] */ | ||
| const pages = glob |
There was a problem hiding this comment.
Needed by tests so extracted it out. next.config.js can't export pages directly
| const userTypeRouteRegExp = `/:user((?!${pages.join("/|")}$)[^/]*)/:type((?!book)[^/]+)`; | ||
| const teamTypeRouteRegExp = "/team/:slug/:type((?!book)[^/]+)"; | ||
| const privateLinkRouteRegExp = "/d/:link/:slug((?!book)[^/]+)"; | ||
| const embedUserTypeRouteRegExp = `/:user((?!${pages.join("|")}).*)/:type/embed`; | ||
| const embedTeamTypeRouteRegExp = "/team/:slug/:type/embed"; |
There was a problem hiding this comment.
Moved them out in case we need to import these directly and convert to valid JS RegExp automatically.
| // const parts = nextJsRegExp.split(':'); | ||
|
|
||
| // const validNamedGroupRegExp = parts.map((part, index)=>{ | ||
| // if (index === 0) { | ||
| // return part; | ||
| // } | ||
| // if (part.match(/^[a-zA-Z0-9]+$/)) { | ||
| // return `(?<${part}>[^/]+)` | ||
| // } | ||
| // part = part.replace(new RegExp('([^(]+)(.*)'), '(?<$1>$2)'); | ||
| // return part | ||
| // }).join(''); |
There was a problem hiding this comment.
Code for automatic conversion. It is tricky in itself. So, no magic in tests for now.
| // - /:user/ -> (?<user>[^/]+) | ||
| // - /:user(?!404)[^/]+/ -> (?<user>((?!404)[^/]+)) | ||
|
|
||
| // userTypeRouteRegExp = `/:user((?!${pages.join("/|")})[^/]*)/:type((?!book)[^/]+)`; |
There was a problem hiding this comment.
Added the next.js regex here for reference so that they can be easily compared.
| // - /:user/ -> (?<user>[^/]+) | ||
| // - /:user(?!404)[^/]+/ -> (?<user>((?!404)[^/]+)) |
There was a problem hiding this comment.
Things to do when doing the conversion
📦 Next.js Bundle Analysis for @calcom/webThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
ff7836d to
124098e
Compare
… test/next-js-rewrite-regex
Current Playwright Test Results Summary✅ 114 Passing - Run may still be in progress, this comment will be updated as current testing workflow or job completes... (Last updated on 06/21/2023 12:36:34pm UTC) Run DetailsRunning Workflow PR Update on Github Actions Commit: f23cf33 Started: 06/21/2023 12:33:20pm UTC
|
| Test Case | Last 7 days Failures | Last 7 days Flakes |
|---|---|---|
|
Popup Tests should be able to reschedule
Retry 2 • Retry 1 • Initial Attempt |
17.41% (35)35 / 201 runsfailed over last 7 days |
79.10% (159)159 / 201 runsflaked over last 7 days |
📄 packages/app-store/routing-forms/playwright/tests/basic.e2e.ts • 3 Flakes
Top 1 Common Error Messages
|
|
3 Test Cases Affected |
Test Case Results
| Test Case | Last 7 days Failures | Last 7 days Flakes |
|---|---|---|
|
Routing Forms Zero State Routing Forms should be able to edit the form
Retry 1 • Initial Attempt |
6.22% (13)13 / 209 runsfailed over last 7 days |
0.96% (2)2 / 209 runsflaked over last 7 days |
|
Routing Forms Seeded Routing Form Routing Link - Reporting and CSV Download
Retry 1 • Initial Attempt |
2.04% (4)4 / 196 runsfailed over last 7 days |
18.37% (36)36 / 196 runsflaked over last 7 days |
|
Routing Forms Seeded Routing Form Router URL should work
Retry 1 • Initial Attempt |
0% (0)0 / 196 runsfailed over last 7 days |
2.04% (4)4 / 196 runsflaked over last 7 days |
📄 apps/web/playwright/booking-pages.e2e.ts • 1 Flake
Test Case Results
| Test Case | Last 7 days Failures | Last 7 days Flakes |
|---|---|---|
|
pro user -- new-booker can reschedule a booking
Retry 1 • Initial Attempt |
0% (0)0 / 312 runsfailed over last 7 days |
0.64% (2)2 / 312 runsflaked over last 7 days |
124098e to
76a14cc
Compare
What does this PR do?
Why these tests
How does it work
Will we need these tests in future
What these tests are not
cc @ericrommel if you are up for those tests. I am happy writing tests too. I love writing tests
Note: I have intentionally avoiding doing automatic conversion to valid JS RegExp because that itself is complex. Steps to convert manually are straightforward and written in the code.
Type of change