playwright-ts-automationframework 1.0.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.
@@ -0,0 +1,224 @@
1
+ import { Actions } from './actions.core';
2
+ import { WebControl } from './webControl.core';
3
+ import { Page } from '@playwright/test';
4
+ /**
5
+ * All Verification methods required for test case verification.
6
+ * @author Ketan Pardeshi
7
+ * */
8
+ export declare class Assertion extends Actions {
9
+ constructor(page: Page);
10
+ /**
11
+ * Verify two objects are equals.
12
+ * If both objects are equal test case gets passed else fails.
13
+ *
14
+ * @param object1 First object.
15
+ * @param object2 Second object.
16
+ * Example:
17
+ *
18
+ * verifyIsEquals("Invalid username", "Invalid username");
19
+ */
20
+ verifyIsEquals(object1: any, object2: any): void;
21
+ /**
22
+ * Verify first value contains substring as second.
23
+ * If expected value is present in actual value then test case gets passsed else failed.
24
+ *
25
+ * @param expected First object which has .
26
+ * @param actual Second object.
27
+ * Example:
28
+ *
29
+ * verifyIsContains("Invalid username Test", "Invalid username");
30
+ */
31
+ verifyIsContains(actual: string, expected: string): void;
32
+ /**
33
+ * Verify element's displayed/not displayed status as per expected value
34
+ * If expected element's displayed status is as per expected then test case gets passsed else failed.
35
+ *
36
+ * @param control Control of which enable or disable status.
37
+ * @param expValue Expected value enabled as true or disabled as false.
38
+ * Example:
39
+ *
40
+ * loginBtn = new WebControl(this.page.locator('#login'), 'Login button');
41
+ *
42
+ * verifyIsEnabled(loginBtn, true);
43
+ */
44
+ verifyIsDisplayed(control: WebControl, expectedIsDisplayed?: boolean): Promise<void>;
45
+ /**
46
+ * Verify element is not displayed
47
+ * If expected element's displayed status is false the test case gets passed else failed.
48
+ *
49
+ * @param control Control for which not displayed status need to verify.
50
+ * @param isAlreadyHidden Is control already hidden or need to wait to get hidden.
51
+ * Example:
52
+ *
53
+ * loginBtn = new WebControl(this.page.locator('#login'), 'Login button');
54
+ *
55
+ * verifyIsNotDisplayed(loginBtn, true);
56
+ */
57
+ verifyIsNotDisplayed(control: WebControl, isAlreadyHidden?: boolean): Promise<void>;
58
+ /**
59
+ * Verify attribute value of the control
60
+ * If elements attribute value is as per expected value then test case gets passed else failed.
61
+ *
62
+ * @param control Control for which attribute value need to verify.
63
+ * @param attributeName Attribute name.
64
+ * @param attributeValue Expected attribute value
65
+
66
+ * Example:
67
+ *
68
+ * loginBtn = new WebControl(this.page.locator('#login'), 'Login button');
69
+ *
70
+ * verifyAttributeValue(loginBtn, "value", "Submit");
71
+ */
72
+ verifyAttributeValue(control: WebControl, attributeName: string, expectedAttributeValue: string): Promise<void>;
73
+ /**
74
+ * Verify element's enabled/disabled status as per expected value
75
+ * If expected element's enabled status is as per expected then test case gets passsed else failed.
76
+ *
77
+ * @param control Control of which enable or disable status.
78
+ * @param expValue Expected value enabled as true or disabled as false.
79
+ * Example:
80
+ *
81
+ * loginBtn = new WebControl(this.page.locator('#login'), 'Login button');
82
+ *
83
+ * verifyIsEnabled(loginBtn, true);
84
+ */
85
+ verifyIsEnabled(control: WebControl, expValue?: boolean): Promise<void>;
86
+ /**
87
+ * Verify element's text as per expected value
88
+ * If expected element's text is as per expected value then test case gets passsed else failed.
89
+ *
90
+ * @param control Control of which text need to verify.
91
+ * @param expectedText Expected value.
92
+ * Example:
93
+ *
94
+ * errorMsg = new WebControl(this.page.locator('#error'), 'Login Error message');
95
+ *
96
+ * verifyDisplayedText(loginBtn, "Invalid Username Test User");
97
+ */
98
+ verifyDisplayedText(control: WebControl, expectedText: string): Promise<void>;
99
+ /**
100
+ * Verify element's text contains partial expected value
101
+ * If expected element's text contains expected value then test case gets passsed else failed.
102
+ *
103
+ * @param control Control of which text need to verify.
104
+ * @param expectedText Expected partial value.
105
+ * Example:
106
+ *
107
+ * errorMsg = new WebControl(this.page.locator('#error'), 'Login Error message');
108
+ *
109
+ * verifyDisplayedTextContains(loginBtn, "Invalid Username");
110
+ */
111
+ verifyDisplayedTextContains(control: WebControl, expectedText: string): Promise<void>;
112
+ /**
113
+ * Verify element's text does not contains expected value
114
+ * If expected element's text does not contains expected value then test case gets passsed else failed.
115
+ *
116
+ * @param control Control of which text need to verify.
117
+ * @param expectedText Expected partial value.
118
+ * Example:
119
+ *
120
+ * errorMsg = new WebControl(this.page.locator('#error'), 'Login Error message');
121
+ *
122
+ * verifyDisplayedTextDoesNotContains(loginBtn, "Enter User");
123
+ */
124
+ verifyDisplayedTextDoesNotContains(control: WebControl, expectedText: string): Promise<void>;
125
+ /**
126
+ * Verify element's textbox is equal to expected value
127
+ * If expected element's textbox value to be expected value then test case gets passsed else failed.
128
+ *
129
+ * @param control Textbox control.
130
+ * @param expectedText Expected value.
131
+ * Example:
132
+ *
133
+ * usernameTxtbx = new WebControl(this.page.locator('#username'), 'Username textbox');
134
+ *
135
+ * verifyTextboxValue(usernameTxtbx, "Test@Adactin");
136
+ */
137
+ verifyTextboxValue(control: WebControl, expectedText: string): Promise<void>;
138
+ /**
139
+ * Verify element's checkbox/radio value is equal to expected value
140
+ * If expected element's checkbox/radio value to be expected value then test case gets passsed else failed.
141
+ *
142
+ * @param control Checkbox/radio control.
143
+ * @param expectedText Expected checkbox/radio value.
144
+ * Example:
145
+ *
146
+ * isMinor = new WebControl(this.page.locator('#isMinor'), 'Is Minor checkbox');
147
+ *
148
+ * verifyCheckboxValue(isMinor, true);
149
+ */
150
+ verifyCheckboxValue(control: WebControl, value: boolean): Promise<void>;
151
+ /**
152
+ * Verify element's attribute value contains expected value
153
+ * If element's attribute value contains expected value then test case gets passsed else failed.
154
+ *
155
+ * @param control Control of which attribute value need to verify.
156
+ * @param attributeName Attribute name
157
+ * @param expectedText Expected partial value.
158
+ *
159
+ * Example:
160
+ *
161
+ * loginBtn = new WebControl(this.page.locator('#login'), 'Login button');
162
+ *
163
+ * verifyAttributeValueContains(loginBtn, "value", "Submit");
164
+ */
165
+ verifyAttributeValueContains(locator: WebControl, attributeName: string, attributeValue: string): Promise<void>;
166
+ /**
167
+ * Verify element's tagname is equal to expected value
168
+ * If expected element's Tagname is equal to expected value then test case gets passsed else failed.
169
+ *
170
+ * @param control Checkbox/radio control.
171
+ * @param expectedText Expected checkbox/radio value.
172
+ * Example:
173
+ *
174
+ * isMinor = new WebControl(this.page.locator('#isMinor'), 'Is Minor checkbox');
175
+ *
176
+ * verifyTagName(isMinor, "a");
177
+ */
178
+ verifyTagName(control: WebControl, expectedTagName: string): Promise<void>;
179
+ verifyListContainsValue(control: WebControl, valueToVerify: string): Promise<void>;
180
+ verifyListContainsMultipleValues(control: WebControl, listOfValueToVerify: string[], waitTillElementIsDisplayed?: boolean): Promise<void>;
181
+ verifyListForMultipleValues(control: WebControl, listOfValueToVerify: string[], waitTillElementIsDisplayed?: boolean): Promise<void>;
182
+ /**
183
+ * Verify Alert text is equal to expected value
184
+ * If alert text is equal to expected value then test case gets passsed else failed.
185
+ *
186
+ * @param expectedText Expected alert text.
187
+ * Example:
188
+ *
189
+ * verifyAlertText("Password should be 8 digit.")
190
+ */
191
+ verifyAlertText(expectedText: string): Promise<void>;
192
+ /**
193
+ * Verify URL contains expected value
194
+ * If URL contains expected value then test case gets passsed else failed.
195
+ *
196
+ * @param expectedText Expected partial URL.
197
+ * Example:
198
+ *
199
+ * verifyURLContains("google.com");
200
+ */
201
+ verifyURLContains(subString: string): Promise<void>;
202
+ /**
203
+ * Verify count of elements which matched the control
204
+ * If count of elements is equal to expected value then test case will get passsed else failed.
205
+ *
206
+ * @param control Control element.
207
+ * @param expectedCount Expected count of elements matching criteria
208
+ * Example:
209
+ *
210
+ * checkboxes = new WebControl(this.page.locator("xpath=//a"), 'checkboxes');
211
+ * verifyCountOfElements(isMinor, 5);
212
+ */
213
+ verifyCountOfElements(control: WebControl, expectedCount: number): Promise<void>;
214
+ /**
215
+ * Verify title of web page contains expected value
216
+ * If title contains expected value then test case will get passsed else failed.
217
+ *
218
+ * @param expectedText Expected partial Title.
219
+ * Example:
220
+ *
221
+ * verifyPageTitleContains("Google");
222
+ */
223
+ verifyPageTitleContains(expectedText: string): Promise<void>;
224
+ }