@bigbinary/neeto-playwright-commons 1.16.7 → 1.17.0
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.cjs.js +207 -0
- package/index.cjs.js.map +1 -1
- package/index.d.ts +292 -1
- package/index.js +205 -2
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { TFunction } from 'i18next';
|
|
|
6
6
|
import { TOTP, Secret } from 'otpauth';
|
|
7
7
|
import { MemberApis } from 'apis/members';
|
|
8
8
|
import * as playwright_core from 'playwright-core';
|
|
9
|
+
import { RoleApis } from 'apis/roles';
|
|
9
10
|
import { TagsApi } from 'apis/tags';
|
|
10
11
|
import { Protocol } from 'playwright-core/types/protocol';
|
|
11
12
|
import * as ts_toolbelt_out_Function_Curry from 'ts-toolbelt/out/Function/Curry';
|
|
@@ -2763,6 +2764,96 @@ declare class OrganizationPage {
|
|
|
2763
2764
|
}) => Promise<void>;
|
|
2764
2765
|
changeCountry: (country: string) => Promise<void>;
|
|
2765
2766
|
}
|
|
2767
|
+
interface ApiKeyDetails {
|
|
2768
|
+
label: string;
|
|
2769
|
+
expiryDate?: string;
|
|
2770
|
+
}
|
|
2771
|
+
declare class ApiKeysPage {
|
|
2772
|
+
page: Page;
|
|
2773
|
+
neetoPlaywrightUtilities: CustomCommands;
|
|
2774
|
+
t: TFunction;
|
|
2775
|
+
constructor(page: Page, neetoPlaywrightUtilities: CustomCommands);
|
|
2776
|
+
/**
|
|
2777
|
+
*
|
|
2778
|
+
* Used to fill in the details for creating or editing an API key.
|
|
2779
|
+
*
|
|
2780
|
+
* label (required): The name for the API key.
|
|
2781
|
+
*
|
|
2782
|
+
* expiryDate (optional): The day of the month for the expiry date, formatted as "dd".
|
|
2783
|
+
*
|
|
2784
|
+
* @example
|
|
2785
|
+
*
|
|
2786
|
+
* await apiKeysPage.fillApiKeyDetails({
|
|
2787
|
+
* label: "API Key",
|
|
2788
|
+
* expiryDate: "15"
|
|
2789
|
+
* });
|
|
2790
|
+
* @endexample
|
|
2791
|
+
*/
|
|
2792
|
+
fillApiKeyDetails: ({
|
|
2793
|
+
label,
|
|
2794
|
+
expiryDate
|
|
2795
|
+
}: ApiKeyDetails) => Promise<void>;
|
|
2796
|
+
/**
|
|
2797
|
+
*
|
|
2798
|
+
* Used to verify the values in the API keys table.
|
|
2799
|
+
*
|
|
2800
|
+
* targetRow (required): The locator of the row where the API key should be verified.
|
|
2801
|
+
*
|
|
2802
|
+
* label (required): The name of the API key.
|
|
2803
|
+
*
|
|
2804
|
+
* date (required): The creation date of the API key, formatted as "MMM dd, yyyy".
|
|
2805
|
+
*
|
|
2806
|
+
* @example
|
|
2807
|
+
*
|
|
2808
|
+
* await apiKeysPage.verifyApiKey({
|
|
2809
|
+
* targetRow: page.getByRole("row"),
|
|
2810
|
+
* label: "API Key",
|
|
2811
|
+
* date: "Mar 11, 2025"
|
|
2812
|
+
* });
|
|
2813
|
+
* @endexample
|
|
2814
|
+
*/
|
|
2815
|
+
verifyApiKey: ({
|
|
2816
|
+
targetRow,
|
|
2817
|
+
label,
|
|
2818
|
+
date
|
|
2819
|
+
}: {
|
|
2820
|
+
targetRow: Locator;
|
|
2821
|
+
label: string;
|
|
2822
|
+
date: string;
|
|
2823
|
+
}) => Promise<[void, void, void, void]>;
|
|
2824
|
+
/**
|
|
2825
|
+
*
|
|
2826
|
+
* Used to edit an existing API key.
|
|
2827
|
+
*
|
|
2828
|
+
* label (required): The new name for the API key.
|
|
2829
|
+
*
|
|
2830
|
+
* expiryDate (optional): The day of the month for the expiry date, formatted as "dd".
|
|
2831
|
+
*
|
|
2832
|
+
* @example
|
|
2833
|
+
*
|
|
2834
|
+
* await apiKeysPage.editApiKey({
|
|
2835
|
+
* label: "new API Key",
|
|
2836
|
+
* expiryDate: "20"
|
|
2837
|
+
* });
|
|
2838
|
+
* @endexample
|
|
2839
|
+
*/
|
|
2840
|
+
editApiKey: ({
|
|
2841
|
+
label,
|
|
2842
|
+
expiryDate
|
|
2843
|
+
}: ApiKeyDetails) => Promise<void>;
|
|
2844
|
+
/**
|
|
2845
|
+
*
|
|
2846
|
+
* Used to delete an existing API key.
|
|
2847
|
+
*
|
|
2848
|
+
* targetRow (required): The locator of the row containing the API key to delete.
|
|
2849
|
+
*
|
|
2850
|
+
* @example
|
|
2851
|
+
*
|
|
2852
|
+
* await apiKeysPage.deleteApiKey(targetRow);
|
|
2853
|
+
* @endexample
|
|
2854
|
+
*/
|
|
2855
|
+
deleteApiKey: (targetRow: Locator) => Promise<void>;
|
|
2856
|
+
}
|
|
2766
2857
|
interface VerifyAuditLogProps {
|
|
2767
2858
|
targetRow: Locator;
|
|
2768
2859
|
action: string;
|
|
@@ -2848,6 +2939,198 @@ declare class AuditLogsPage {
|
|
|
2848
2939
|
roleName
|
|
2849
2940
|
}: VerifyDataInPaneProps) => Promise<void>;
|
|
2850
2941
|
}
|
|
2942
|
+
interface RoleDetails {
|
|
2943
|
+
roleName: string;
|
|
2944
|
+
permissions: string[];
|
|
2945
|
+
}
|
|
2946
|
+
interface VerifyAdminPanelCardProps {
|
|
2947
|
+
cardLocator: Locator;
|
|
2948
|
+
title: string;
|
|
2949
|
+
description: string;
|
|
2950
|
+
}
|
|
2951
|
+
declare class RolesPage {
|
|
2952
|
+
page: Page;
|
|
2953
|
+
neetoPlaywrightUtilities: CustomCommands;
|
|
2954
|
+
roleApis: RoleApis;
|
|
2955
|
+
t: TFunction;
|
|
2956
|
+
constructor(page: Page, neetoPlaywrightUtilities: CustomCommands);
|
|
2957
|
+
private getPermissionIds;
|
|
2958
|
+
private getRoleIdAndOrganizationId;
|
|
2959
|
+
/**
|
|
2960
|
+
*
|
|
2961
|
+
* Used to add a custom role via API request.
|
|
2962
|
+
*
|
|
2963
|
+
* roleName (required): The name of the role to add.
|
|
2964
|
+
*
|
|
2965
|
+
* targetPermissions (required): Array of permission names to assign.
|
|
2966
|
+
*
|
|
2967
|
+
* @example
|
|
2968
|
+
*
|
|
2969
|
+
* await rolesPage.addCustomRoleViaRequest("Custom Role", ["Manage themes", "View roles"]);
|
|
2970
|
+
* @endexample
|
|
2971
|
+
*/
|
|
2972
|
+
addCustomRoleViaRequest: (roleName: string, targetPermissions: string[]) => Promise<playwright_core.APIResponse | undefined>;
|
|
2973
|
+
/**
|
|
2974
|
+
*
|
|
2975
|
+
* Used to edit an existing role via API request.
|
|
2976
|
+
*
|
|
2977
|
+
* roleName (required): The name of the role to edit.
|
|
2978
|
+
*
|
|
2979
|
+
* targetPermissions (required): Array of permission names to update.
|
|
2980
|
+
*
|
|
2981
|
+
* @example
|
|
2982
|
+
*
|
|
2983
|
+
* await rolesPage.editRoleViaRequest("Custom Role", ["Manage roles"]);
|
|
2984
|
+
* @endexample
|
|
2985
|
+
*/
|
|
2986
|
+
editRoleViaRequest: (roleName: string, targetPermissions: string[]) => Promise<playwright_core.APIResponse | undefined>;
|
|
2987
|
+
/**
|
|
2988
|
+
*
|
|
2989
|
+
* Used to delete a role via API request.
|
|
2990
|
+
*
|
|
2991
|
+
* roleName (required): The name of the role to delete.
|
|
2992
|
+
*
|
|
2993
|
+
* @example
|
|
2994
|
+
*
|
|
2995
|
+
* await rolesPage.deleteRoleViaRequest("Custom Role");
|
|
2996
|
+
* @endexample
|
|
2997
|
+
*/
|
|
2998
|
+
deleteRoleViaRequest: (roleName: string) => Promise<playwright_core.APIResponse | undefined>;
|
|
2999
|
+
/**
|
|
3000
|
+
*
|
|
3001
|
+
* Used to add a role through the UI.
|
|
3002
|
+
*
|
|
3003
|
+
* roleName (required): The name of the role to add.
|
|
3004
|
+
*
|
|
3005
|
+
* permissions (required): Array of permission names to assign.
|
|
3006
|
+
*
|
|
3007
|
+
* @example
|
|
3008
|
+
*
|
|
3009
|
+
* await rolesPage.addRoleViaUI({
|
|
3010
|
+
* roleName: "Custom Role",
|
|
3011
|
+
* permissions: ["Manage themes", "View roles"]
|
|
3012
|
+
* });
|
|
3013
|
+
* @endexample
|
|
3014
|
+
*/
|
|
3015
|
+
addRoleViaUI: ({
|
|
3016
|
+
roleName,
|
|
3017
|
+
permissions
|
|
3018
|
+
}: RoleDetails) => Promise<void>;
|
|
3019
|
+
/**
|
|
3020
|
+
*
|
|
3021
|
+
* Used to edit an existing role through the UI.
|
|
3022
|
+
*
|
|
3023
|
+
* roleName (required): The name of the role to edit.
|
|
3024
|
+
*
|
|
3025
|
+
* permissions (required): Array of permission names to update.
|
|
3026
|
+
*
|
|
3027
|
+
* @example
|
|
3028
|
+
*
|
|
3029
|
+
* await rolesPage.editRoleViaUI({
|
|
3030
|
+
* roleName: "Custom Role",
|
|
3031
|
+
* permissions: ["Manage roles"]
|
|
3032
|
+
* });
|
|
3033
|
+
* @endexample
|
|
3034
|
+
*/
|
|
3035
|
+
editRoleViaUI: ({
|
|
3036
|
+
roleName,
|
|
3037
|
+
permissions
|
|
3038
|
+
}: RoleDetails) => Promise<void>;
|
|
3039
|
+
/**
|
|
3040
|
+
*
|
|
3041
|
+
* Used to select permissions.
|
|
3042
|
+
*
|
|
3043
|
+
* permissions (required): Array of permission names to select.
|
|
3044
|
+
*
|
|
3045
|
+
* @example
|
|
3046
|
+
*
|
|
3047
|
+
* await rolesPage.selectAndSubmitPermissions(["Manage themes", "View roles"]);
|
|
3048
|
+
* @endexample
|
|
3049
|
+
*/
|
|
3050
|
+
selectAndSubmitPermissions: (permissions: string[]) => Promise<void>;
|
|
3051
|
+
/**
|
|
3052
|
+
*
|
|
3053
|
+
* Used to verify the admin panel card details.
|
|
3054
|
+
*
|
|
3055
|
+
* cardLocator (required): The locator of the card to verify.
|
|
3056
|
+
*
|
|
3057
|
+
* title (required): The title of the card.
|
|
3058
|
+
*
|
|
3059
|
+
* description (required): The description of the card.
|
|
3060
|
+
*
|
|
3061
|
+
* @example
|
|
3062
|
+
*
|
|
3063
|
+
* await rolesPage.verifyAdminPanelCard({
|
|
3064
|
+
* description: "Roles card description",
|
|
3065
|
+
* title: "Roles card title",
|
|
3066
|
+
* cardLocator: page.getByTestId("roles-tab"),
|
|
3067
|
+
* });
|
|
3068
|
+
* @endexample
|
|
3069
|
+
*/
|
|
3070
|
+
verifyAdminPanelCard: ({
|
|
3071
|
+
cardLocator,
|
|
3072
|
+
title,
|
|
3073
|
+
description
|
|
3074
|
+
}: VerifyAdminPanelCardProps) => Promise<[void, void, void]>;
|
|
3075
|
+
/**
|
|
3076
|
+
*
|
|
3077
|
+
* Used to delete a role through the UI.
|
|
3078
|
+
*
|
|
3079
|
+
* roleName (required): The name of the role to delete.
|
|
3080
|
+
*
|
|
3081
|
+
* @example
|
|
3082
|
+
*
|
|
3083
|
+
* await rolesPage.deleteRoleViaUI("Custom Role");
|
|
3084
|
+
* @endexample
|
|
3085
|
+
*/
|
|
3086
|
+
deleteRoleViaUI: (roleName: string) => Promise<void>;
|
|
3087
|
+
/**
|
|
3088
|
+
*
|
|
3089
|
+
* Used to verify role permissions visibility.
|
|
3090
|
+
*
|
|
3091
|
+
* allPermissions (required): Object containing all possible permissions.
|
|
3092
|
+
*
|
|
3093
|
+
* rolePermissions (required): Array of permissions assigned to the role.
|
|
3094
|
+
*
|
|
3095
|
+
* @example
|
|
3096
|
+
*
|
|
3097
|
+
* await rolesPage.verifyPermissions({
|
|
3098
|
+
* allPermissions: { adminPanel: "settings-nav-tab", members: "members-nav-tab" },
|
|
3099
|
+
* rolePermissions: ["members-nav-tab"]
|
|
3100
|
+
* });
|
|
3101
|
+
* @endexample
|
|
3102
|
+
*/
|
|
3103
|
+
verifyPermissions: ({
|
|
3104
|
+
allPermissions,
|
|
3105
|
+
rolePermissions
|
|
3106
|
+
}: {
|
|
3107
|
+
allPermissions: object;
|
|
3108
|
+
rolePermissions: string[];
|
|
3109
|
+
}) => Promise<void[]>;
|
|
3110
|
+
/**
|
|
3111
|
+
*
|
|
3112
|
+
* Used to verify role-specific link access.
|
|
3113
|
+
*
|
|
3114
|
+
* roleAccessableLinks (optional): Array of links the role can access.
|
|
3115
|
+
*
|
|
3116
|
+
* adminAccessableLinks (required): Array of links an admin can access.
|
|
3117
|
+
*
|
|
3118
|
+
* @example
|
|
3119
|
+
*
|
|
3120
|
+
* await rolesPage.verifyRoleSpecificLinkAccess({
|
|
3121
|
+
* roleAccessableLinks: ["/themes","/seo","roles"],
|
|
3122
|
+
* adminAccessableLinks: ["/themes"]
|
|
3123
|
+
* });
|
|
3124
|
+
* @endexample
|
|
3125
|
+
*/
|
|
3126
|
+
verifyRoleSpecificLinkAccess: ({
|
|
3127
|
+
roleAccessableLinks,
|
|
3128
|
+
adminAccessableLinks
|
|
3129
|
+
}: {
|
|
3130
|
+
roleAccessableLinks?: string[];
|
|
3131
|
+
adminAccessableLinks: string[];
|
|
3132
|
+
}) => Promise<void>;
|
|
3133
|
+
}
|
|
2851
3134
|
declare class SidebarSection {
|
|
2852
3135
|
page: Page;
|
|
2853
3136
|
neetoPlaywrightUtilities: CustomCommands;
|
|
@@ -3178,6 +3461,14 @@ declare const SINGULAR: {
|
|
|
3178
3461
|
declare const PLURAL: {
|
|
3179
3462
|
count: number;
|
|
3180
3463
|
};
|
|
3464
|
+
declare const COLOR: {
|
|
3465
|
+
transparent: string;
|
|
3466
|
+
softBlue: string;
|
|
3467
|
+
};
|
|
3468
|
+
declare const DATE_TEXTS: {
|
|
3469
|
+
now: string;
|
|
3470
|
+
nextYear: string;
|
|
3471
|
+
};
|
|
3181
3472
|
declare const USER_AGENTS: {
|
|
3182
3473
|
windows: string;
|
|
3183
3474
|
mac: string;
|
|
@@ -5987,4 +6278,4 @@ interface Overrides {
|
|
|
5987
6278
|
* @endexample
|
|
5988
6279
|
*/
|
|
5989
6280
|
declare const definePlaywrightConfig: (overrides: Overrides) => _playwright_test.PlaywrightTestConfig<{}, {}>;
|
|
5990
|
-
export { API_ROUTES, AUDIT_LOGS_TEXTS, AuditLogsPage, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COMMON_SELECTORS, COMMON_TEXTS, CREDENTIALS, CustomCommands, type CustomFixture, DESCRIPTION_EDITOR_TEXTS, EMBED_SELECTORS, EMOJI_LABEL, ENGAGE_TEXTS, ENVIRONMENT, EXPANDED_FONT_SIZE, EditorPage, EmbedBase, FONT_SIZE_SELECTORS, GLOBAL_TRANSLATIONS_PATTERN, GOOGLE_CALENDAR_DATE_FORMAT, GOOGLE_LOGIN_SELECTORS, GOOGLE_LOGIN_TEXTS, GooglePage, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IS_STAGING_ENV, ImageUploader, IntegrationBase, KEYBOARD_SHORTCUTS_SELECTORS, LIST_MODIFIER_SELECTORS, LIST_MODIFIER_TAGS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MailerUtils, Member, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, NEETO_IMAGE_UPLOADER_SELECTORS, NEETO_ROUTES, NEETO_TEXT_MODIFIER_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PLURAL, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SELECT_COUNTRY, SIGNUP_SELECTORS, SINGULAR, SLACK_DATA_QA_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STORAGE_STATE, SidebarSection, SlackPage, TABLE_SELECTORS, TAB_SELECTORS, TAGS_SELECTORS, TEXT_MODIFIER_ROLES, TEXT_MODIFIER_SELECTORS, TEXT_MODIFIER_TAGS, THANK_YOU_SELECTORS, THIRD_PARTY_ROUTES, TOASTR_MESSAGES, TagsPage, TeamMembers, ThankYouPage, USER_AGENTS, WEBHOOK_SELECTORS, WebhooksPage, ZAPIER_LIMIT_EXHAUSTED_MESSAGE, ZAPIER_SELECTORS, ZAPIER_TEST_EMAIL, ZAPIER_WEB_TEXTS, ZapierPage, basicHTMLContent, clearCredentials, commands, cpuThrottlingUsingCDP, currencyUtils, decodeQRCodeFromFile, definePlaywrightConfig, executeWithThrottledResources, extractSubdomainFromError, filterUtils, generateRandomBypassEmail, generateStagingData, getByDataQA, getGlobalUserState, getImagePathAndName, getListCount, headerUtils, hexToRGB, hexToRGBA, hyphenize, i18nFixture, initializeCredentials, initializeTotp, isGithubIssueOpen, joinHyphenCase, joinString, login, loginWithoutSSO, networkConditions, networkThrottlingUsingCDP, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, simulateClickWithDelay, simulateTypingWithDelay, skipTest, squish, _default as stealthTest, tableUtils, toCamelCase, updateCredentials, writeDataToFile };
|
|
6281
|
+
export { API_ROUTES, AUDIT_LOGS_TEXTS, ApiKeysPage, AuditLogsPage, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COLOR, COMMON_SELECTORS, COMMON_TEXTS, CREDENTIALS, CustomCommands, type CustomFixture, DATE_TEXTS, DESCRIPTION_EDITOR_TEXTS, EMBED_SELECTORS, EMOJI_LABEL, ENGAGE_TEXTS, ENVIRONMENT, EXPANDED_FONT_SIZE, EditorPage, EmbedBase, FONT_SIZE_SELECTORS, GLOBAL_TRANSLATIONS_PATTERN, GOOGLE_CALENDAR_DATE_FORMAT, GOOGLE_LOGIN_SELECTORS, GOOGLE_LOGIN_TEXTS, GooglePage, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IS_STAGING_ENV, ImageUploader, IntegrationBase, KEYBOARD_SHORTCUTS_SELECTORS, LIST_MODIFIER_SELECTORS, LIST_MODIFIER_TAGS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MailerUtils, Member, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, NEETO_IMAGE_UPLOADER_SELECTORS, NEETO_ROUTES, NEETO_TEXT_MODIFIER_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PLURAL, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, RolesPage, SELECT_COUNTRY, SIGNUP_SELECTORS, SINGULAR, SLACK_DATA_QA_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STORAGE_STATE, SidebarSection, SlackPage, TABLE_SELECTORS, TAB_SELECTORS, TAGS_SELECTORS, TEXT_MODIFIER_ROLES, TEXT_MODIFIER_SELECTORS, TEXT_MODIFIER_TAGS, THANK_YOU_SELECTORS, THIRD_PARTY_ROUTES, TOASTR_MESSAGES, TagsPage, TeamMembers, ThankYouPage, USER_AGENTS, WEBHOOK_SELECTORS, WebhooksPage, ZAPIER_LIMIT_EXHAUSTED_MESSAGE, ZAPIER_SELECTORS, ZAPIER_TEST_EMAIL, ZAPIER_WEB_TEXTS, ZapierPage, basicHTMLContent, clearCredentials, commands, cpuThrottlingUsingCDP, currencyUtils, decodeQRCodeFromFile, definePlaywrightConfig, executeWithThrottledResources, extractSubdomainFromError, filterUtils, generateRandomBypassEmail, generateStagingData, getByDataQA, getGlobalUserState, getImagePathAndName, getListCount, headerUtils, hexToRGB, hexToRGBA, hyphenize, i18nFixture, initializeCredentials, initializeTotp, isGithubIssueOpen, joinHyphenCase, joinString, login, loginWithoutSSO, networkConditions, networkThrottlingUsingCDP, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, simulateClickWithDelay, simulateTypingWithDelay, skipTest, squish, _default as stealthTest, tableUtils, toCamelCase, updateCredentials, writeDataToFile };
|
package/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import fs__default, { readFileSync, writeFileSync as writeFileSync$1, unlinkSync
|
|
|
3
3
|
import * as Path from 'path';
|
|
4
4
|
import Path__default from 'path';
|
|
5
5
|
import test$1, { expect, test as test$2, chromium as chromium$1, defineConfig, devices } from '@playwright/test';
|
|
6
|
-
import { hyphenate, isNotPresent, isNotEmpty, humanize, keysToSnakeCase, dynamicArray, truncate, isPresent } from '@bigbinary/neeto-cist';
|
|
6
|
+
import { hyphenate, isNotPresent, isNotEmpty, humanize, keysToSnakeCase, dynamicArray, truncate, isPresent, findBy, isNotEqualDeep } from '@bigbinary/neeto-cist';
|
|
7
7
|
import { execSync } from 'child_process';
|
|
8
8
|
import { curry, not, isEmpty as isEmpty$1, pluck, mergeDeepLeft, isNotNil, isNil, mergeAll } from 'ramda';
|
|
9
9
|
import require$$0$1 from 'util';
|
|
@@ -115,6 +115,11 @@ const ZAPIER_TEST_EMAIL = (product) => `neeto-${product}-zapier-test@${process.e
|
|
|
115
115
|
// constants for translation
|
|
116
116
|
const SINGULAR = { count: 1 };
|
|
117
117
|
const PLURAL = { count: 2 };
|
|
118
|
+
const COLOR = {
|
|
119
|
+
transparent: "rgba(0, 0, 0, 0)",
|
|
120
|
+
softBlue: "rgb(230, 244, 255)",
|
|
121
|
+
};
|
|
122
|
+
const DATE_TEXTS = { now: "Now", nextYear: "next-year" };
|
|
118
123
|
|
|
119
124
|
/* eslint-disable playwright/no-skipped-test */
|
|
120
125
|
const execCommand = (command) => execSync(command)
|
|
@@ -25277,6 +25282,69 @@ class OrganizationPage {
|
|
|
25277
25282
|
}
|
|
25278
25283
|
}
|
|
25279
25284
|
|
|
25285
|
+
const ADMIN_PANEL_SELECTORS = {
|
|
25286
|
+
settingsItemHeading: "settings-item-heading",
|
|
25287
|
+
settingsItemDescription: "settings-item-description",
|
|
25288
|
+
expiryDateInput: "expiry-date-input",
|
|
25289
|
+
};
|
|
25290
|
+
|
|
25291
|
+
class ApiKeysPage {
|
|
25292
|
+
constructor(page, neetoPlaywrightUtilities) {
|
|
25293
|
+
this.fillApiKeyDetails = async ({ label, expiryDate }) => {
|
|
25294
|
+
await this.page
|
|
25295
|
+
.getByTestId(COMMON_SELECTORS.paneBody)
|
|
25296
|
+
.getByTestId(COMMON_SELECTORS.customInputField("label"))
|
|
25297
|
+
.fill(label);
|
|
25298
|
+
if (expiryDate) {
|
|
25299
|
+
await this.page
|
|
25300
|
+
.getByTestId(COMMON_SELECTORS.checkboxInput("never-expires"))
|
|
25301
|
+
.uncheck();
|
|
25302
|
+
await this.page
|
|
25303
|
+
.getByTestId(COMMON_SELECTORS.paneBody)
|
|
25304
|
+
.getByTestId(ADMIN_PANEL_SELECTORS.expiryDateInput)
|
|
25305
|
+
.click();
|
|
25306
|
+
//TODO: Use data-cy labels when this https://github.com/bigbinary/neeto-kb-playwright/issues/47 is resolved
|
|
25307
|
+
await this.page.getByLabel(DATE_TEXTS.nextYear, { exact: true }).click();
|
|
25308
|
+
await this.page.getByText(expiryDate, { exact: true }).click();
|
|
25309
|
+
}
|
|
25310
|
+
await this.page.getByTestId(COMMON_SELECTORS.saveChangesButton).click();
|
|
25311
|
+
await this.neetoPlaywrightUtilities.verifyToast();
|
|
25312
|
+
};
|
|
25313
|
+
this.verifyApiKey = ({ targetRow, label, date, }) => Promise.all([
|
|
25314
|
+
expect(targetRow.getByRole("cell", { name: label })).toBeVisible(),
|
|
25315
|
+
expect(targetRow.getByTestId(TAGS_SELECTORS.tagContainer)).toHaveText(this.t("common.active")),
|
|
25316
|
+
expect(targetRow.getByRole("cell", { name: date })).toBeVisible(),
|
|
25317
|
+
expect(targetRow.getByRole("cell", {
|
|
25318
|
+
name: this.t("neetoApiKeys.common.never"),
|
|
25319
|
+
})).toBeVisible(),
|
|
25320
|
+
]);
|
|
25321
|
+
this.editApiKey = async ({ label, expiryDate }) => {
|
|
25322
|
+
//TODO: Use data-cy labels when this https://github.com/bigbinary/neeto-kb-playwright/issues/46 is resolved
|
|
25323
|
+
await this.page
|
|
25324
|
+
.getByTestId(COMMON_SELECTORS.dropdownContainer)
|
|
25325
|
+
.getByRole("button", { name: this.t("common.edit") })
|
|
25326
|
+
.click();
|
|
25327
|
+
await this.fillApiKeyDetails({ label, expiryDate });
|
|
25328
|
+
};
|
|
25329
|
+
this.deleteApiKey = async (targetRow) => {
|
|
25330
|
+
await targetRow.getByTestId(COMMON_SELECTORS.dropdownIcon).click();
|
|
25331
|
+
//TODO: Use data-cy labels when this https://github.com/bigbinary/neeto-kb-playwright/issues/46 is resolved
|
|
25332
|
+
await this.page
|
|
25333
|
+
.getByTestId(COMMON_SELECTORS.dropdownContainer)
|
|
25334
|
+
.getByRole("button", { name: this.t("common.delete") })
|
|
25335
|
+
.click();
|
|
25336
|
+
await this.page
|
|
25337
|
+
.getByTestId(COMMON_SELECTORS.alertModalSubmitButton)
|
|
25338
|
+
.click();
|
|
25339
|
+
await this.neetoPlaywrightUtilities.verifyToast();
|
|
25340
|
+
await expect(targetRow).toBeHidden();
|
|
25341
|
+
};
|
|
25342
|
+
this.page = page;
|
|
25343
|
+
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
25344
|
+
this.t = getI18nInstance().t;
|
|
25345
|
+
}
|
|
25346
|
+
}
|
|
25347
|
+
|
|
25280
25348
|
class AuditLogsPage {
|
|
25281
25349
|
constructor(page, neetoPlaywrightUtilities) {
|
|
25282
25350
|
this.verifyAuditLog = async ({ targetRow, action, date, adminName, }) => {
|
|
@@ -25316,6 +25384,141 @@ class AuditLogsPage {
|
|
|
25316
25384
|
}
|
|
25317
25385
|
}
|
|
25318
25386
|
|
|
25387
|
+
class RoleApis {
|
|
25388
|
+
constructor(neetoPlaywrightUtilities) {
|
|
25389
|
+
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
25390
|
+
this.BASE_URL = "/team_members";
|
|
25391
|
+
this.ORGANIZATION_ROLES_URL = `${this.BASE_URL}/organization_roles`;
|
|
25392
|
+
this.fetch = (endpoint) => this.neetoPlaywrightUtilities.apiRequest({
|
|
25393
|
+
url: `${this.BASE_URL}/${endpoint}`,
|
|
25394
|
+
});
|
|
25395
|
+
this.addRole = (roleName, permissionIds) => this.neetoPlaywrightUtilities.apiRequest({
|
|
25396
|
+
url: this.ORGANIZATION_ROLES_URL,
|
|
25397
|
+
method: "post",
|
|
25398
|
+
data: {
|
|
25399
|
+
organization_role: {
|
|
25400
|
+
name: roleName,
|
|
25401
|
+
permission_ids: permissionIds,
|
|
25402
|
+
},
|
|
25403
|
+
},
|
|
25404
|
+
});
|
|
25405
|
+
this.editRole = (roleId, body) => this.neetoPlaywrightUtilities.apiRequest({
|
|
25406
|
+
url: `${this.ORGANIZATION_ROLES_URL}/${roleId}`,
|
|
25407
|
+
method: "patch",
|
|
25408
|
+
body: { organization_role: body },
|
|
25409
|
+
});
|
|
25410
|
+
this.deleteRole = (roleId, standardRoleId) => this.neetoPlaywrightUtilities.apiRequest({
|
|
25411
|
+
url: `${this.ORGANIZATION_ROLES_URL}/${roleId}`,
|
|
25412
|
+
method: "delete",
|
|
25413
|
+
body: { new_role_id: standardRoleId },
|
|
25414
|
+
});
|
|
25415
|
+
}
|
|
25416
|
+
}
|
|
25417
|
+
|
|
25418
|
+
class RolesPage {
|
|
25419
|
+
constructor(page, neetoPlaywrightUtilities) {
|
|
25420
|
+
this.getPermissionIds = async (targetPermissions) => {
|
|
25421
|
+
const { permissions } = await this.roleApis
|
|
25422
|
+
.fetch("permissions")
|
|
25423
|
+
.then(response => response === null || response === void 0 ? void 0 : response.json());
|
|
25424
|
+
const permissionObjects = targetPermissions.map(permission => findBy({ category: permission }, permissions));
|
|
25425
|
+
return pluck("id", permissionObjects);
|
|
25426
|
+
};
|
|
25427
|
+
this.getRoleIdAndOrganizationId = async (roleName) => {
|
|
25428
|
+
const roles = await this.roleApis
|
|
25429
|
+
.fetch("organization_roles")
|
|
25430
|
+
.then(response => response === null || response === void 0 ? void 0 : response.json());
|
|
25431
|
+
const { id: roleId, organization_id: organizationId } = findBy({ name: roleName }, roles.organization_roles);
|
|
25432
|
+
return { roleId, organizationId };
|
|
25433
|
+
};
|
|
25434
|
+
this.addCustomRoleViaRequest = async (roleName, targetPermissions) => {
|
|
25435
|
+
const permissionIds = await this.getPermissionIds(targetPermissions);
|
|
25436
|
+
return this.roleApis.addRole(roleName, permissionIds);
|
|
25437
|
+
};
|
|
25438
|
+
this.editRoleViaRequest = async (roleName, targetPermissions) => {
|
|
25439
|
+
const [permissionIds, { roleId, organizationId }] = await Promise.all([
|
|
25440
|
+
this.getPermissionIds(targetPermissions),
|
|
25441
|
+
this.getRoleIdAndOrganizationId(roleName),
|
|
25442
|
+
]);
|
|
25443
|
+
return this.roleApis.editRole(roleId, {
|
|
25444
|
+
id: roleId,
|
|
25445
|
+
kind: "custom",
|
|
25446
|
+
name: roleName,
|
|
25447
|
+
organization_id: organizationId,
|
|
25448
|
+
permission_ids: permissionIds,
|
|
25449
|
+
});
|
|
25450
|
+
};
|
|
25451
|
+
this.deleteRoleViaRequest = async (roleName) => {
|
|
25452
|
+
const [{ roleId }, { roleId: editorRoleId }] = await Promise.all([roleName, "Editor"].map(this.getRoleIdAndOrganizationId));
|
|
25453
|
+
return this.roleApis.deleteRole(roleId, editorRoleId);
|
|
25454
|
+
};
|
|
25455
|
+
this.addRoleViaUI = async ({ roleName, permissions }) => {
|
|
25456
|
+
await this.page.getByTestId(ROLES_SELECTORS.newButton).click();
|
|
25457
|
+
await this.page.getByTestId(ROLES_SELECTORS.nameTextField).fill(roleName);
|
|
25458
|
+
await this.selectAndSubmitPermissions(permissions);
|
|
25459
|
+
};
|
|
25460
|
+
this.editRoleViaUI = async ({ roleName, permissions }) => {
|
|
25461
|
+
await this.page
|
|
25462
|
+
.getByTestId(ROLES_SELECTORS.tableHeaderRoleName)
|
|
25463
|
+
.filter({ hasText: roleName })
|
|
25464
|
+
.getByTestId(ROLES_SELECTORS.dropDownIcon)
|
|
25465
|
+
.click();
|
|
25466
|
+
await this.page.getByTestId(ROLES_SELECTORS.editRoleButton).click();
|
|
25467
|
+
await this.selectAndSubmitPermissions(permissions);
|
|
25468
|
+
};
|
|
25469
|
+
this.selectAndSubmitPermissions = async (permissions) => {
|
|
25470
|
+
for (const permission of permissions) {
|
|
25471
|
+
await this.page
|
|
25472
|
+
.getByTestId(MEMBER_SELECTORS.checkboxLabel(permission))
|
|
25473
|
+
.check();
|
|
25474
|
+
}
|
|
25475
|
+
await this.page.getByTestId(ROLES_SELECTORS.proceedButton).click();
|
|
25476
|
+
await this.neetoPlaywrightUtilities.verifyToast();
|
|
25477
|
+
};
|
|
25478
|
+
this.verifyAdminPanelCard = ({ cardLocator, title, description, }) => Promise.all([
|
|
25479
|
+
expect(cardLocator.getByTestId(ADMIN_PANEL_SELECTORS.settingsItemHeading)).toHaveText(title),
|
|
25480
|
+
expect(cardLocator.getByTestId(ADMIN_PANEL_SELECTORS.settingsItemDescription)).toHaveText(description),
|
|
25481
|
+
expect(this.page.getByTestId(COMMON_SELECTORS.sidebarSubLink(title))).toHaveCSS("background-color", COLOR.transparent),
|
|
25482
|
+
]);
|
|
25483
|
+
this.deleteRoleViaUI = async (roleName) => {
|
|
25484
|
+
await this.page
|
|
25485
|
+
.getByTestId(ROLES_SELECTORS.tableHeaderRoleName)
|
|
25486
|
+
.filter({ hasText: roleName })
|
|
25487
|
+
.getByTestId(ROLES_SELECTORS.dropDownIcon)
|
|
25488
|
+
.click();
|
|
25489
|
+
await this.page.getByTestId(ROLES_SELECTORS.deleteRoleButton).click();
|
|
25490
|
+
await this.page
|
|
25491
|
+
.getByTestId(COMMON_SELECTORS.alertModalSubmitButton)
|
|
25492
|
+
.click();
|
|
25493
|
+
await this.neetoPlaywrightUtilities.verifyToast();
|
|
25494
|
+
};
|
|
25495
|
+
this.verifyPermissions = ({ allPermissions, rolePermissions, }) => Promise.all(Object.values(allPermissions).map(async (permission) => rolePermissions.includes(permission)
|
|
25496
|
+
? await expect(this.page.getByTestId(permission)).toBeVisible()
|
|
25497
|
+
: await expect(this.page.getByTestId(permission)).toBeHidden()));
|
|
25498
|
+
this.verifyRoleSpecificLinkAccess = async ({ roleAccessableLinks = [], adminAccessableLinks = [], }) => {
|
|
25499
|
+
if (isNotEqualDeep(roleAccessableLinks, adminAccessableLinks)) {
|
|
25500
|
+
for (const link of adminAccessableLinks) {
|
|
25501
|
+
await this.page.goto(link);
|
|
25502
|
+
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
25503
|
+
await expect(this.page.locator(COMMON_SELECTORS.tableSpinner)).toBeHidden({
|
|
25504
|
+
timeout: 15000,
|
|
25505
|
+
});
|
|
25506
|
+
const unauthorizedHeading = this.page.getByRole("heading", {
|
|
25507
|
+
name: this.t("neetoMolecules.errorPage.unauthorized"),
|
|
25508
|
+
});
|
|
25509
|
+
roleAccessableLinks.includes(link)
|
|
25510
|
+
? await expect(unauthorizedHeading).toBeHidden()
|
|
25511
|
+
: await expect(unauthorizedHeading).toBeVisible();
|
|
25512
|
+
}
|
|
25513
|
+
}
|
|
25514
|
+
};
|
|
25515
|
+
this.page = page;
|
|
25516
|
+
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
25517
|
+
this.roleApis = new RoleApis(neetoPlaywrightUtilities);
|
|
25518
|
+
this.t = getI18nInstance().t;
|
|
25519
|
+
}
|
|
25520
|
+
}
|
|
25521
|
+
|
|
25319
25522
|
class SidebarSection {
|
|
25320
25523
|
constructor(page, neetoPlaywrightUtilities) {
|
|
25321
25524
|
this.clickOnSubLink = (label) => this.page.getByTestId(COMMON_SELECTORS.sidebarSubLink(label)).click();
|
|
@@ -158633,5 +158836,5 @@ const definePlaywrightConfig = (overrides) => {
|
|
|
158633
158836
|
});
|
|
158634
158837
|
};
|
|
158635
158838
|
|
|
158636
|
-
export { API_ROUTES, AUDIT_LOGS_TEXTS, AuditLogsPage, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COMMON_SELECTORS, COMMON_TEXTS, CREDENTIALS, CustomCommands, DESCRIPTION_EDITOR_TEXTS, EMBED_SELECTORS, EMOJI_LABEL, ENGAGE_TEXTS, ENVIRONMENT, EXPANDED_FONT_SIZE, EditorPage, EmbedBase, FONT_SIZE_SELECTORS, GLOBAL_TRANSLATIONS_PATTERN, GOOGLE_CALENDAR_DATE_FORMAT, GOOGLE_LOGIN_SELECTORS, GOOGLE_LOGIN_TEXTS, GooglePage, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IS_STAGING_ENV, ImageUploader, IntegrationBase, KEYBOARD_SHORTCUTS_SELECTORS, LIST_MODIFIER_SELECTORS, LIST_MODIFIER_TAGS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MailerUtils, Member, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, NEETO_IMAGE_UPLOADER_SELECTORS, NEETO_ROUTES, NEETO_TEXT_MODIFIER_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PLURAL, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SELECT_COUNTRY, SIGNUP_SELECTORS, SINGULAR, SLACK_DATA_QA_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STORAGE_STATE, SidebarSection, SlackPage, TABLE_SELECTORS, TAB_SELECTORS, TAGS_SELECTORS, TEXT_MODIFIER_ROLES, TEXT_MODIFIER_SELECTORS, TEXT_MODIFIER_TAGS, THANK_YOU_SELECTORS, THIRD_PARTY_ROUTES, TOASTR_MESSAGES, TagsPage, TeamMembers, ThankYouPage, USER_AGENTS, WEBHOOK_SELECTORS, WebhooksPage, ZAPIER_LIMIT_EXHAUSTED_MESSAGE, ZAPIER_SELECTORS, ZAPIER_TEST_EMAIL, ZAPIER_WEB_TEXTS, ZapierPage, basicHTMLContent, clearCredentials, commands, cpuThrottlingUsingCDP, currencyUtils, decodeQRCodeFromFile, definePlaywrightConfig, executeWithThrottledResources, extractSubdomainFromError, filterUtils, generateRandomBypassEmail, generateStagingData, getByDataQA, getGlobalUserState, getImagePathAndName, getListCount, headerUtils, hexToRGB, hexToRGBA, hyphenize, i18nFixture, initializeCredentials, initializeTotp, isGithubIssueOpen, joinHyphenCase, joinString, login, loginWithoutSSO, networkConditions, networkThrottlingUsingCDP, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, simulateClickWithDelay, simulateTypingWithDelay, skipTest, squish, stealth as stealthTest, tableUtils, toCamelCase, updateCredentials, writeDataToFile };
|
|
158839
|
+
export { API_ROUTES, AUDIT_LOGS_TEXTS, ApiKeysPage, AuditLogsPage, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COLOR, COMMON_SELECTORS, COMMON_TEXTS, CREDENTIALS, CustomCommands, DATE_TEXTS, DESCRIPTION_EDITOR_TEXTS, EMBED_SELECTORS, EMOJI_LABEL, ENGAGE_TEXTS, ENVIRONMENT, EXPANDED_FONT_SIZE, EditorPage, EmbedBase, FONT_SIZE_SELECTORS, GLOBAL_TRANSLATIONS_PATTERN, GOOGLE_CALENDAR_DATE_FORMAT, GOOGLE_LOGIN_SELECTORS, GOOGLE_LOGIN_TEXTS, GooglePage, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IS_STAGING_ENV, ImageUploader, IntegrationBase, KEYBOARD_SHORTCUTS_SELECTORS, LIST_MODIFIER_SELECTORS, LIST_MODIFIER_TAGS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MailerUtils, Member, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, NEETO_IMAGE_UPLOADER_SELECTORS, NEETO_ROUTES, NEETO_TEXT_MODIFIER_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PLURAL, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, RolesPage, SELECT_COUNTRY, SIGNUP_SELECTORS, SINGULAR, SLACK_DATA_QA_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STORAGE_STATE, SidebarSection, SlackPage, TABLE_SELECTORS, TAB_SELECTORS, TAGS_SELECTORS, TEXT_MODIFIER_ROLES, TEXT_MODIFIER_SELECTORS, TEXT_MODIFIER_TAGS, THANK_YOU_SELECTORS, THIRD_PARTY_ROUTES, TOASTR_MESSAGES, TagsPage, TeamMembers, ThankYouPage, USER_AGENTS, WEBHOOK_SELECTORS, WebhooksPage, ZAPIER_LIMIT_EXHAUSTED_MESSAGE, ZAPIER_SELECTORS, ZAPIER_TEST_EMAIL, ZAPIER_WEB_TEXTS, ZapierPage, basicHTMLContent, clearCredentials, commands, cpuThrottlingUsingCDP, currencyUtils, decodeQRCodeFromFile, definePlaywrightConfig, executeWithThrottledResources, extractSubdomainFromError, filterUtils, generateRandomBypassEmail, generateStagingData, getByDataQA, getGlobalUserState, getImagePathAndName, getListCount, headerUtils, hexToRGB, hexToRGBA, hyphenize, i18nFixture, initializeCredentials, initializeTotp, isGithubIssueOpen, joinHyphenCase, joinString, login, loginWithoutSSO, networkConditions, networkThrottlingUsingCDP, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, simulateClickWithDelay, simulateTypingWithDelay, skipTest, squish, stealth as stealthTest, tableUtils, toCamelCase, updateCredentials, writeDataToFile };
|
|
158637
158840
|
//# sourceMappingURL=index.js.map
|