-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from chromaui/jwir3/CAP-1204-content-type-exte…
…nsions
- Loading branch information
Showing
19 changed files
with
1,338 additions
and
1,111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
dist/**/*.js | ||
storybook-static/**/*.js | ||
|
||
tsup.config.ts | ||
tsup.config.ts | ||
playwright.config.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { test, expect } from '../src'; | ||
|
||
test('it should not break when there is a file and a directory with the same name', async ({ | ||
page, | ||
}) => { | ||
await page.goto('/conflict'); | ||
const imgLocator1 = page.locator('#cloudImg'); | ||
const imgLocator2 = page.locator('#toonImg'); | ||
expect(imgLocator1).not.toBeNull(); | ||
expect(imgLocator2).not.toBeNull(); | ||
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
const path = require('path'); | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
const express = require('express'); | ||
|
||
const app = express(); | ||
const port = 3000; | ||
|
||
const htmlIntro = `<!doctype html><html>`; | ||
const htmlOutro = `</html>`; | ||
|
||
app.get('/', (req, res) => { | ||
res.send(`${htmlIntro}<body>testing 1 2 3</body>${htmlOutro}`); | ||
}); | ||
|
||
app.get('/toolong', (req, res) => { | ||
res.send( | ||
`${htmlIntro}<body><img id="cloudImg" src="/blahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahb"></body>${htmlOutro}` | ||
); | ||
}); | ||
|
||
app.get( | ||
'/blahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahbblahblahblahblahblahblahblahblahblahblahb', | ||
(req, res) => { | ||
res.sendFile(path.join(__dirname, 'fixtures/cloud.png')); | ||
} | ||
); | ||
|
||
app.get('/conflict', (req, res) => { | ||
res.send(`${htmlIntro}<body><img src="/img"></img><img src="/img/another"></body>${htmlOutro}`); | ||
}); | ||
|
||
app.get('/img', (req, res) => { | ||
res.sendFile(path.join(__dirname, 'fixtures/cloud.png')); | ||
}); | ||
|
||
app.get('/img/another', (req, res) => { | ||
res.sendFile(path.join(__dirname, 'fixtures/another.jpg')); | ||
}); | ||
|
||
app.listen(port, () => { | ||
console.log(`Example app listening on port ${port}`); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { test, expect } from '../src'; | ||
|
||
test('it should not break when a piece of a filename is longer than 256 bytes', async ({ | ||
page, | ||
}) => { | ||
await page.goto('/toolong'); | ||
const imgLocator = page.locator('#cloudImg'); | ||
expect(imgLocator).not.toBeNull(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { defineConfig, devices } from '@playwright/test'; | ||
|
||
export default defineConfig({ | ||
testDir: './__playwright-tests__', | ||
use: { baseURL: 'http://localhost:3000' }, | ||
|
||
webServer: { | ||
command: 'yarn test:server', | ||
url: 'http://127.0.0.1:3000', | ||
reuseExistingServer: !process.env.CI, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { elementNode, serializedElementNodeWithId } from '@chromaui/rrweb-snapshot'; | ||
import { SourceMapper } from './source-mapper'; | ||
|
||
describe('SourceMapper', () => { | ||
it('should map a piece of a source that is longer than 5 characters to a truncated version', () => { | ||
const originalObject: elementNode = { | ||
childNodes: [ | ||
{ | ||
attributes: { | ||
src: '/home/on/the/range', | ||
}, | ||
} as unknown as serializedElementNodeWithId, | ||
], | ||
} as elementNode; | ||
|
||
const sourceMap = new SourceMapper(originalObject).shortenFileNamesLongerThan(4).build(); | ||
const expectedMap = new Map<string, string>(); | ||
expectedMap.set('/home/on/the/range', '/home/on/the/rang'); | ||
expect(sourceMap).toEqual(expectedMap); | ||
}); | ||
|
||
it('should map all pieces of a source that are longer than 12 characters to truncated versions', () => { | ||
const originalObject: elementNode = { | ||
childNodes: [ | ||
{ | ||
attributes: { | ||
src: '/themaninblackfledthrough/the/desert/and/the/gunslingerfollowed', | ||
}, | ||
} as unknown as serializedElementNodeWithId, | ||
], | ||
} as elementNode; | ||
|
||
const sourceMap = new SourceMapper(originalObject).shortenFileNamesLongerThan(4).build(); | ||
const expectedMap = new Map<string, string>(); | ||
expectedMap.set( | ||
'/themaninblackfledthrough/the/desert/and/the/gunslingerfollowed', | ||
'/them/the/dese/and/the/guns' | ||
); | ||
expect(sourceMap).toEqual(expectedMap); | ||
}); | ||
}); |
Oops, something went wrong.