This repository was archived by the owner on Dec 29, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathBugReportingTests.cs
More file actions
240 lines (163 loc) · 5.42 KB
/
Copy pathBugReportingTests.cs
File metadata and controls
240 lines (163 loc) · 5.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
using E2E.Utils;
using Xunit;
using Instabug.Captain;
using NoSuchElementException = OpenQA.Selenium.NoSuchElementException;
using System.Drawing;
namespace E2E;
[Collection("E2E")]
public class BugReportingTests : CaptainTest
{
private void AssertOptionsPromptIsDisplayed()
{
var optionsPrompt = captain.FindById(
android: "instabug_main_prompt_container",
ios: "IBGReportBugPromptOptionAccessibilityIdentifier"
);
Assert.True(optionsPrompt.Displayed);
}
[Fact]
public void ReportABug()
{
captain.FindById(
android: "instabug_floating_button",
ios: "IBGFloatingButtonAccessibilityIdentifier"
).Tap();
captain.FindByText("Report a bug").Tap();
captain.FindInput(
android: "instabug_edit_text_email",
ios: "IBGBugInputViewEmailFieldAccessibilityIdentifier"
).Type("inst@bug.com");
captain.FindById(
android: "instabug_bugreporting_send",
ios: "IBGBugVCNextButtonAccessibilityIdentifier"
).Tap();
Assert.True(captain.FindByText("Thank you").Displayed);
}
[Fact]
public void FloatingButtonInvocationEvent()
{
Console.WriteLine("FloatingButtonInvocationEvent");
captain.FindById(
android: "instabug_floating_button",
ios: "IBGFloatingButtonAccessibilityIdentifier"
).Tap();
AssertOptionsPromptIsDisplayed();
}
[Fact]
public void ShakeInvocationEvent()
{
Console.WriteLine("ShakeInvocationEvent");
if (!Platform.IsIOS) return;
captain.FindByTextScroll("Shake").Tap();
captain.Shake();
AssertOptionsPromptIsDisplayed();
}
[Fact]
public void TwoFingersSwipeLeftInvocationEvent()
{
Console.WriteLine("TwoFingersSwipeLeftInvocationEvent");
captain.FindByTextScroll("Two Fingers Swipe Left").Tap();
Thread.Sleep(500);
// Do a two-finger swipe left
var width = captain.Window.Size.Width;
captain.TwoFingerSwipe(
new Point(width - 50, 300),
new Point(50, 300),
new Point(width - 50, 350),
new Point(50, 350)
);
AssertOptionsPromptIsDisplayed();
}
[Fact]
public void NoneInvocationEvent()
{
Console.WriteLine("NoneInvocationEvent");
captain.FindByTextScroll("None").Tap();
captain.WaitForAssertion(() =>
Assert.Throws<NoSuchElementException>(() =>
captain.FindById(
android: "instabug_floating_button",
ios: "IBGFloatingButtonAccessibilityIdentifier",
wait: false
)
)
);
}
[Fact]
public void ManualInvocation()
{
Console.WriteLine("ManualInvocation");
captain.FindByTextScroll("Invoke").Tap();
AssertOptionsPromptIsDisplayed();
}
[Fact]
public void MultipleScreenshotsInReproSteps()
{
Console.WriteLine("MultipleScreenshotsInReproSteps");
captain.FindByTextScroll("Enter screen name").Tap();
captain.Type("My Screen");
captain.HideKeyboard();
captain.HideKeyboard();
Thread.Sleep(500);
captain.FindByTextScroll("Report Screen Change")?.Tap();
Thread.Sleep(500);
captain.FindByTextScroll("Send Bug Report")?.Tap();
captain.FindById(
android: "instabug_text_view_repro_steps_disclaimer",
ios: "IBGBugVCReproStepsDisclaimerAccessibilityIdentifier"
).Tap();
var reproSteps = captain.FindManyById(
android: "ib_bug_repro_step_screenshot",
ios: "IBGReproStepsTableCellViewAccessibilityIdentifier"
);
Assert.Equal(2, reproSteps.Count);
}
[Fact(Skip = "The test is flaky on iOS so we're skipping it to unblock the v13.2.0 release")]
public void ChangeReportTypes()
{
Console.WriteLine("ChangeReportTypes");
captain.FindByTextScroll("Bug", exact: true).Tap();
if (Platform.IsAndroid)
{
captain.FindByTextScroll("Invoke").Tap();
// Shows bug reporting screen
Assert.True(captain.FindById("ib_bug_scroll_view").Displayed);
// Close bug reporting screen
captain.GoBack();
captain.FindByTextScroll("DISCARD").Tap();
Thread.Sleep(500);
}
captain.FindByTextScroll("Feedback").Tap();
captain.FindByTextScroll("Invoke").Tap();
// Shows both bug reporting and feature requests in prompt options
AssertOptionsPromptIsDisplayed();
Assert.True(captain.FindByText("Report a bug").Displayed);
Assert.True(captain.FindByText("Suggest an improvement").Displayed);
Assert.Throws<NoSuchElementException>(() => captain.FindByText("Ask a question", wait: false));
}
[Fact]
public void ChangeFloatingButtonEdge()
{
Console.WriteLine("ChangeFloatingButtonEdge");
captain.FindByTextScroll("Move Floating Button to Left",false,false)?.Tap();
captain.WaitForAssertion(() =>
{
var floatingButton = captain.FindById(
android: "instabug_floating_button",
ios: "IBGFloatingButtonAccessibilityIdentifier"
);
var screenWidth = captain.Window.Size.Width;
Assert.True(floatingButton.Location.X < screenWidth / 2);
});
}
[Fact]
public void OnDismissCallbackIsCalled()
{
captain.FindByTextScroll("Set On Dismiss Callback",false,false).Tap();
captain.FindByTextScroll("Invoke",false,false).Tap();
AssertOptionsPromptIsDisplayed();
captain.FindByTextScroll("Cancel").Tap();
var popUpText = captain.FindByText("onDismiss callback called with DismissType.cancel and ReportType.other");
Assert.True(popUpText.Displayed);
}
}