MOBILE-4470 behat: Fix header step
parent
bb4736a5b7
commit
f6b5cd9d79
|
@ -509,16 +509,16 @@ export class TestingBehatRuntimeService {
|
||||||
getHeader(): string {
|
getHeader(): string {
|
||||||
this.log('Action - Get header');
|
this.log('Action - Get header');
|
||||||
|
|
||||||
let titles = Array.from(document.querySelectorAll<HTMLElement>('.ion-page:not(.ion-page-hidden) > ion-header h1'))
|
const getBySelector = (selector: string ) => Array.from(document.querySelectorAll<HTMLElement>(selector))
|
||||||
.filter((title) => TestingBehatDomUtils.isElementVisible(title, document.body))
|
.filter((title) => TestingBehatDomUtils.isElementVisible(title, document.body))
|
||||||
.map((title) => title.innerText.trim());
|
.map((title) => title.innerText.trim())
|
||||||
|
.filter((title) => title.length > 0);
|
||||||
|
|
||||||
|
let titles = getBySelector('.ion-page:not(.ion-page-hidden) > ion-header h1');
|
||||||
|
|
||||||
// Collapsed title, get the floating title.
|
// Collapsed title, get the floating title.
|
||||||
if (titles.length < 0 || (titles.length === 1 && titles[0] === '')) {
|
if (titles.length === 0) {
|
||||||
titles = Array.from(document.querySelectorAll<HTMLElement>(
|
titles = getBySelector('.ion-page:not(.ion-page-hidden) h1.collapsible-header-floating-title');
|
||||||
'.ion-page:not(.ion-page-hidden) h1.collapsible-header-floating-title',
|
|
||||||
)).filter((title) => TestingBehatDomUtils.isElementVisible(title, document.body))
|
|
||||||
.map((title) => title.innerText.trim());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (titles.length > 1) {
|
if (titles.length > 1) {
|
||||||
|
|
Loading…
Reference in New Issue