@bigbinary/neeto-playwright-commons 1.1.0 → 1.1.2

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
@@ -1,6 +1,101 @@
1
1
  import * as _playwright_test from '@playwright/test';
2
- import { Page } from '@playwright/test';
3
- import CustomCommands from '@utils/commands';
2
+ import { Page, APIRequestContext, Response, APIResponse, Fixtures, PlaywrightWorkerArgs, PlaywrightWorkerOptions, PlaywrightTestArgs, PlaywrightTestOptions } from '@playwright/test';
3
+
4
+ interface InterceptMultipleResponsesParams {
5
+ responseUrl: string;
6
+ times: number;
7
+ baseUrl: string;
8
+ }
9
+ type GenericCallback = (...params: any[]) => Promise<unknown> | unknown;
10
+ type InterceptMultipleResponses = (params: Partial<InterceptMultipleResponsesParams>) => Promise<Response[]>;
11
+ interface ExecuteRecursivelyParams {
12
+ callback: GenericCallback;
13
+ condition: GenericCallback;
14
+ timeout: number;
15
+ }
16
+ type ExecuteRecursively = (params: ExecuteRecursivelyParams) => Promise<void>;
17
+ interface VerifySuccessToastParams {
18
+ message: string;
19
+ closeAfterVerification: boolean;
20
+ }
21
+ type VerifySuccessToast = (params: VerifySuccessToastParams) => Promise<void>;
22
+ declare const HTTP_METHODS: readonly ["get", "post", "put", "delete", "GET", "POST", "PUT", "DELETE"];
23
+ type BasicTypesInterface = Record<string, number | string | boolean>;
24
+ interface ApiRequestProps {
25
+ url: string;
26
+ headers?: BasicTypesInterface;
27
+ data?: Record<string, unknown>;
28
+ method?: typeof HTTP_METHODS[number];
29
+ params?: BasicTypesInterface;
30
+ }
31
+ type ApiRequest = (props: ApiRequestProps & Record<string, unknown>) => Promise<APIResponse | undefined>;
32
+ interface FieldValue {
33
+ field: string;
34
+ value: string;
35
+ }
36
+ type VerifyFieldValue = (values: FieldValue | FieldValue[]) => Promise<void> | Promise<void[]>;
37
+ declare class CustomCommands {
38
+ page: Page;
39
+ responses: string[];
40
+ request: APIRequestContext;
41
+ constructor(page: Page, request: APIRequestContext);
42
+ interceptMultipleResponses: InterceptMultipleResponses;
43
+ private recursiveMethod;
44
+ executeRecursively: ExecuteRecursively;
45
+ verifySuccessToast: VerifySuccessToast;
46
+ reloadAndWait: (requestCount: number) => Promise<void>;
47
+ apiRequest: ApiRequest;
48
+ verifyFieldValue: VerifyFieldValue;
49
+ }
50
+
51
+ interface CustomFixture {
52
+ neetoPlaywrightUtilities: CustomCommands;
53
+ page: Page;
54
+ }
55
+ type Commands = Fixtures<CustomFixture, PlaywrightWorkerArgs & PlaywrightWorkerOptions, PlaywrightTestArgs & PlaywrightTestOptions, PlaywrightWorkerArgs & PlaywrightWorkerOptions>;
56
+ declare const commands: Commands;
57
+
58
+ declare const stagingData: {
59
+ firstName: string;
60
+ lastName: string;
61
+ otp: number;
62
+ domain: string;
63
+ currentUserName: string;
64
+ businessName: string;
65
+ subdomainName: string;
66
+ email: string;
67
+ };
68
+
69
+ declare const i18n: {
70
+ options: {
71
+ debug: boolean;
72
+ fallbackLng: string;
73
+ resources: {
74
+ en: {
75
+ translation: Record<string, unknown>;
76
+ };
77
+ };
78
+ };
79
+ cache: boolean;
80
+ auto: boolean;
81
+ };
82
+
83
+ interface CreateOrganizationProps {
84
+ email: string;
85
+ businessName: string;
86
+ subdomainName: string;
87
+ firstName: string;
88
+ lastName: string;
89
+ appName: string;
90
+ }
91
+ declare class OrganizationPage {
92
+ page: Page;
93
+ neetoPlaywrightUtilities: CustomCommands;
94
+ constructor(page: Page, neetoPlaywrightUtilities: CustomCommands);
95
+ createOrganization: ({ email, businessName, subdomainName, firstName, lastName, appName, }: CreateOrganizationProps) => Promise<void>;
96
+ setupOrganization: () => Promise<void>;
97
+ updateSubdomainIfExists: (appName: string) => Promise<void>;
98
+ }
4
99
 
5
100
  declare const ENVIRONMENT: {
6
101
  development: string;
@@ -11,14 +106,20 @@ declare const IS_STAGING_ENV: boolean;
11
106
  declare const STORAGE_STATE = "./e2e/auth/user.json";
12
107
  declare const GLOBAL_TRANSLATIONS_PATTERN = "../node_modules/@bigbinary/**/translations/en.json";
13
108
  declare const PROJECT_TRANSLATIONS_PATH = "../app/javascript/src/translations/en.json";
109
+ declare const CREDENTIALS: {
110
+ email: string;
111
+ password: string;
112
+ };
14
113
 
15
- declare const BASE_URL = "/api/v1";
16
- declare const PROFILE_PATH = "/profile";
17
- declare const LOGIN_PATH = "/api/v1/login";
18
- declare const SIGNUP_PATH = "/api/v1/signups";
19
- declare const SUBDOMAIN_AVAILABILITY_PATH = "/api/v1/subdomain_availability";
20
- declare const COUNTRIES_PATH = "/api/v1/countries";
21
- declare const NEETO_APPS_PATH = "/api/v1/neeto_apps";
114
+ declare const ROUTES: {
115
+ neetoAuth: string;
116
+ profile: string;
117
+ login: string;
118
+ signup: string;
119
+ subdomainAvailability: string;
120
+ countries: string;
121
+ neetoAps: string;
122
+ };
22
123
 
23
124
  declare const COMMON_SELECTORS: {
24
125
  toastMessage: string;
@@ -34,16 +135,30 @@ declare const COMMON_SELECTORS: {
34
135
  };
35
136
 
36
137
  declare const SIGNUP_SELECTORS: {
37
- emailField: string;
38
- signupButton: string;
39
- otpInput: string;
40
- organizationField: string;
41
- subdomainField: string;
42
- submitButton: string;
43
- firstNameField: string;
44
- lastNameField: string;
138
+ emailTextField: string;
139
+ firstNameTextField: string;
140
+ lastNameTextField: string;
141
+ organizationNameTextField: string;
142
+ organizationSubmitButton: string;
143
+ otpTextBox: string;
45
144
  profileSubmitButton: string;
46
- subdomainInputError: string;
145
+ signupViaEmailButton: string;
146
+ submitButton: string;
147
+ subdomainNameTextField: string;
148
+ subdomainError: string;
149
+ tryFreeButton: string;
150
+ };
151
+
152
+ declare const LOGIN_SELECTORS: {
153
+ appleAuthenticationButton: string;
154
+ emailTextField: string;
155
+ googleAuthenticationButton: string;
156
+ githubAuthenticationButton: string;
157
+ loginViaEmailButton: string;
158
+ passwordTextField: string;
159
+ rememberMeCheckBox: string;
160
+ submitButton: string;
161
+ twitterAuthenticationButton: string;
47
162
  };
48
163
 
49
164
  declare const COMMON_TEXTS: {
@@ -72,32 +187,22 @@ declare const updateCredentials: UpdateCredentials;
72
187
  declare const clearCredentials: ClearCredentials;
73
188
  declare const readTranslations: () => Record<string, unknown>;
74
189
 
75
- declare const stagingData: {
76
- firstName: string;
77
- lastName: string;
78
- otp: number;
79
- domain: string;
80
- currentUserName: string;
81
- businessName: string;
82
- subdomainName: string;
83
- email: string;
84
- };
85
-
86
- interface Commands {
87
- neetoPlaywrightUtilities: CustomCommands;
190
+ interface LoginProps {
88
191
  page: Page;
192
+ neetoPlaywrightUtilities: CustomCommands;
89
193
  }
90
- declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions & Commands, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions>;
194
+ declare const loginWithoutSSO: ({ page, neetoPlaywrightUtilities, }: LoginProps) => Promise<void>;
195
+ declare const login: ({ page, neetoPlaywrightUtilities }: LoginProps) => Promise<false | void>;
91
196
 
92
197
  interface CurrentsOverrides {
93
198
  projectId: string;
94
199
  }
95
200
  interface Overrides {
96
- globalOverrides?: Record<string, any>;
97
- useOverrides?: Record<string, any>;
98
- projectOverrides?: Record<string, any>[];
201
+ globalOverrides?: Record<string, unknown>;
202
+ useOverrides?: Record<string, unknown>;
203
+ projectOverrides?: Record<string, unknown>[];
99
204
  currentsOverrides: CurrentsOverrides & Record<string, unknown>;
100
205
  }
101
- declare const definePlaywrightConfig: (overrides: Overrides) => any;
206
+ declare const definePlaywrightConfig: (overrides: Overrides) => _playwright_test.PlaywrightTestConfig<{}, {}>;
102
207
 
103
- export { BASE_URL, COMMON_SELECTORS, COMMON_TEXTS, COUNTRIES_PATH, type Commands, ENVIRONMENT, GLOBAL_TRANSLATIONS_PATTERN, IS_STAGING_ENV, LOGIN_PATH, NEETO_APPS_PATH, PROFILE_PATH, PROJECT_TRANSLATIONS_PATH, SIGNUP_PATH, SIGNUP_SELECTORS, STORAGE_STATE, SUBDOMAIN_AVAILABILITY_PATH, clearCredentials, definePlaywrightConfig, initializeCredentials, joinString, readFileSyncIfExists, readTranslations, stagingData, test, updateCredentials, writeDataToFile };
208
+ export { COMMON_SELECTORS, COMMON_TEXTS, CREDENTIALS, CustomCommands, type CustomFixture, ENVIRONMENT, GLOBAL_TRANSLATIONS_PATTERN, IS_STAGING_ENV, LOGIN_SELECTORS, OrganizationPage, PROJECT_TRANSLATIONS_PATH, ROUTES, SIGNUP_SELECTORS, STORAGE_STATE, clearCredentials, commands, definePlaywrightConfig, i18n, initializeCredentials, joinString, login, loginWithoutSSO, readFileSyncIfExists, readTranslations, stagingData, updateCredentials, writeDataToFile };