Show preview alert only for preview apps (#15926)

* show alert for only preview apps

* update tests
This commit is contained in:
Karan Hotchandani 2024-04-17 13:59:21 +05:30 committed by GitHub
parent 67f01625b0
commit 92962c43ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 30 additions and 26 deletions

View File

@ -143,7 +143,6 @@ const MarketPlaceAppDetails = () => {
{t('label.browse-app-plural')}
</Typography.Text>
</Button>
<div className="flex-center m-t-md">
<AppLogo appName={appData?.fullyQualifiedName ?? ''} />
</div>
@ -159,37 +158,37 @@ const MarketPlaceAppDetails = () => {
</Button>
</Tooltip>
<Alert
className="m-t-md text-xs d-flex items-start p-xs"
message={
<>
<Typography.Text>
<Transi18next
i18nKey="message.paid-addon-description"
renderElement={
<span data-testid="appName" style={{ fontWeight: 600 }} />
}
values={{
app: appData?.displayName,
}}
/>
</Typography.Text>
<Typography.Text className="d-block">
{t('message.please-contact-us')}
</Typography.Text>
</>
}
type="info"
/>
{isPreviewApp && (
<Alert
className="m-t-md text-xs d-flex items-start p-xs"
message={
<>
<Typography.Text>
<Transi18next
i18nKey="message.paid-addon-description"
renderElement={
<span data-testid="appName" style={{ fontWeight: 600 }} />
}
values={{
app: appData?.displayName,
}}
/>
</Typography.Text>
<Typography.Text className="d-block">
{t('message.please-contact-us')}
</Typography.Text>
</>
}
type="info"
/>
)}
<div className="m-t-md">
<CheckMarkIcon className="v-middle m-r-xss" />
<Typography.Text className="text-xs font-medium text-grey-muted">
{t('message.marketplace-verify-msg')}
</Typography.Text>
</div>
<Space className="p-t-lg" direction="vertical" size={8}>
<Typography.Text>
{appData?.supportEmail && (

View File

@ -11,6 +11,7 @@
* limitations under the License.
*/
import {
queryByTestId,
render,
screen,
waitForElementToBeRemoved,
@ -95,7 +96,7 @@ jest.mock('../AppLogo/AppLogo.component', () =>
describe('MarketPlaceAppDetails component', () => {
it('should render all necessary elements if app details fetch successfully', async () => {
render(<MarketPlaceAppDetails />);
const { container } = render(<MarketPlaceAppDetails />);
await waitForElementToBeRemoved(() => screen.getByText('Loader'));
@ -116,6 +117,10 @@ describe('MarketPlaceAppDetails component', () => {
expect(screen.getByText('label.privacy-policy')).toBeInTheDocument();
expect(screen.getByText('label.get-app-support')).toBeInTheDocument();
const appName = queryByTestId(container, 'appName');
expect(appName).not.toBeInTheDocument();
// actions check
userEvent.click(
screen.getByRole('button', { name: 'left label.browse-app-plural' })