@bigbinary/neeto-playwright-commons 3.3.1 → 3.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -2795,15 +2795,18 @@ declare class GooglePage extends IntegrationBase {
2795
2795
  private handleNotVerifiedPage;
2796
2796
  /**
2797
2797
  *
2798
- * Revokes permissions for the Microsoft integration by navigating to Microsoft's
2798
+ * Revokes permissions for the Microsoft integration by navigating to Microsoft's my apps page and revoking the application's consent. This method handles the complete flow of disconnecting the app from Microsoft's side by opening the app context menu, navigating to "Manage your application", and clicking "Revoke consent".
2799
2799
  *
2800
- * my apps page and removing the application connection. This method handles the
2800
+ * appName (optional): The name of the application to revoke permissions for.
2801
2801
  *
2802
- * complete flow of disconnecting the app from Microsoft's side.
2802
+ * Defaults to "NeetoForm - Staging".
2803
2803
  *
2804
2804
  * @example
2805
2805
  *
2806
2806
  * await microsoftPage.revokePermissions();
2807
+ *
2808
+ * // With a custom app name
2809
+ * await microsoftPage.revokePermissions("MyApp - Production");
2807
2810
  * @endexample
2808
2811
  */
2809
2812
  revokePermissions: () => Promise<void>;
@@ -2890,18 +2893,21 @@ declare class MicrosoftPage extends IntegrationBase {
2890
2893
  private staySignedIn;
2891
2894
  /**
2892
2895
  *
2893
- * Revokes permissions for the Microsoft integration by navigating to Microsoft's
2896
+ * Revokes permissions for the Microsoft integration by navigating to Microsoft's my apps page and revoking the application's consent. This method handles the complete flow of disconnecting the app from Microsoft's side by opening the app context menu, navigating to "Manage your application", and clicking "Revoke consent".
2894
2897
  *
2895
- * my apps page and removing the application connection. This method handles the
2898
+ * appName (optional): The name of the application to revoke permissions for.
2896
2899
  *
2897
- * complete flow of disconnecting the app from Microsoft's side.
2900
+ * Defaults to "NeetoForm - Staging".
2898
2901
  *
2899
2902
  * @example
2900
2903
  *
2901
2904
  * await microsoftPage.revokePermissions();
2905
+ *
2906
+ * // With a custom app name
2907
+ * await microsoftPage.revokePermissions("MyApp - Production");
2902
2908
  * @endexample
2903
2909
  */
2904
- revokePermissions: () => Promise<void>;
2910
+ revokePermissions: (appName?: string) => Promise<void>;
2905
2911
  }
2906
2912
  type AsyncNoArgsFunction = () => Promise<void>;
2907
2913
  type RedirectUrl = string | RegExp | ((url: URL) => boolean);
@@ -6020,6 +6026,10 @@ declare const MICROSOFT_LOGIN_TEXTS: {
6020
6026
  permissionsRequested: string;
6021
6027
  yes: string;
6022
6028
  remove: string;
6029
+ manageYourApplication: string;
6030
+ revokeConsent: string;
6031
+ useVerificationCode: string;
6032
+ successfullyRevokedConsent: string;
6023
6033
  };
6024
6034
  /**
6025
6035
  *
@@ -8128,7 +8138,7 @@ declare const MICROSOFT_LOGIN_SELECTORS: {
8128
8138
  signInProfileIcon: string;
8129
8139
  emailInput: string;
8130
8140
  placeholder: string;
8131
- dropdownMenu: string;
8141
+ dropdownMenu: (appName: string) => string;
8132
8142
  };
8133
8143
  /**
8134
8144
  *
package/index.js CHANGED
@@ -1893,7 +1893,7 @@ const MICROSOFT_LOGIN_SELECTORS = {
1893
1893
  signInProfileIcon: "#mectrl_headerPicture",
1894
1894
  emailInput: '[type="email"]',
1895
1895
  placeholder: ".placeholderInnerContainer",
1896
- dropdownMenu: "button[aria-label='NeetoForm - Stagingapp context menu']",
1896
+ dropdownMenu: (appName) => `button[aria-label='${appName}app']`,
1897
1897
  };
1898
1898
 
1899
1899
  const mimeTypeMap = {
@@ -2407,6 +2407,10 @@ const MICROSOFT_LOGIN_TEXTS = {
2407
2407
  permissionsRequested: "Permissions requested",
2408
2408
  yes: "Yes",
2409
2409
  remove: "Remove",
2410
+ manageYourApplication: "Manage your application",
2411
+ revokeConsent: "Revoke consent",
2412
+ useVerificationCode: "Use a verification code",
2413
+ successfullyRevokedConsent: "Successfully revoked consent",
2410
2414
  };
2411
2415
  const GOOGLE_LOGIN_TEXTS = {
2412
2416
  googleAccount: "Google Account:",
@@ -119693,6 +119697,11 @@ class MicrosoftPage extends IntegrationBase {
119693
119697
  await this.page
119694
119698
  .getByRole("button", { name: MICROSOFT_LOGIN_TEXTS.signIn })
119695
119699
  .click();
119700
+ await this.page
119701
+ .getByRole("button", {
119702
+ name: MICROSOFT_LOGIN_TEXTS.useVerificationCode,
119703
+ })
119704
+ .click();
119696
119705
  await this.enterTotpCode();
119697
119706
  await this.staySignedIn();
119698
119707
  }, ["microsoft.com", "live.com", "microsoftonline.com"]);
@@ -119721,15 +119730,20 @@ class MicrosoftPage extends IntegrationBase {
119721
119730
  await expect(acceptBtn).toBeHidden({ timeout: 10_000 });
119722
119731
  await this.page.waitForLoadState("load", { timeout: 50_000 });
119723
119732
  };
119724
- revokePermissions = async () => {
119733
+ revokePermissions = async (appName = "NeetoForm - Staging") => {
119725
119734
  await this.page.goto(THIRD_PARTY_ROUTES.microsoft.myApps);
119726
119735
  await this.page.waitForLoadState("load", { timeout: 25_000 });
119727
- const dropdown = this.page.locator(MICROSOFT_LOGIN_SELECTORS.dropdownMenu);
119736
+ const dropdown = this.page.locator(MICROSOFT_LOGIN_SELECTORS.dropdownMenu(appName));
119728
119737
  await dropdown.click();
119729
119738
  await this.page
119730
- .getByRole("menuitem", { name: MICROSOFT_LOGIN_TEXTS.remove })
119739
+ .getByRole("menuitem", {
119740
+ name: MICROSOFT_LOGIN_TEXTS.manageYourApplication,
119741
+ })
119742
+ .click();
119743
+ await this.page
119744
+ .getByRole("button", { name: MICROSOFT_LOGIN_TEXTS.revokeConsent })
119731
119745
  .click();
119732
- await expect(dropdown).toBeHidden({ timeout: 10_000 });
119746
+ await expect(this.page.getByText(MICROSOFT_LOGIN_TEXTS.successfullyRevokedConsent)).toBeVisible({ timeout: 10_000 });
119733
119747
  await this.page.waitForLoadState("load", { timeout: 25_000 });
119734
119748
  };
119735
119749
  }