summaryrefslogtreecommitdiff
path: root/chatroom.test
blob: 89cf18aa491fac98828a7dddbb9013bf9ba01826 (plain)
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
test ChatroomSetup:
	# Local chatrooms

	spawn as p1
	with p1:
		send "create-identity Device1 Owner1"

		send "chatroom-create first"
		send "chatroom-create second"

		send "chatroom-list-local"
		expect /chatroom-list-item [a-z0-9#]+ first/
		expect /chatroom-list-item [a-z0-9#]+ second/
		local:
			expect /chatroom-list-(.*)/ capture done
			guard (done == "done")

	# Send chatrooms to new peers

	spawn as p2
	send "create-identity Device2 Owner2" to p2

	spawn as p3
	send "create-identity Device3 Owner3" to p3

	for p in [ p1, p2, p3 ]:
		with p:
			send "chatroom-watch-local"
			send "start-server"

	for p in [ p2, p3 ]:
		with p:
			expect /chatroom-watched-added [a-z0-9#]+ first/
			expect /chatroom-watched-added [a-z0-9#]+ second/

	with p2:
		send "chatroom-list-local"
		expect /chatroom-list-item [a-z0-9#]+ first/
		expect /chatroom-list-item [a-z0-9#]+ second/
		local:
			expect /chatroom-list-(.*)/ capture done
			guard (done == "done")

	# Create and sync additional chatrooms

	send "chatroom-create third" to p1
	send "chatroom-create fourth" to p2
	send "chatroom-create fifth" to p3
	for p in [ p1, p2, p3 ]:
		with p:
			expect /chatroom-watched-added [a-z0-9#]+ third/
			expect /chatroom-watched-added [a-z0-9#]+ fourth/
			expect /chatroom-watched-added [a-z0-9#]+ fifth/