forked from immich-app/immich
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(web): shared link isOwner check (immich-app#9729)
* fix(web): shared link isOwner check * add e2e tests + update playwright * fix formatting
- Loading branch information
1 parent
39d2c4f
commit fdaa0e5
Showing
4 changed files
with
71 additions
and
16 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,52 @@ | ||
import { AssetFileUploadResponseDto, LoginResponseDto, SharedLinkType } from '@immich/sdk'; | ||
import { expect, test } from '@playwright/test'; | ||
import { utils } from 'src/utils'; | ||
|
||
test.describe('Asset Viewer Navbar', () => { | ||
let admin: LoginResponseDto; | ||
let asset: AssetFileUploadResponseDto; | ||
|
||
test.beforeAll(async () => { | ||
utils.initSdk(); | ||
await utils.resetDatabase(); | ||
admin = await utils.adminSetup(); | ||
asset = await utils.createAsset(admin.accessToken); | ||
}); | ||
|
||
test.describe('shared link without metadata', () => { | ||
test('visible guest actions', async ({ page }) => { | ||
const sharedLink = await utils.createSharedLink(admin.accessToken, { | ||
type: SharedLinkType.Individual, | ||
assetIds: [asset.id], | ||
showMetadata: false, | ||
}); | ||
await page.goto(`/share/${sharedLink.key}/photos/${asset.id}`); | ||
await page.waitForSelector('#immich-asset-viewer'); | ||
|
||
const expected = ['Zoom Image', 'Copy Image', 'Download']; | ||
const buttons = await page.getByTestId('asset-viewer-navbar-actions').getByRole('button').all(); | ||
|
||
for (const [i, button] of buttons.entries()) { | ||
await expect(button).toHaveAccessibleName(expected[i]); | ||
} | ||
}); | ||
|
||
test('visible owner actions', async ({ context, page }) => { | ||
const sharedLink = await utils.createSharedLink(admin.accessToken, { | ||
type: SharedLinkType.Individual, | ||
assetIds: [asset.id], | ||
showMetadata: false, | ||
}); | ||
await utils.setAuthCookies(context, admin.accessToken); | ||
await page.goto(`/share/${sharedLink.key}/photos/${asset.id}`); | ||
await page.waitForSelector('#immich-asset-viewer'); | ||
|
||
const expected = ['Share', 'Zoom Image', 'Copy Image', 'Download']; | ||
const buttons = await page.getByTestId('asset-viewer-navbar-actions').getByRole('button').all(); | ||
|
||
for (const [i, button] of buttons.entries()) { | ||
await expect(button).toHaveAccessibleName(expected[i]); | ||
} | ||
}); | ||
}); | ||
}); |
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