@bigbinary/neeto-playwright-commons 1.1.0 → 1.1.1

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,9 +106,14 @@ 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
114
  declare const BASE_URL = "/api/v1";
16
115
  declare const PROFILE_PATH = "/profile";
116
+ declare const NEETO_AUTH_URL = "https://app.neetoauth.net";
17
117
  declare const LOGIN_PATH = "/api/v1/login";
18
118
  declare const SIGNUP_PATH = "/api/v1/signups";
19
119
  declare const SUBDOMAIN_AVAILABILITY_PATH = "/api/v1/subdomain_availability";
@@ -34,16 +134,30 @@ declare const COMMON_SELECTORS: {
34
134
  };
35
135
 
36
136
  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;
137
+ emailTextField: string;
138
+ firstNameTextField: string;
139
+ lastNameTextField: string;
140
+ organizationNameTextField: string;
141
+ organizationSubmitButton: string;
142
+ otpTextBox: string;
45
143
  profileSubmitButton: string;
46
- subdomainInputError: string;
144
+ signupViaEmailButton: string;
145
+ submitButton: string;
146
+ subdomainNameTextField: string;
147
+ subdomainError: string;
148
+ tryFreeButton: string;
149
+ };
150
+
151
+ declare const LOGIN_SELECTORS: {
152
+ appleAuthenticationButton: string;
153
+ emailTextField: string;
154
+ googleAuthenticationButton: string;
155
+ githubAuthenticationButton: string;
156
+ loginViaEmailButton: string;
157
+ passwordTextField: string;
158
+ rememberMeCheckBox: string;
159
+ submitButton: string;
160
+ twitterAuthenticationButton: string;
47
161
  };
48
162
 
49
163
  declare const COMMON_TEXTS: {
@@ -72,32 +186,22 @@ declare const updateCredentials: UpdateCredentials;
72
186
  declare const clearCredentials: ClearCredentials;
73
187
  declare const readTranslations: () => Record<string, unknown>;
74
188
 
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;
189
+ interface LoginProps {
88
190
  page: Page;
191
+ neetoPlaywrightUtilities: CustomCommands;
89
192
  }
90
- declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions & Commands, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions>;
193
+ declare const loginWithoutSSO: ({ page, neetoPlaywrightUtilities, }: LoginProps) => Promise<void>;
194
+ declare const login: ({ page, neetoPlaywrightUtilities }: LoginProps) => Promise<false | void>;
91
195
 
92
196
  interface CurrentsOverrides {
93
197
  projectId: string;
94
198
  }
95
199
  interface Overrides {
96
- globalOverrides?: Record<string, any>;
97
- useOverrides?: Record<string, any>;
98
- projectOverrides?: Record<string, any>[];
200
+ globalOverrides?: Record<string, unknown>;
201
+ useOverrides?: Record<string, unknown>;
202
+ projectOverrides?: Record<string, unknown>[];
99
203
  currentsOverrides: CurrentsOverrides & Record<string, unknown>;
100
204
  }
101
- declare const definePlaywrightConfig: (overrides: Overrides) => any;
205
+ declare const definePlaywrightConfig: (overrides: Overrides) => _playwright_test.PlaywrightTestConfig<{}, {}>;
102
206
 
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 };
207
+ export { BASE_URL, COMMON_SELECTORS, COMMON_TEXTS, COUNTRIES_PATH, CREDENTIALS, CustomCommands, type CustomFixture, ENVIRONMENT, GLOBAL_TRANSLATIONS_PATTERN, IS_STAGING_ENV, LOGIN_PATH, LOGIN_SELECTORS, NEETO_APPS_PATH, NEETO_AUTH_URL, OrganizationPage, PROFILE_PATH, PROJECT_TRANSLATIONS_PATH, SIGNUP_PATH, SIGNUP_SELECTORS, STORAGE_STATE, SUBDOMAIN_AVAILABILITY_PATH, clearCredentials, commands, definePlaywrightConfig, i18n, initializeCredentials, joinString, login, loginWithoutSSO, readFileSyncIfExists, readTranslations, stagingData, updateCredentials, writeDataToFile };