Fix accept gv2 invite test

This commit is contained in:
Fedor Indutny 2024-06-05 14:48:54 -07:00 committed by GitHub
parent 1e2f80e9f9
commit 012e771fc2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 2 deletions

View file

@ -170,6 +170,7 @@ export function ModalPage({
i18n,
modalFooter,
modalHeaderChildren,
modalName,
moduleClassName,
onBackButtonClick,
onClose,
@ -220,6 +221,7 @@ export function ModalPage({
tabIndex={-1}
aria-labelledby={title ? `${id}-title` : undefined}
aria-describedby={ariaDescribedBy}
data-testid={modalName}
onClick={event => {
event.stopPropagation();
}}

View file

@ -76,7 +76,10 @@ export function useAnimated(
useChain(shouldShowModal ? [overlayRef, modalRef] : [modalRef, overlayRef]);
const close = useCallback(() => {
setState(currentState => {
if (currentState === ModalState.Open) {
if (
currentState === ModalState.Open ||
currentState === ModalState.Opening
) {
return ModalState.Closing;
}
return currentState;

View file

@ -163,7 +163,14 @@ describe('pnp/accept gv2 invite', function (this: Mocha.Suite) {
.locator('.conversation-details-panel >> "Leave group"')
.click();
await window.locator('.module-Modal button >> "Leave"').click();
await window
.getByTestId('ConfirmationDialog.ConversationDetailsAction.confirmLeave')
.getByRole('button', { name: 'Leave' })
.click();
debug('Get back to timeline');
await window.locator('.ConversationPanel__header__back-button').click();
debug('Waiting for final group update');
group = await phone.waitForGroupUpdate(group);
@ -173,6 +180,11 @@ describe('pnp/accept gv2 invite', function (this: Mocha.Suite) {
assert(!group.getMemberByServiceId(desktop.pni));
assert(!group.getPendingMemberByServiceId(desktop.aci));
assert(group.getPendingMemberByServiceId(desktop.pni));
debug('Waiting for notification');
await window
.locator('.SystemMessage:has-text("You left the group")')
.waitFor();
});
it('should decline PNI invite and modify the group state', async () => {