132 def test_case_3(self):
133 """Find and click login more button"""
134 thedriver=self.driver
135 finddriver=self.finddriver
138 thedriver.get(self.URL)
139 # thedriver.get(self.URL+'/login')
140 el = finddriver.find_element_by_partial_link_text('login')
143 assert "Login TiledViz" in thedriver.title
145 el = finddriver.find_element_by_id("username")
146 #"//form[@id='loginForm']/input[1]")
148 el.send_keys("ddurandi")
149 el.send_keys(Keys.RETURN)
150 #el.send_keys(" and some", Keys.ARROW_DOWN)
152 inputElement = finddriver.find_element_by_id("password")
154 inputElement.send_keys("OtherP@ssw/31d")
155 thedriver.save_screenshot('/tmp/tests/test-password1_screenshot.png')
157 # el = finddriver.find_element_by_xpath("//input[@name='password']")
159 # el.send_keys("OtherP@ssw/31d")
160 # thedriver.save_screenshot('/tmp/tests/test-password2_screenshot.png')
162 el = finddriver.find_element_by_id("submit")
164 #el = finddriver.find_element_by_partial_link_text('submit')
166 thedriver.save_screenshot('/tmp/tests/test-password3_screenshot.png')
167 assert "All projects/sessions TiledViz" in thedriver.title
168 except NoSuchElementException as ex:
169 self.fail(ex.msg+": \n"+thedriver.title)
262 def test_case_6(self):
263 """Login and create a new project/session/tileset."""
264 thedriver=self.driver
265 finddriver=self.finddriver
268 thedriver.get(self.URL)
270 LoginPage = finddriver.find_element_by_xpath("//button[@name='buttonLogin']")
272 assert "Login TiledViz" in thedriver.title
273 testform={"username":"ddurandi","password":"OtherP@ssw/31d"}
275 inputElement = finddriver.find_element_by_id(t)
277 inputElement.send_keys(testform[t])
279 remember_me=self.finddriver.find_element_by_id("remember_me")
282 create_project=self.finddriver.find_element_by_xpath("//input[@id='choice_project-0']")
283 create_project.click()
285 el = finddriver.find_element_by_id("submit")
288 assert "project" in thedriver.current_url
290 testform={"projectname":"TiledVizTEST","description":"Test for TiledViz with Wikimedia pictures"}
292 inputElement = finddriver.find_element_by_id(t)
294 inputElement.send_keys(testform[t])
296 thedriver.save_screenshot('/tmp/tests/test6-project_screenshot.png')
298 button=self.finddriver.find_element_by_xpath("//input[2][@id='submit']")
301 button=self.finddriver.find_element_by_xpath("//div/input[@id='sessionname']")
304 elem=self.finddriver.find_element_by_xpath("//input[@id='sessionname']")
306 elem.send_keys("TestSelenium")
307 elem.send_keys(Keys.TAB)
310 button=self.finddriver.find_element_by_xpath("//div[2]/input[@id='description']")
313 elem=self.finddriver.find_element_by_xpath("//input[@id='description']")
315 elem.send_keys("Test Session for TiledViz with pictures")
316 elem.send_keys(Keys.TAB)
318 elem=self.finddriver.find_element_by_xpath("//input[@id='users-0']")
320 elem.send_keys("ddurandi")
321 elem.send_keys(Keys.TAB)
323 elem=self.finddriver.find_element_by_xpath("//input[@id='users-1']")
325 elem.send_keys("mmartial")
326 elem.send_keys(Keys.TAB)
328 thedriver.save_screenshot('/tmp/tests/test6-session1_screenshot.png')
330 button=self.finddriver.find_element_by_xpath("//input[3][@id='Session_config']")
333 thedriver.save_screenshot('/tmp/tests/test6-session_config_screenshot.png')
335 # button=self.finddriver.find_element_by_xpath("//input[2][@id='editjson']")
338 # thedriver.save_screenshot('/tmp/tests/test6-jsoneditor_session1_screenshot.png')
340 # button=self.finddriver.find_element_by_xpath("//tr[4]/td[3]/table/tbody/tr/td/button")
343 # thedriver.save_screenshot('/tmp/tests/test6-jsoneditor_session2_screenshot.png')
344 # button=self.finddriver.find_element_by_xpath("//tr[8]/td[3]/table/tbody/tr/td/button")
347 # thedriver.save_screenshot('/tmp/tests/test6-jsoneditor_session3_screenshot.png')
348 # button=self.finddriver.find_element_by_xpath("//tr[9]/td[3]/table/tbody/tr/td[4]/div")
351 # thedriver.save_screenshot('/tmp/tests/test6-jsoneditor_session4_screenshot.png')
352 # button=self.finddriver.find_element_by_xpath("//tr[10]/td[3]/table/tbody/tr/td[4]/div")
355 # thedriver.save_screenshot('/tmp/tests/test6-jsoneditor_session5_screenshot.png')
356 # button=self.finddriver.find_element_by_xpath("//tr[4]/td[3]/table/tbody/tr/td/button")
359 # thedriver.save_screenshot('/tmp/tests/test6-jsoneditor_session6_screenshot.png')
361 # button=self.finddriver.find_element_by_xpath("//button[@id='submit']")
364 # thedriver.save_screenshot('/tmp/tests/test6-session2_screenshot.png')
366 button=self.finddriver.find_element_by_xpath("//input[3][@id='submit']")
369 thedriver.save_screenshot('/tmp/tests/test6-session3_screenshot.png')
371 button=self.finddriver.find_element_by_xpath("//input[4][@id='submit']")
374 elem=self.finddriver.find_element_by_xpath("//input[@id='name']")
376 elem.send_keys("WikimediaTest")
377 elem.send_keys(Keys.TAB)
379 elem=self.finddriver.find_element_by_xpath("//input[@id='dataset_path']")
381 elem.send_keys("upload.wikimedia.org")
382 elem.send_keys(Keys.TAB)
384 button=self.finddriver.find_element_by_xpath("//textarea[@id='json_tiles_text']")
387 elem=self.finddriver.find_element_by_xpath("//textarea[@id='json_tiles_text']")
390 # elem.send_keys("{\"nodes\": [ \n {...} ]}")
391 # elem.send_keys(Keys.ENTER)
392 jsfile="/usr/local/Selenium/TestSession.json"
395 except Exception as e :
396 print("Can't open file "+jsfile)
399 thedriver.execute_script("var textnode = document.getElementById('json_tiles_text'); "+
400 "textnode.value = arguments[0];",
403 thedriver.save_screenshot('/tmp/tests/test6-jsontext_screenshot.png')
405 # button=self.finddriver.find_element_by_xpath("//input[2][@id='editjson']")
408 # thedriver.save_screenshot('/tmp/tests/test6-jsoneditor_tileset1_screenshot.png')
410 # button=self.finddriver.find_element_by_xpath("//tr[2]/td[3]/table/tbody/tr/td/button")
413 # thedriver.save_screenshot('/tmp/tests/test6-jsoneditor_tileset2_screenshot.png')
415 # button=self.finddriver.find_element_by_xpath("//tr[5]/td[3]/table/tbody/tr/td/button")
418 # thedriver.save_screenshot('/tmp/tests/test6-jsoneditor_tileset3_screenshot.png')
420 # button=self.finddriver.find_element_by_xpath("//tr[7]/td[3]/table/tbody/tr/td[4]/div")
423 # thedriver.save_screenshot('/tmp/tests/test6-jsoneditor_tileset4_screenshot.png')
425 # button=self.finddriver.find_element_by_xpath("//button[@id='submit']")
428 # thedriver.save_screenshot('/tmp/tests/test6-jsoneditor_tileset5_screenshot.png')
430 button=self.finddriver.find_element_by_xpath("//input[3][@id='submit']")
433 thedriver.save_screenshot('/tmp/tests/test6-end_build_session_screenshot.png')
435 except NoSuchElementException as ex:
436 self.fail(ex.msg+": \n"+thedriver.title)