Commit e1f844be authored by Alec Wang's avatar Alec Wang

added time module and sleep methods to functional test

parent 26acbbaf
Pipeline #911 failed with stages
...@@ -367,3 +367,19 @@ JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't fin ...@@ -367,3 +367,19 @@ JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't fin
1583596509951 Marionette INFO Listening on port 65334 1583596509951 Marionette INFO Listening on port 65334
1583596510082 Marionette WARN TLS certificate errors will be ignored for this session 1583596510082 Marionette WARN TLS certificate errors will be ignored for this session
1583596510654 Marionette INFO Stopped listening on port 65334 1583596510654 Marionette INFO Stopped listening on port 65334
1583596668510 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-foreground" "-no-remote" "-profile" "C:\\Users\\alswa\\AppData\\Local\\Temp\\rust_mozprofilesp6941"
1583596668805 addons.webextension.doh-rollout@mozilla.org WARN Loading extension 'doh-rollout@mozilla.org': Reading manifest: Invalid extension permission: networkStatus
1583596669126 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: mozillaAddons
1583596669126 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: telemetry
1583596669126 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: resource://pdf.js/
1583596669126 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: about:reader*
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.
1583596670482 Marionette INFO Listening on port 65471
1583596670534 Marionette WARN TLS certificate errors will be ignored for this session
1583596675090 Marionette INFO Stopped listening on port 65471
###!!! [Child][RunMessage] Error: Channel closing: too late to send/recv, messages will be lost
###!!! [Child][MessageChannel::SendAndWait] Error: Channel error: cannot send/recv
from selenium import webdriver from selenium import webdriver
import unittest import unittest
import time
class NewVisitorTest(unittest.TestCase): class NewVisitorTest(unittest.TestCase):
...@@ -17,20 +18,22 @@ class NewVisitorTest(unittest.TestCase): ...@@ -17,20 +18,22 @@ class NewVisitorTest(unittest.TestCase):
# She notices the page title and header mention # She notices the page title and header mention
# 'The Will of the Wisps Wiki' # 'The Will of the Wisps Wiki'
self.assertIn('The Will of the Wisps Wiki', self.browser.title) self.assertIn('The Will of the Wisps Wiki', self.browser.title)
time.sleep(1)
# She sees a list containing three heroes with their corresponding # She sees a list containing three heroes with their corresponding
# names, health points, and damage # names, health points, and damage
self.assertIn('Cloud(HP:600,Damage:57)', self.browser.page_source) self.assertIn('Cloud(HP:600,Damage:57)', self.browser.page_source)
self.assertIn('Sunflowey(HP:650,Damage:43)', self.browser.page_source) self.assertIn('Sunflowey(HP:650,Damage:43)', self.browser.page_source)
self.assertIn('Jester(HP:660,Damage:64)', self.browser.page_source) self.assertIn('Jester(HP:660,Damage:64)', self.browser.page_source)
time.sleep(1)
# When she selects one of the heroes, she is sent to another page # When she selects one of the heroes, she is sent to another page
# containing more information about the hero (additional stats, lore, image). # containing more information about the hero (additional stats, lore, image).
self.browser.find_element_by_link_text( self.browser.find_element_by_link_text(
"Cloud(HP:600,Damage:57)").click() "Cloud(HP:600,Damage:57)").click()
time.sleep(1)
# She spots the page title and header mentions the name of the hero she selected. # She spots the page title and header mentions the name of the hero she selected.
self.assertIn('Cloud', self.browser.title) self.assertIn('Cloud', self.browser.title)
self.assertIn('Cloud', self.browser.page_source) self.assertIn('Cloud', self.browser.page_source)
time.sleep(1)
# While she is in a specific hero's page, she sees a button labeled "Back to Heroes List". # While she is in a specific hero's page, she sees a button labeled "Back to Heroes List".
# She clicks this and she is redirected back to the wiki's homepage. # She clicks this and she is redirected back to the wiki's homepage.
self.browser.find_element_by_css_selector("input[type=submit]").click() self.browser.find_element_by_css_selector("input[type=submit]").click()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment