-
Notifications
You must be signed in to change notification settings - Fork 52
/
EditDuringInvitationTest.java
101 lines (78 loc) · 3.11 KB
/
EditDuringInvitationTest.java
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
package saros.stf.test.consistency;
import static org.junit.Assert.assertEquals;
import static saros.stf.client.tester.SarosTester.ALICE;
import static saros.stf.client.tester.SarosTester.BOB;
import static saros.stf.client.tester.SarosTester.CARL;
import static saros.stf.shared.Constants.ACCEPT;
import static saros.stf.shared.Constants.SHELL_SESSION_INVITATION;
import org.eclipse.swtbot.swt.finder.widgets.TimeoutException;
import org.junit.BeforeClass;
import org.junit.Test;
import saros.stf.annotation.TestLink;
import saros.stf.client.StfTestCase;
import saros.stf.client.util.EclipseTestThread;
import saros.stf.client.util.Util;
import saros.stf.test.stf.Constants;
@TestLink(id = "Saros-36_edit_during_invitation")
public class EditDuringInvitationTest extends StfTestCase {
@BeforeClass
public static void selectTesters() throws Exception {
select(ALICE, BOB, CARL);
}
@Test
public void testEditDuringInvitation() throws Exception {
Util.setUpSessionWithJavaProjectAndClass(
Constants.PROJECT1, Constants.PKG1, Constants.CLS1, ALICE, BOB);
BOB.superBot()
.views()
.packageExplorerView()
.waitUntilClassExists(Constants.PROJECT1, Constants.PKG1, Constants.CLS1);
ALICE.superBot().views().sarosView().selectContact(CARL.getJID()).addToSarosSession();
BOB.superBot()
.views()
.packageExplorerView()
.selectClass(Constants.PROJECT1, Constants.PKG1, Constants.CLS1)
.open();
CARL.remoteBot().shell(SHELL_SESSION_INVITATION).confirm(ACCEPT);
EclipseTestThread bobIsWriting =
createTestThread(
new EclipseTestThread.Runnable() {
@Override
public void run() throws Exception {
for (int i = 0; i < 20; i++)
BOB.remoteBot().editor(Constants.CLS1_SUFFIX).typeText("FooBar");
}
});
bobIsWriting.start();
CARL.superBot().confirmShellAddProjectWithNewProject(Constants.PROJECT1);
bobIsWriting.join();
bobIsWriting.verify();
String textByBob = BOB.remoteBot().editor(Constants.CLS1_SUFFIX).getText();
CARL.superBot()
.views()
.packageExplorerView()
.waitUntilClassExists(Constants.PROJECT1, Constants.PKG1, Constants.CLS1);
CARL.superBot()
.views()
.packageExplorerView()
.selectClass(Constants.PROJECT1, Constants.PKG1, Constants.CLS1)
.open();
ALICE
.superBot()
.views()
.packageExplorerView()
.selectClass(Constants.PROJECT1, Constants.PKG1, Constants.CLS1)
.open();
ALICE.remoteBot().editor(Constants.CLS1_SUFFIX).waitUntilIsTextSame(textByBob);
String textByAlice = ALICE.remoteBot().editor(Constants.CLS1_SUFFIX).getText();
// There are bugs here, CARL get completely different content as BOB.
try {
CARL.remoteBot().editor(Constants.CLS1_SUFFIX).waitUntilIsTextSame(textByBob);
} catch (TimeoutException e) {
//
}
String textByCarl = CARL.remoteBot().editor(Constants.CLS1_SUFFIX).getText();
assertEquals(textByBob, textByAlice);
assertEquals(textByBob, textByCarl);
}
}