MOBILE-3947 behat: Fix ion-toggle press

main
Pau Ferrer Ocaña 2024-01-09 14:38:17 +01:00
parent 1f667da246
commit 90a47b2441
3 changed files with 16 additions and 10 deletions

View File

@ -346,7 +346,6 @@ Feature: Test basic usage of messages in app
Then I should find "test message" in the app
And I should find "Muted conversation" in the app
@ionic7_failure
Scenario: Self conversations
Given I entered the app as "student1"
When I press "Messages" in the app

View File

@ -7,17 +7,22 @@
[href]="item.href" (click)="itemClicked($event, item)" [attr.aria-label]="item.ariaAction" [hidden]="item.hidden"
[detail]="!!(item.href && !item.iconAction)" role="menuitem" [button]="!!(item.href && !item.iconAction)"
[showBrowserWarning]="item.showBrowserWarning">
<ion-label>
<ion-toggle *ngIf="item.iconAction === 'toggle'" [(ngModel)]="item.toggle" (ionChange)="item.toggleChanged($event)">
<p class="item-heading">
<core-format-text [clean]="true" [text]="item.content" [filter]="false" />
</p>
</ion-label>
<ng-container *ngIf="(item.href || item.action) && item.iconAction">
<ion-icon *ngIf="item.iconAction !== 'spinner' && item.iconAction !== 'toggle'" [name]="item.iconAction"
[class.icon-slash]="item.iconSlash" slot="end" aria-hidden="true" />
<ion-spinner *ngIf="item.iconAction === 'spinner'" slot="end" [attr.aria-label]="'core.loading' | translate" />
<ion-toggle *ngIf="item.iconAction === 'toggle'" [(ngModel)]="item.toggle" (ionChange)="item.toggleChanged($event)"
slot="end" />
</ion-toggle>
<ng-container *ngIf="item.iconAction !== 'toggle'">
<ion-label>
<p class="item-heading">
<core-format-text [clean]="true" [text]="item.content" [filter]="false" />
</p>
</ion-label>
<ng-container *ngIf="(item.href || item.action) && item.iconAction">
<ion-icon *ngIf="item.iconAction !== 'spinner'" [name]="item.iconAction" [class.icon-slash]="item.iconSlash" slot="end"
aria-hidden="true" />
<ion-spinner *ngIf="item.iconAction === 'spinner'" slot="end" [attr.aria-label]="'core.loading' | translate" />
</ng-container>
</ng-container>
<ion-badge class="{{item.badgeClass}}" slot="end" *ngIf="item.badge">
<span [attr.ara-hidden]="!!item.badgeA11yText">{{item.badge}}</span>

View File

@ -612,8 +612,10 @@ export class TestingBehatDomUtilsService {
// may not work without doing this.
const parentElement = this.getParentElement(element);
if (parentElement && parentElement.matches('ion-button, ion-back-button')) {
if (parentElement?.matches('ion-button, ion-back-button')) {
element = parentElement;
} else if (parentElement?.tagName === 'ION-ITEM' && parentElement?.classList.contains('clickable')) {
element = parentElement.querySelector<HTMLElement>('ion-toggle') || element;
}
const rect = await this.ensureElementVisible(element);