From dec79584c830593d299392fdfba321212a0bad62 Mon Sep 17 00:00:00 2001 From: kim Date: Wed, 22 May 2024 15:11:36 +0200 Subject: [PATCH] refactor: fix tests --- cypress/e2e/item/publish/coEditorSettings.cy.ts | 2 +- cypress/support/commands/navigation.ts | 2 +- src/components/common/ShareButton.tsx | 10 ++++++++-- src/components/layout/Navigation.tsx | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/cypress/e2e/item/publish/coEditorSettings.cy.ts b/cypress/e2e/item/publish/coEditorSettings.cy.ts index 8672151c9..790a3f260 100644 --- a/cypress/e2e/item/publish/coEditorSettings.cy.ts +++ b/cypress/e2e/item/publish/coEditorSettings.cy.ts @@ -69,7 +69,7 @@ const item = PackedFolderItemFactory( { permission: null, publicTag: { type: ItemTagType.Public } }, ); -describe.only('Co-editor setting permissions', () => { +describe('Co-editor setting permissions', () => { it('User signed out cannot edit co-editor setting', () => { cy.setUpApi({ items: [item], diff --git a/cypress/support/commands/navigation.ts b/cypress/support/commands/navigation.ts index 1c35a3076..81c50f9a7 100644 --- a/cypress/support/commands/navigation.ts +++ b/cypress/support/commands/navigation.ts @@ -18,5 +18,5 @@ Cypress.Commands.add('goToHome', () => { }); Cypress.Commands.add('goToItemWithNavigation', (id) => { - cy.get(`[href="${buildItemPath(id)}"]`).click(); + cy.get(`[href^="${buildItemPath(id)}"]`).click(); }); diff --git a/src/components/common/ShareButton.tsx b/src/components/common/ShareButton.tsx index 10b37ceea..626a6fd22 100644 --- a/src/components/common/ShareButton.tsx +++ b/src/components/common/ShareButton.tsx @@ -1,4 +1,4 @@ -import { Link } from 'react-router-dom'; +import { Link, useSearchParams } from 'react-router-dom'; import { ShareButton as GraaspShareButton } from '@graasp/ui'; @@ -16,10 +16,16 @@ type Props = { }; const ShareButton = ({ itemId }: Props): JSX.Element => { + const [searchParams] = useSearchParams(); const { t: translateBuilder } = useBuilderTranslation(); return ( - + { return ( <> - +