@greendrake/e2e 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greendrake/e2e",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Playwright kit for single-page apps: config factories, a same-origin crawler, a clipped-content detector, a polling helper and a layout checker",
5
5
  "license": "MIT",
6
6
  "author": "Eugene Greendrake <eugene@greendrake.nz>",
@@ -45,7 +45,7 @@
45
45
  "@playwright/test": ">=1.49.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@greendrake/dev-config": "0.1.0",
48
+ "@greendrake/dev-config": "0.3.0",
49
49
  "@playwright/test": "1.60.0",
50
50
  "typescript": "6.0.3"
51
51
  }
@@ -5,7 +5,7 @@ import { expect, type Page } from '@playwright/test'
5
5
  // fail on any uncaught page error. Returns the visited paths for reporting.
6
6
 
7
7
  const hasFileExtension = (url: string): boolean => {
8
- const pathname = url.split('?')[0].split('#')[0]
8
+ const pathname = url.replace(/[?#].*/, '')
9
9
  const lastSegment = pathname.split('/').pop()
10
10
  return !!lastSegment && lastSegment.includes('.') && !lastSegment.startsWith('.')
11
11
  }
@@ -100,7 +100,7 @@ export const crawlLocalLinks = async (page: Page, origin: string): Promise<strin
100
100
  // Collect same-origin page links for the crawl queue.
101
101
  const links = await page.evaluate(() => {
102
102
  const fileExt = (url: string): boolean => {
103
- const pathname = url.split('?')[0].split('#')[0]
103
+ const pathname = url.replace(/[?#].*/, '')
104
104
  const lastSegment = pathname.split('/').pop()
105
105
  return !!lastSegment && lastSegment.includes('.') && !lastSegment.startsWith('.')
106
106
  }