github.com/loomnetwork/gamechain@v0.0.0-20200406110549-36c47eb97a92/e2e/test_findmatch.toml (about) 1 [[TestCases]] 2 RunCmd = "/bin/echo " 3 Delay = 10000 4 5 [[TestCases]] 6 RunCmd = "zb-cli contract_configuration -k {{index $.AccountPrivKeyPathList 0}} set_fiat_purchase_contract_version -v 3" 7 Condition = "contains" 8 Expected = ["success"] 9 10 ############ Create 1st match ############ 11 [[TestCases]] 12 RunCmd = "zb-cli create_account -k {{index $.AccountPrivKeyPathList 0}} -u player-1 -v v1" 13 Condition = "contains" 14 Expected = ["created successfully"] 15 16 [[TestCases]] 17 RunCmd = "zb-cli get_account -k {{index $.AccountPrivKeyPathList 0}} -u player-1" 18 All = true 19 Condition = "contains" 20 Expected = ["player-1"] 21 22 [[TestCases]] 23 RunCmd = "zb-cli create_account -k {{index $.AccountPrivKeyPathList 1}} -u player-2 -v v1" 24 Condition = "contains" 25 Expected = ["created successfully"] 26 27 [[TestCases]] 28 RunCmd = "zb-cli get_account -k {{index $.AccountPrivKeyPathList 1}} -u player-2" 29 All = true 30 Condition = "contains" 31 Expected = ["player-2"] 32 33 [[TestCases]] 34 RunCmd = "zb-cli register_player_pool -k {{index $.AccountPrivKeyPathList 0}} -u player-1 -d 1 -v v1" 35 Condition = "contains" 36 Expected = ["Registered player player-1 to pool"] 37 38 [[TestCases]] 39 RunCmd = "zb-cli register_player_pool -k {{index $.AccountPrivKeyPathList 1}} -u player-2 -d 1 -v v1" 40 Condition = "contains" 41 Expected = ["Registered player player-2 to pool"] 42 43 [[TestCases]] 44 RunCmd = "zb-cli find_match -k {{index $.AccountPrivKeyPathList 0}} -u player-1" 45 Condition = "contains" 46 Expected = ["MatchID: 1", "Status: Matching"] 47 48 [[TestCases]] 49 RunCmd = "zb-cli find_match -k {{index $.AccountPrivKeyPathList 1}} -u player-2" 50 Condition = "contains" 51 Expected = ["MatchID: 1", "Status: Matching"] 52 53 [[TestCases]] 54 RunCmd = "zb-cli accept_match -k {{index $.AccountPrivKeyPathList 0}} -u player-1 -m 1" 55 Condition = "contains" 56 Expected = ["MatchID: 1", "Status: Matching"] 57 58 [[TestCases]] 59 RunCmd = "zb-cli accept_match -k {{index $.AccountPrivKeyPathList 1}} -u player-2 -m 1" 60 Condition = "contains" 61 Expected = ["MatchID: 1", "Status: Started"] 62 63 [[TestCases]] 64 RunCmd = "checkapphash" 65 66 [[TestCases]] 67 RunCmd = "zb-cli get_match -k {{index $.AccountPrivKeyPathList 0}} -m 1" 68 Condition = "contains" 69 All = true 70 Expected = ["MatchID: 1", "Status: Started", "Player1: player-1", "Player2: player-2"] 71 72 [[TestCases]] 73 RunCmd = "zb-cli get_game_state -k {{index $.AccountPrivKeyPathList 0}} -m 1" 74 Condition = "contains" 75 All = true 76 Expected = ["Player1: player-1", "Player2: player-2"] 77 78 79 ############ Create 2nd match ############ 80 [[TestCases]] 81 RunCmd = "zb-cli create_account -k {{index $.AccountPrivKeyPathList 0}} -u loom-1 -v v1" 82 Condition = "contains" 83 Expected = ["created successfully"] 84 85 [[TestCases]] 86 RunCmd = "zb-cli get_account -k {{index $.AccountPrivKeyPathList 0}} -u loom-1" 87 All = true 88 Condition = "contains" 89 Expected = ["loom-1"] 90 91 [[TestCases]] 92 RunCmd = "zb-cli create_account -k {{index $.AccountPrivKeyPathList 1}} -u loom-2 -v v1" 93 Condition = "contains" 94 Expected = ["created successfully"] 95 96 [[TestCases]] 97 RunCmd = "zb-cli get_account -k {{index $.AccountPrivKeyPathList 1}} -u loom-2" 98 All = true 99 Condition = "contains" 100 Expected = ["loom-2"] 101 102 [[TestCases]] 103 RunCmd = "zb-cli register_player_pool -k {{index $.AccountPrivKeyPathList 0}} -u loom-1 -d 1 -v v1" 104 Condition = "contains" 105 Expected = ["Registered player loom-1 to pool"] 106 107 [[TestCases]] 108 RunCmd = "zb-cli register_player_pool -k {{index $.AccountPrivKeyPathList 1}} -u loom-2 -d 1 -v v1" 109 Condition = "contains" 110 Expected = ["Registered player loom-2 to pool"] 111 112 [[TestCases]] 113 RunCmd = "zb-cli find_match -k {{index $.AccountPrivKeyPathList 0}} -u loom-1" 114 Condition = "contains" 115 Expected = ["MatchID: 2", "Status: Matching"] 116 117 [[TestCases]] 118 RunCmd = "zb-cli find_match -k {{index $.AccountPrivKeyPathList 1}} -u loom-2" 119 Condition = "contains" 120 Expected = ["MatchID: 2", "Status: Matching"] 121 122 [[TestCases]] 123 RunCmd = "zb-cli accept_match -k {{index $.AccountPrivKeyPathList 0}} -u loom-1 -m 2" 124 Condition = "contains" 125 Expected = ["MatchID: 2", "Status: Matching"] 126 127 [[TestCases]] 128 RunCmd = "zb-cli accept_match -k {{index $.AccountPrivKeyPathList 1}} -u loom-2 -m 2" 129 Condition = "contains" 130 Expected = ["MatchID: 2", "Status: Started"] 131 132 [[TestCases]] 133 RunCmd = "checkapphash" 134 135 [[TestCases]] 136 RunCmd = "zb-cli get_match -k {{index $.AccountPrivKeyPathList 0}} -m 2" 137 Condition = "contains" 138 All = true 139 Expected = ["MatchID: 2", "Status: Started", "Player1: loom-1", "Player2: loom-2"] 140 141 [[TestCases]] 142 RunCmd = "zb-cli get_game_state -k {{index $.AccountPrivKeyPathList 0}} -m 2" 143 Condition = "contains" 144 All = true 145 Expected = ["Player1: loom-1", "Player2: loom-2"] 146 147 148 ############ Create 3nd match and cancel findmatch ############ 149 [[TestCases]] 150 RunCmd = "zb-cli create_account -k {{index $.AccountPrivKeyPathList 0}} -u loom-3 -v v1" 151 Condition = "contains" 152 Expected = ["created successfully"] 153 154 [[TestCases]] 155 RunCmd = "zb-cli get_account -k {{index $.AccountPrivKeyPathList 0}} -u loom-3" 156 All = true 157 Condition = "contains" 158 Expected = ["loom-3"] 159 160 [[TestCases]] 161 RunCmd = "zb-cli create_account -k {{index $.AccountPrivKeyPathList 1}} -u loom-4 -v v1" 162 Condition = "contains" 163 Expected = ["created successfully"] 164 165 [[TestCases]] 166 RunCmd = "zb-cli get_account -k {{index $.AccountPrivKeyPathList 1}} -u loom-4" 167 All = true 168 Condition = "contains" 169 Expected = ["loom-4"] 170 171 [[TestCases]] 172 RunCmd = "zb-cli register_player_pool -k {{index $.AccountPrivKeyPathList 0}} -u loom-3 -d 1 -v v1" 173 Condition = "contains" 174 Expected = ["Registered player loom-3 to pool"] 175 176 [[TestCases]] 177 RunCmd = "zb-cli register_player_pool -k {{index $.AccountPrivKeyPathList 1}} -u loom-4 -d 1 -v v1" 178 Condition = "contains" 179 Expected = ["Registered player loom-4 to pool"] 180 181 [[TestCases]] 182 RunCmd = "zb-cli find_match -k {{index $.AccountPrivKeyPathList 0}} -u loom-3" 183 Condition = "contains" 184 Expected = ["MatchID: 3", "Status: Matching"] 185 186 [[TestCases]] 187 RunCmd = "zb-cli find_match -k {{index $.AccountPrivKeyPathList 1}} -u loom-4" 188 Condition = "contains" 189 Expected = ["MatchID: 3", "Status: Matching"] 190 191 [[TestCases]] 192 RunCmd = "checkapphash" 193 194 [[TestCases]] 195 RunCmd = "zb-cli cancel_find_match -k {{index $.AccountPrivKeyPathList 0}} -u loom-3 -m 3" 196 Condition = "contains" 197 Expected = ["Cancel match 3 successfully"] 198 199 [[TestCases]] 200 RunCmd = "checkapphash" 201 202 [[TestCases]] 203 RunCmd = "zb-cli get_match -k {{index $.AccountPrivKeyPathList 0}} -m 3" 204 Condition = "contains" 205 All = true 206 Expected = ["Status: Canceled"] 207 208 [[TestCases]] 209 RunCmd = "zb-cli get_game_state -k {{index $.AccountPrivKeyPathList 0}} -m 3" 210 Condition = "contains" 211 All = true 212 Expected = ["not found"] 213 214 ############ Create 4th and5th match with tags ############ 215 [[TestCases]] 216 RunCmd = "zb-cli create_account -k {{index $.AccountPrivKeyPathList 5}} -u player-5 -v v1" 217 Condition = "contains" 218 Expected = ["created successfully"] 219 220 [[TestCases]] 221 RunCmd = "zb-cli create_account -k {{index $.AccountPrivKeyPathList 6}} -u player-6 -v v1" 222 Condition = "contains" 223 Expected = ["created successfully"] 224 225 [[TestCases]] 226 RunCmd = "zb-cli create_account -k {{index $.AccountPrivKeyPathList 7}} -u player-7 -v v1" 227 Condition = "contains" 228 Expected = ["created successfully"] 229 230 [[TestCases]] 231 RunCmd = "zb-cli create_account -k {{index $.AccountPrivKeyPathList 8}} -u player-8 -v v1" 232 Condition = "contains" 233 Expected = ["created successfully"] 234 235 [[TestCases]] 236 RunCmd = "zb-cli create_account -k {{index $.AccountPrivKeyPathList 9}} -u player-9 -v v1" 237 Condition = "contains" 238 Expected = ["created successfully"] 239 240 [[TestCases]] 241 RunCmd = "zb-cli create_account -k {{index $.AccountPrivKeyPathList 0}} -u player-0 -v v1" 242 Condition = "contains" 243 Expected = ["created successfully"] 244 245 [[TestCases]] 246 RunCmd = "zb-cli register_player_pool -k {{index $.AccountPrivKeyPathList 5}} -u player-5 -d 1 -v v1 -t tag1" 247 Condition = "contains" 248 Expected = ["Registered player player-5 to pool"] 249 250 [[TestCases]] 251 RunCmd = "zb-cli register_player_pool -k {{index $.AccountPrivKeyPathList 6}} -u player-6 -d 1 -v v1 -t tag1" 252 Condition = "contains" 253 Expected = ["Registered player player-6 to pool"] 254 255 [[TestCases]] 256 RunCmd = "zb-cli register_player_pool -k {{index $.AccountPrivKeyPathList 7}} -u player-7 -d 1 -v v1 -t tag2" 257 Condition = "contains" 258 Expected = ["Registered player player-7 to pool"] 259 260 [[TestCases]] 261 RunCmd = "zb-cli register_player_pool -k {{index $.AccountPrivKeyPathList 8}} -u player-8 -d 1 -v v1 -t tag2" 262 Condition = "contains" 263 Expected = ["Registered player player-8 to pool"] 264 265 [[TestCases]] 266 RunCmd = "zb-cli register_player_pool -k {{index $.AccountPrivKeyPathList 9}} -u player-9 -d 1 -v v1 -t tag3" 267 Condition = "contains" 268 Expected = ["Registered player player-9 to pool"] 269 270 [[TestCases]] 271 RunCmd = "zb-cli register_player_pool -k {{index $.AccountPrivKeyPathList 0}} -u player-0 -d 1 -v v1 -t tag3" 272 Condition = "contains" 273 Expected = ["Registered player player-0 to pool"] 274 275 # --- player-5, player-6 276 [[TestCases]] 277 RunCmd = "zb-cli find_match -k {{index $.AccountPrivKeyPathList 5}} -u player-5 -t tag1" 278 Condition = "contains" 279 Expected = ["MatchID: 4", "Status: Matching", "PlayerID: player-5", "PlayerID: player-6"] 280 281 [[TestCases]] 282 RunCmd = "zb-cli find_match -k {{index $.AccountPrivKeyPathList 6}} -u player-6 -t tag1" 283 Condition = "contains" 284 Expected = ["MatchID: 4", "Status: Matching", "PlayerID: player-5", "PlayerID: player-6"] 285 286 [[TestCases]] 287 RunCmd = "zb-cli accept_match -k {{index $.AccountPrivKeyPathList 5}} -u player-5 -m 4" 288 Condition = "contains" 289 Expected = ["MatchID: 4", "Status: Matching"] 290 291 [[TestCases]] 292 RunCmd = "zb-cli accept_match -k {{index $.AccountPrivKeyPathList 6}} -u player-6 -m 4" 293 Condition = "contains" 294 Expected = ["MatchID: 4", "Status: Started"] 295 296 # --- player-7, player-8 297 [[TestCases]] 298 RunCmd = "zb-cli find_match -k {{index $.AccountPrivKeyPathList 7}} -u player-7 -t tag2" 299 Condition = "contains" 300 Expected = ["MatchID: 5", "Status: Matching", "PlayerID: player-7", "PlayerID: player-8"] 301 302 [[TestCases]] 303 RunCmd = "zb-cli find_match -k {{index $.AccountPrivKeyPathList 8}} -u player-8 -t tag2" 304 Condition = "contains" 305 Expected = ["MatchID: 5", "Status: Matching", "PlayerID: player-7", "PlayerID: player-8"] 306 307 [[TestCases]] 308 RunCmd = "zb-cli accept_match -k {{index $.AccountPrivKeyPathList 7}} -u player-7 -m 5" 309 Condition = "contains" 310 Expected = ["MatchID: 5", "Status: Matching"] 311 312 [[TestCases]] 313 RunCmd = "zb-cli accept_match -k {{index $.AccountPrivKeyPathList 8}} -u player-8 -m 5" 314 Condition = "contains" 315 Expected = ["MatchID: 5", "Status: Started"] 316 317 # --- player-9, player-0 318 [[TestCases]] 319 RunCmd = "zb-cli find_match -k {{index $.AccountPrivKeyPathList 9}} -u player-9 -t tag3" 320 Condition = "contains" 321 Expected = ["MatchID: 6", "Status: Matching", "PlayerID: player-0", "PlayerID: player-9"] 322 323 [[TestCases]] 324 RunCmd = "zb-cli find_match -k {{index $.AccountPrivKeyPathList 0}} -u player-0 -t tag3" 325 Condition = "contains" 326 Expected = ["MatchID: 6", "Status: Matching", "PlayerID: player-0", "PlayerID: player-9"] 327 328 [[TestCases]] 329 RunCmd = "zb-cli accept_match -k {{index $.AccountPrivKeyPathList 9}} -u player-9 -m 6" 330 Condition = "contains" 331 Expected = ["MatchID: 6", "Status: Matching"] 332 333 [[TestCases]] 334 RunCmd = "zb-cli accept_match -k {{index $.AccountPrivKeyPathList 0}} -u player-0 -m 6" 335 Condition = "contains" 336 Expected = ["MatchID: 6", "Status: Started"] 337 338 [[TestCases]] 339 RunCmd = "checkapphash" 340