forked from mrlan/EnglishPal
				
			Merge branch 'Alpha-snapshot20230621' into Bug500-Badr
						commit
						a0728e26b1
					
				| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					Subproject commit 8cbc7c9a0ce543db48f80a743c4168ca847ca500
 | 
				
			||||||
| 
						 | 
					@ -255,6 +255,7 @@
 | 
				
			||||||
                    update(data['today_article']);
 | 
					                    update(data['today_article']);
 | 
				
			||||||
                    check_pre(data['visited_articles']);
 | 
					                    check_pre(data['visited_articles']);
 | 
				
			||||||
                    check_next(data['result_of_generate_article']);
 | 
					                    check_next(data['result_of_generate_article']);
 | 
				
			||||||
 | 
					                    toggleHighlighting();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }, complete: function (xhr, status) {
 | 
					            }, complete: function (xhr, status) {
 | 
				
			||||||
                $("#load_next_article").prop("disabled", false)
 | 
					                $("#load_next_article").prop("disabled", false)
 | 
				
			||||||
| 
						 | 
					@ -271,6 +272,7 @@
 | 
				
			||||||
                if (data['today_article']) {
 | 
					                if (data['today_article']) {
 | 
				
			||||||
                    update(data['today_article']);
 | 
					                    update(data['today_article']);
 | 
				
			||||||
                    check_pre(data['visited_articles']);
 | 
					                    check_pre(data['visited_articles']);
 | 
				
			||||||
 | 
					                    toggleHighlighting();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,5 +9,5 @@ def URL():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@pytest.fixture
 | 
					@pytest.fixture
 | 
				
			||||||
def driver():
 | 
					def driver():
 | 
				
			||||||
    my_driver = webdriver.Edge()  # uncomment this line if you wish to run the test on your laptop    
 | 
					    my_driver = webdriver.Chrome()
 | 
				
			||||||
    return my_driver
 | 
					    return my_driver
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,43 @@
 | 
				
			||||||
 | 
					import time
 | 
				
			||||||
 | 
					import pytest
 | 
				
			||||||
 | 
					import uuid
 | 
				
			||||||
 | 
					from selenium import webdriver
 | 
				
			||||||
 | 
					from selenium.webdriver import ActionChains
 | 
				
			||||||
 | 
					from selenium.webdriver.common.by import By
 | 
				
			||||||
 | 
					from selenium.webdriver.support.ui import WebDriverWait
 | 
				
			||||||
 | 
					from selenium.webdriver.support import expected_conditions as EC
 | 
				
			||||||
 | 
					from selenium.common.exceptions import UnexpectedAlertPresentException, NoAlertPresentException, NoSuchElementException, \
 | 
				
			||||||
 | 
					    TimeoutException
 | 
				
			||||||
 | 
					from conftest import URL
 | 
				
			||||||
 | 
					driver = webdriver.Chrome()
 | 
				
			||||||
 | 
					def test_bug555():
 | 
				
			||||||
 | 
					    try:
 | 
				
			||||||
 | 
					        driver.maximize_window()
 | 
				
			||||||
 | 
					        base_url = "http://127.0.0.1:5000"
 | 
				
			||||||
 | 
					        driver.get(base_url)
 | 
				
			||||||
 | 
					        article = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID, 'article')))
 | 
				
			||||||
 | 
					        perform_actions_on_article(driver, article)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        next_button = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID, 'load_next_article')))
 | 
				
			||||||
 | 
					        next_button.click()
 | 
				
			||||||
 | 
					        print("Clicked next article button.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        prev_button = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID, 'load_pre_article')))
 | 
				
			||||||
 | 
					        prev_button.click()
 | 
				
			||||||
 | 
					        print("Clicked previous article button.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    except (TimeoutException, NoSuchElementException) as e:
 | 
				
			||||||
 | 
					        print(f"An error occurred: {e}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    finally:
 | 
				
			||||||
 | 
					        driver.quit()
 | 
				
			||||||
 | 
					        print("Driver closed.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def perform_actions_on_article(driver, article):
 | 
				
			||||||
 | 
					    actions = ActionChains(driver)
 | 
				
			||||||
 | 
					    actions.move_to_element(article)
 | 
				
			||||||
 | 
					    actions.click_and_hold()
 | 
				
			||||||
 | 
					    actions.move_by_offset(450, 200)
 | 
				
			||||||
 | 
					    actions.release()
 | 
				
			||||||
 | 
					    actions.perform()
 | 
				
			||||||
 | 
					    print("Performed actions on article.")
 | 
				
			||||||
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 20 KiB  | 
		Loading…
	
		Reference in New Issue