Browse Source

test(playwright): add CRUD test

pull/7650/head
Pranav C 10 months ago
parent
commit
54a99bdf2f
  1. 23
      tests/playwright/pages/Account/Authentication.ts

23
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({ await this.waitForResponse({
uiAction: () => this.get().locator(`.nc-${provider}-${title}-enable .nc-switch`).click(), uiAction: () => this.get().locator(`.nc-${provider}-${title}-enable .nc-switch`).click(),
httpMethodsToMatch: ['PATCH'], httpMethodsToMatch: ['PATCH'],
@ -159,4 +159,25 @@ export class AccountAuthenticationPage extends BasePage {
requestUrlPathToMatch: '/api/v2/sso-client', 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 }) {}
} }

Loading…
Cancel
Save