55 APPT_HTML_DARK_MODE_CLASS ,
66 TIMEOUT_1_SECOND ,
77 TIMEOUT_2_SECONDS ,
8- TIMEOUT_3_SECONDS ,
98 TIMEOUT_5_SECONDS ,
109 TIMEOUT_30_SECONDS ,
1110 APPT_LANGUAGE_SETTING_EN ,
@@ -14,6 +13,7 @@ import {
1413
1514export class SettingsPage {
1615 readonly page : Page ;
16+ readonly testPlatform : string ;
1717 readonly accountSettingsBtn : Locator ;
1818 readonly connectedAppsBtn : Locator ;
1919 readonly preferencesBtn : Locator ;
@@ -30,6 +30,7 @@ export class SettingsPage {
3030 readonly displayNameInput : Locator ;
3131 readonly bookingPageURLInput : Locator ;
3232 readonly copyLinkBtn : Locator ;
33+ readonly copyLinkToolTipText : Locator ;
3334 readonly cancelServiceBtn : Locator ;
3435 readonly cancelServiceConfirmCancelBtn : Locator ;
3536 readonly bookingPageSettingsBtn : Locator ;
@@ -47,10 +48,11 @@ export class SettingsPage {
4748 readonly savedSuccessfullyTextDE : Locator ;
4849 readonly saveBtnDE : Locator ;
4950 readonly revertBtn : Locator ;
51+ readonly googleSignInHdr : Locator ;
5052
51-
52- constructor ( page : Page ) {
53+ constructor ( page : Page , testPlatform : string = 'desktop' ) {
5354 this . page = page ;
55+ this . testPlatform = testPlatform ;
5456
5557 // main settings view
5658 this . settingsHeaderEN = this . page . getByRole ( 'main' ) . getByText ( 'Settings' , { exact : true } ) ;
@@ -67,6 +69,7 @@ export class SettingsPage {
6769 this . displayNameInput = this . page . locator ( '#booking-page-display-name' ) ;
6870 this . bookingPageURLInput = this . page . locator ( '#booking-page-url' ) ;
6971 this . copyLinkBtn = this . page . locator ( '#copy-booking-page-url-button' ) ;
72+ this . copyLinkToolTipText = this . page . locator ( '#tooltip-body' ) ;
7073 this . cancelServiceBtn = this . page . getByRole ( 'button' , { name : 'Cancel Service' } ) ;
7174 this . cancelServiceConfirmCancelBtn = this . page . getByRole ( 'button' , { name : 'Cancel' , exact : true } ) ;
7275 this . bookingPageSettingsBtn = this . page . getByRole ( 'button' , { name : 'Booking Page Settings' } ) ;
@@ -92,6 +95,16 @@ export class SettingsPage {
9295 this . addCaldavCloseModalBtn = this . page . getByRole ( 'img' , { name : 'Close' } ) ;
9396 this . addGoogleBtn = this . page . getByRole ( 'button' , { name : 'Add Google Calendar' } ) ;
9497 this . defaultCalendarConnectedCbox = this . page . locator ( 'div' ) . filter ( { hasText : / ^ D e f a u l t * / } ) . getByTestId ( 'checkbox-input' ) ;
98+ this . googleSignInHdr = this . page . getByText ( 'Sign in with Google' ) ;
99+ }
100+
101+ /**
102+ * Scroll the given element into view. The reason why we do this here is because playright doesn't yet supported this on ios.
103+ */
104+ async scrollIntoView ( targetElement : Locator , timeout : number = 10000 ) {
105+ if ( ! this . testPlatform . includes ( 'ios' ) ) {
106+ await targetElement . scrollIntoViewIfNeeded ( { timeout : timeout } ) ;
107+ }
95108 }
96109
97110 /**
@@ -100,7 +113,7 @@ export class SettingsPage {
100113 async gotoAccountSettings ( ) {
101114 await this . page . goto ( APPT_SETTINGS_PAGE ) ;
102115 await this . page . waitForTimeout ( TIMEOUT_5_SECONDS ) ;
103- await this . accountSettingsBtn . scrollIntoViewIfNeeded ( ) ;
116+ await this . scrollIntoView ( this . accountSettingsBtn ) ;
104117 await this . accountSettingsBtn . click ( ) ;
105118 await this . page . waitForTimeout ( TIMEOUT_1_SECOND ) ;
106119 }
@@ -111,7 +124,7 @@ export class SettingsPage {
111124 async gotoPreferencesSettings ( ) {
112125 await this . page . goto ( APPT_SETTINGS_PAGE ) ;
113126 await this . page . waitForTimeout ( TIMEOUT_5_SECONDS ) ;
114- await this . preferencesBtn . scrollIntoViewIfNeeded ( { timeout : TIMEOUT_30_SECONDS } ) ;
127+ await this . scrollIntoView ( this . preferencesBtn , TIMEOUT_30_SECONDS ) ;
115128 await this . preferencesBtn . click ( ) ;
116129 await this . page . waitForTimeout ( TIMEOUT_1_SECOND ) ;
117130 }
@@ -122,7 +135,7 @@ export class SettingsPage {
122135 async gotoConnectedAppSettings ( ) {
123136 await this . page . goto ( APPT_SETTINGS_PAGE ) ;
124137 await this . page . waitForTimeout ( TIMEOUT_5_SECONDS ) ;
125- await this . connectedAppsBtn . scrollIntoViewIfNeeded ( ) ;
138+ await this . scrollIntoView ( this . connectedAppsBtn ) ;
126139 await this . connectedAppsBtn . click ( ) ;
127140 await this . page . waitForTimeout ( TIMEOUT_1_SECOND ) ;
128141 }
@@ -132,31 +145,32 @@ export class SettingsPage {
132145 */
133146 async changeDefaultTimezoneSetting ( timezone : string ) {
134147 await this . defaultTimeZoneSelect . waitFor ( { timeout : TIMEOUT_30_SECONDS } ) ;
135- await this . defaultTimeZoneSelect . scrollIntoViewIfNeeded ( ) ;
148+ await this . scrollIntoView ( this . defaultTimeZoneSelect ) ;
136149 await this . page . waitForTimeout ( TIMEOUT_1_SECOND ) ;
137150 await this . defaultTimeZoneSelect . selectOption ( timezone , { timeout : TIMEOUT_30_SECONDS } ) ;
138151 await this . page . waitForTimeout ( TIMEOUT_1_SECOND ) ;
139- await this . saveBtnEN . scrollIntoViewIfNeeded ( ) ;
152+ await this . scrollIntoView ( this . saveBtnEN ) ;
140153 await this . saveBtnEN . click ( ) ;
141154 await this . page . waitForTimeout ( TIMEOUT_1_SECOND ) ;
142155 await expect ( this . savedSuccessfullyTextEN ) . toBeVisible ( ) ;
156+ await this . page . waitForTimeout ( TIMEOUT_2_SECONDS ) ;
143157 }
144158
145159 /**
146160 * Change the language setting
147161 */
148162 async changeLanguageSetting ( currentLanguage : string , newLanguage : string ) {
149- await this . languageSelect . scrollIntoViewIfNeeded ( ) ;
163+ await this . scrollIntoView ( this . languageSelect ) ;
150164 await this . page . waitForTimeout ( TIMEOUT_1_SECOND ) ;
151165 await this . languageSelect . selectOption ( newLanguage , { timeout : TIMEOUT_30_SECONDS } ) ;
152166 await this . page . waitForTimeout ( TIMEOUT_1_SECOND ) ;
153167 if ( currentLanguage == APPT_LANGUAGE_SETTING_EN ) {
154- await this . saveBtnEN . scrollIntoViewIfNeeded ( ) ;
168+ await this . scrollIntoView ( this . saveBtnEN ) ;
155169 await this . saveBtnEN . click ( ) ;
156170 await this . page . waitForTimeout ( TIMEOUT_1_SECOND ) ;
157171 await expect ( this . savedSuccessfullyTextDE ) . toBeVisible ( ) ;
158172 } else {
159- await this . saveBtnDE . scrollIntoViewIfNeeded ( ) ;
173+ await this . scrollIntoView ( this . saveBtnDE ) ;
160174 await this . saveBtnDE . click ( ) ;
161175 await this . page . waitForTimeout ( TIMEOUT_1_SECOND ) ;
162176 await expect ( this . savedSuccessfullyTextEN ) . toBeVisible ( ) ;
@@ -169,10 +183,11 @@ export class SettingsPage {
169183 */
170184 async changeThemeSetting ( theme : string ) {
171185 await this . themeSelect . waitFor ( { timeout : TIMEOUT_30_SECONDS } ) ;
172- await this . themeSelect . scrollIntoViewIfNeeded ( ) ;
186+ await this . scrollIntoView ( this . themeSelect ) ;
173187 await this . themeSelect . selectOption ( theme ) ;
174188 await this . page . waitForTimeout ( TIMEOUT_2_SECONDS ) ;
175189 await this . saveBtnEN . click ( ) ;
190+ await this . page . waitForTimeout ( TIMEOUT_2_SECONDS ) ;
176191 await expect ( this . savedSuccessfullyTextEN ) . toBeVisible ( { timeout : TIMEOUT_30_SECONDS } ) ;
177192 // wait for theme to take affect, can take time especially on browserstack
178193 await this . page . waitForTimeout ( TIMEOUT_5_SECONDS ) ;
@@ -191,15 +206,15 @@ export class SettingsPage {
191206 * Change the start of week setting
192207 */
193208 async changeStartOfWeekSetting ( startOfWeek : string ) {
194- await this . startOfWeekMondayBtn
209+ await this . scrollIntoView ( this . startOfWeekMondayBtn ) ;
195210 await this . page . waitForTimeout ( TIMEOUT_1_SECOND ) ;
196211 if ( startOfWeek == 'M' ) {
197212 await this . startOfWeekMondayBtn . click ( { timeout : TIMEOUT_30_SECONDS } ) ;
198213 } else {
199214 await this . startOfWeekSundayBtn . click ( { timeout : TIMEOUT_30_SECONDS } ) ;
200215 }
201216 await this . page . waitForTimeout ( TIMEOUT_1_SECOND ) ;
202- await this . saveBtnEN . scrollIntoViewIfNeeded ( ) ;
217+ await this . scrollIntoView ( this . saveBtnEN ) ;
203218 await this . saveBtnEN . click ( ) ;
204219 await this . page . waitForTimeout ( TIMEOUT_1_SECOND ) ;
205220 await expect ( this . savedSuccessfullyTextEN ) . toBeVisible ( ) ;
0 commit comments