Answer the question
In order to leave comments, you need to log in
Wrote tests, now how to run them in docker?
Hello!
I wrote 2 small tests to check the login and the performance of links on the site: 1.py, 2.py
they are almost the same, here is one of them:
# -*- coding: utf-8 -*-
from selenium import webdriver
from pyvirtualdisplay import Display
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
import unittest, time, re
class LoginTest(unittest.TestCase):
def setUp(self):
self.display = Display(visible=0, size=(1280, 1024))
self.display.start()
self.driver = webdriver.Chrome(executable_path='/home/chingis/selenuim/chromedriver')
self.verificationErrors = []
self.accept_next_alert = True
def test_1(self):
links = ["http://127.0.0.1:8000/login", "http://127.0.0.1:8000/popular/", "http://127.0.0.1:8000/upcoming/", "http://127.0.0.1:8000"]
driver = self.driver
for link in links:
driver.get(link)
msg = "error with link" + link
self.assertTrue(driver.find_element_by_class_name("classname"), msg)
def tearDown(self):
self.driver.quit()
self.assertEqual([], self.verificationErrors)
if __name__ == "__main__":
unittest.main()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question