-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchat_test.rb
25 lines (23 loc) · 1.05 KB
/
chat_test.rb
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
#! /usr/bin/ruby
# Basic script that opens 10 sessions to hastings.se and writes to the chat 25 times.
require 'watir-webdriver'
require 'headless'
module ChatTest
def chat_test browser, messageCount
browser.text_field(id: 'input-field-main').wait_until_present 100
(1..messageCount).each do
browser.text_field(id: 'input-field-main').set "Chatting whoho"
browser.text_field(id: 'input-field-main').send_keys :enter
end
chatName = (0...15).map { ('a'..'z').to_a[rand(26)] }.join
browser.text_field(id: 'input-field-main').set "joining " + chatName
browser.text_field(id: 'input-field-main').send_keys :enter
browser.text_field(id: 'input-field-main').set "/join " + chatName
browser.text_field(id: 'input-field-main').send_keys :enter
browser.text_field(id: 'input-field-' + chatName).wait_until_present 100
(1..messageCount).each do
browser.text_field(id: 'input-field-' + chatName).set "Chatting in " + chatName + "whoho"
browser.text_field(id: 'input-field-' + chatName).send_keys :enter
end
end
end