Skip to content

Commit 0412970

Browse files
authored
fix(explore): browsing chunked files and inspecting via context menu (#2305)
* fix(explore): chunked files This includes latest ipld-explorer-components with fix from ipfs/ipld-explorer-components#462 also bumped kubo and caniuse and non-breaking audit suggestions * fix(files): Inspect via context menu Closes #2306
1 parent e2ae110 commit 0412970

File tree

4 files changed

+77
-44
lines changed

4 files changed

+77
-44
lines changed

package-lock.json

Lines changed: 41 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"ipfs-css": "^1.4.0",
6767
"ipfs-geoip": "^9.1.0",
6868
"ipfs-provider": "^2.1.0",
69-
"ipld-explorer-components": "^8.1.0",
69+
"ipld-explorer-components": "^8.1.2",
7070
"is-ipfs": "^8.0.1",
7171
"istextorbinary": "^6.0.0",
7272
"it-all": "^1.0.5",
@@ -165,7 +165,7 @@
165165
"ipfsd-ctl": "^14.1.0",
166166
"jest": "^29.7.0",
167167
"jest-environment-jsdom": "^29.7.0",
168-
"kubo": "^0.30.0",
168+
"kubo": "^0.32.1",
169169
"npm-run-all": "^4.1.5",
170170
"nyc": "^15.1.0",
171171
"os-browserify": "^0.3.0",

src/files/FilesPage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const FilesPage = ({
7373
}
7474

7575
const onAddByPath = (path, name) => doFilesAddPath(files.path, path, name)
76-
const onInspect = (cid) => doUpdateHash(`/explore/ipfs/${cid}`)
76+
const onInspect = (cid) => doUpdateHash(`/explore/${cid}`)
7777
const showModal = (modal, files = null) => setModals({ show: modal, files })
7878
const hideModal = () => setModals({})
7979
const handleContextMenu = (ev, clickType, file, pos) => {

test/e2e/files.test.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,37 @@ test.describe('Files screen', () => {
6262
await page.waitForSelector(`text=${human(file.size)}`)
6363
}
6464
})
65+
66+
test('should have active Context menu that allows Inspection of the DAG', async ({ page }) => {
67+
// dedicated test file to make this isolated from the rest
68+
const testFilename = 'explorer-context-menu-test.txt'
69+
const testCid = 'bafkqaddjnzzxazldoqwxizltoq'
70+
71+
// first: create a test file
72+
const button = 'button[id="import-button"]'
73+
await page.waitForSelector(button, { state: 'visible' })
74+
await page.click(button)
75+
await page.waitForSelector('#add-by-path', { state: 'visible' })
76+
page.click('button[id="add-by-path"]')
77+
await page.waitForSelector('div[role="dialog"] input[name="name"]')
78+
await page.fill('div[role="dialog"] input[name="path"]', `/ipfs/${testCid}`)
79+
await page.fill('div[role="dialog"] input[name="name"]', testFilename)
80+
await page.keyboard.press('Enter')
81+
// expect file with matching filename to be added to the file list
82+
await page.waitForSelector(`.File:has-text("${testFilename}")`)
83+
84+
// open context menu
85+
const cbutton = `button[aria-label="View more options for ${testFilename}"]`
86+
await page.waitForSelector(cbutton, { state: 'visible' })
87+
await page.click(cbutton, { force: true })
88+
await page.waitForSelector('text=Inspect', { state: 'visible' })
89+
90+
// click on Inspect option
91+
await page.waitForSelector('text=Inspect', { state: 'visible' })
92+
await page.locator('button:has-text("Inspect"):enabled').click({ force: true })
93+
94+
// confirm Explore screen was opened with correct CID
95+
await page.waitForURL(`/#/explore/${testCid}`)
96+
await page.waitForSelector('text="CID info"')
97+
})
6598
})

0 commit comments

Comments
 (0)