Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update the test by clicking the matplotlib download button #229

Merged
merged 10 commits into from
Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified test/asymmetricwell.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 14 additions & 4 deletions test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
import pytest
import time
import json
import os
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions
Expand All @@ -12,9 +14,12 @@

class TestTest01():
def setup_method(self, method):
self.driver = webdriver.Chrome()
options = Options()
cwd = os.getcwd()
options.add_experimental_option("prefs", {"download.default_directory": cwd})
self.driver = webdriver.Chrome(options=options)
self.vars = {}

def teardown_method(self, method):
self.driver.quit()

Expand All @@ -34,8 +39,13 @@ def test_asymmetricwell(self):
time.sleep(5)
self.driver.execute_script("window.scrollTo(0, 400)")
self.driver.find_element(By.CSS_SELECTOR, "label:nth-child(2) > input").click()
time.sleep(10)
self.driver.save_screenshot("asymmetricwell.png")
time.sleep(5)

download = self.driver.find_elements(By.XPATH, "//button[@title='Download plot']")[0]
actions = ActionChains(self.driver)
actions.move_to_element(download).click().perform()
time.sleep(3)
self.driver.save_screenshot("test.png")

test = TestTest01()
test.setup_method('Chrome')
Expand Down
2 changes: 1 addition & 1 deletion test/test_figures.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from PIL import Image, ImageChops, ImageStat

image1 = Image.open('asymmetricwell.png')
image1 = Image.open('Figure 1.png')
image2 = Image.open('test/asymmetricwell.png')

diff = ImageChops.difference(image1, image2)
Expand Down