diff --git a/tests/playwright/pages/Account/Authentication.ts b/tests/playwright/pages/Account/Authentication.ts index 13ff61bc4d..162254687e 100644 --- a/tests/playwright/pages/Account/Authentication.ts +++ b/tests/playwright/pages/Account/Authentication.ts @@ -44,7 +44,7 @@ export class AccountAuthenticationPage extends BasePage { }); } - async toggleProvider(provider: 'saml' | 'oidc', title: string) { + async toggleProvider(provider: 'saml' | 'oidc' | 'google', title: string) { await this.waitForResponse({ uiAction: () => this.get().locator(`.nc-${provider}-${title}-enable .nc-switch`).click(), httpMethodsToMatch: ['PATCH'], @@ -159,4 +159,25 @@ export class AccountAuthenticationPage extends BasePage { requestUrlPathToMatch: '/api/v2/sso-client', }); } + + async createGoogleProvider(p: { clientId: string; clientSecret: string }) { + await this.rootPage.locator(`.nc-google-more-option`).click(); + await this.rootPage.locator(`[data-test-id="nc-google-edit"]`).click(); + + const googleModal = this.accountPage.rootPage.locator('.nc-google-modal'); + // wait until redirect url is generated + await googleModal.locator('[data-test-id="nc-google-redirect-url"]:has-text("http://")').waitFor(); + + await googleModal.locator('[data-test-id="nc-google-client-id"]').fill(p.clientId); + + await googleModal.locator('[data-test-id="nc-google-client-secret"]').fill(p.clientSecret); + + await this.waitForResponse({ + uiAction: () => googleModal.locator('[data-test-id="nc-google-save-btn"]').click(), + httpMethodsToMatch: ['GET'], + requestUrlPathToMatch: '/api/v2/sso-client', + }); + } + + async verifyGoogleProviderCount(param: { count: number }) {} }