So basically I am able to get the text for all the buttons but I am getting the error which says Undefined when asserting that it's true. Please I need help, let me know if more information is needed. Thank you
async isNoticationsEnabled(type: string) {
const notificationType = await this.getNotificationsTypeByText(type);
const selectContainer = await notificationType.$$('.NotificationTypeSchedule__selectContainer');
const sms = selectContainer[1];
const mobilePush = selectContainer[2];
const webPush = selectContainer[3];
const enabled = [];
enabled.push(sms, mobilePush, webPush)
for (let i = 0; i < enabled.length; i++) {
const elements = enabled[i];
if(await elements?.getText() === 'On') {
return true;
}
}
}
Output:
expect(received).toBe(expected) // Object.is equality
Expected: true
Received: undefined
42 | expect(await NotificationsTabs.isNotificationSectionDisplayed()).toBe(true)
43 | await NotificationsTabs.scrollTo('Note Mentions')
> 44 | expect(await NotificationsTabs.isNoticationsEnabled('Note Mentions')).toBe(true);
| ^
45 | });
46 | });