0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-04-07 23:01:25 -05:00

feat(console): hide m2m and third-party app in the empty app list guide ()

* feat(console): hide m2m and third-party app in the empty app list guide

hide m2m and third-party app in the empty app status guide

* fix(test): fix integration tests

fix integration tests
This commit is contained in:
simeng-li 2024-01-29 18:12:56 +08:00 committed by GitHub
parent 904081cb48
commit 873ef1ebd0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 4 deletions
packages
console/src/pages/Applications/components/GuideLibrary
integration-tests/src/tests/console/applications

View file

@ -50,6 +50,17 @@ function GuideLibrary({ className, hasCardBorder, hasCardButton }: Props) {
[getFilteredAppGuideMetadata, keyword, filterCategories]
);
// Only show third party app and machine to machine app in create modal. Hide them by default in the empty app guide page.
const fullApplicationCategories = useMemo(() => {
if (isApplicationCreateModal) {
return allAppGuideCategories;
}
return allAppGuideCategories.filter(
(category) => category !== thirdPartyAppCategory && category !== 'MachineToMachine'
);
}, [isApplicationCreateModal]);
const onClickGuide = useCallback((data: SelectedGuide) => {
setShowCreateForm(true);
setSelectedGuide(data);
@ -138,7 +149,7 @@ function GuideLibrary({ className, hasCardBorder, hasCardButton }: Props) {
className={styles.protectedAppCard}
/>
)}
{(filterCategories.length > 0 ? filterCategories : allAppGuideCategories).map(
{(filterCategories.length > 0 ? filterCategories : fullApplicationCategories).map(
(category) =>
structuredMetadata[category].length > 0 && (
<GuideCardGroup

View file

@ -12,9 +12,18 @@ import { expectNavigation } from '#src/utils.js';
import { frameworkGroupLabels, type ApplicationCase } from './constants.js';
export const expectFrameworksInGroup = async (page: Page, groupSelector: string) => {
export const expectFrameworksInGroup = async (
page: Page,
groupSelector: string,
isTablePlaceHolder = false
) => {
/* eslint-disable no-await-in-loop */
for (const groupLabel of frameworkGroupLabels) {
// Expect the framework group to be visible, Third-party and Machine-to-machine are not visible in table placeholder
for (const groupLabel of isTablePlaceHolder
? frameworkGroupLabels.filter(
(label) => label !== 'Third-party' && label !== 'Machine-to-machine'
)
: frameworkGroupLabels) {
const frameGroup = await expect(page).toMatchElement(groupSelector, {
text: groupLabel,
});

View file

@ -54,7 +54,7 @@ describe('applications', () => {
{ text: 'Select a framework or tutorial', timeout: 2000 }
);
await expectFrameworksInGroup(page, 'div[class$=guideGroup]:has(>label)');
await expectFrameworksInGroup(page, 'div[class$=guideGroup]:has(>label)', true);
});
it('create the initial application from the table placeholder', async () => {