0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-02-17 22:04:19 -05:00

refactor(console): remove no-data social section from changes alert modal (#4424)

* refactor(console): remove no-data social section from changes alert modal

* test(console): add sign-in config diff ui tests
This commit is contained in:
Xiao Yijun 2023-09-05 10:59:01 +08:00 committed by GitHub
parent cb696d7e44
commit 8e4e08f731
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 7 deletions

View file

@ -25,11 +25,7 @@ function SocialTargetsDiffSection({ before, after, isAfter = false }: Props) {
const hasChanged = (target: string) => !(before.includes(target) && after.includes(target));
if (!groups) {
return null;
}
if (error) {
if (!groups || displayTargets.length === 0 || error) {
return null;
}

View file

@ -1,5 +1,12 @@
import { logtoConsoleUrl as logtoConsoleUrlString } from '#src/constants.js';
import { expectToClickNavTab, goToAdminConsole } from '#src/ui-helpers/index.js';
import {
expectModalWithTitle,
expectToClickModalAction,
expectToClickNavTab,
expectToSaveChanges,
goToAdminConsole,
waitForToast,
} from '#src/ui-helpers/index.js';
import { expectNavigation, appendPathname } from '#src/utils.js';
import { expectToSaveSignInExperience, waitForFormCard } from '../helpers.js';
@ -547,7 +554,31 @@ describe('sign-in experience(happy path): sign-up and sign-in', () => {
it('add social sign-in connector', async () => {
await expectToAddSocialSignInConnector(page, 'Apple');
await expectToSaveSignInExperience(page, { needToConfirmChanges: true });
// Should have diffs about social sign-in connector
await expectToSaveChanges(page);
await expectModalWithTitle(page, 'Reminder');
// No social content in the before section
const beforeSection = await expect(page).toMatchElement(
'div[class$=section]:has(div[class$=title])',
{ text: 'Before' }
);
await expect(
expect(beforeSection).toMatchElement('div[class$=title]', {
text: 'Social',
})
).rejects.toThrow();
// Have social content in the after section
const afterSection = await expect(page).toMatchElement(
'div[class$=section]:has(div[class$=title])',
{ text: 'After' }
);
await expect(afterSection).toMatchElement('div[class$=title]', {
text: 'Social',
});
await expectToClickModalAction(page, 'Confirm');
await waitForToast(page, { text: 'Saved' });
// Reset
await expectToRemoveSocialSignInConnector(page, 'Apple');