diff --git a/Makefile b/Makefile index 9715b73..5a87eae 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,10 @@ $(VENV): python -m venv .venv $(VENV)/python -m pip install --upgrade pip +# For python 3 on Mac, uncomment below code +# python3 -m venv .venv +# $(VENV)/python3 -m pip install --upgrade pip + $(VENV)/$(MARKER): $(VENVDEPS) | $(VENV) $(VENV)/pip install $(foreach path,$(REQUIREMENTS),-r $(path)) touch $(VENV)/$(MARKER) @@ -29,5 +33,11 @@ clean: serve: $(VENV)/python -m http.server 8000 +# For python 3 on Mac, uncomment below code +# $(VENV)/python3 -m http.server 8000 + test: install $(NPM)/percy exec -- $(VENV)/python tests/todo.py + +# For python 3 on Mac, uncomment below code +# $(NPM)/percy exec -- $(VENV)/python3 tests/todo.py \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 3f7c66d..a5ff456 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -selenium==3.* +selenium==4.* percy-selenium==1.* requests==2.* diff --git a/tests/todo.py b/tests/todo.py index 8f080ad..668463a 100644 --- a/tests/todo.py +++ b/tests/todo.py @@ -7,7 +7,7 @@ # start the example app in another thread httpd = HTTPServer(('localhost', 8000), SimpleHTTPRequestHandler) thread = Thread(target=httpd.serve_forever) -thread.setDaemon(True) +thread.daemon = True thread.start() # launch firefox headless @@ -23,13 +23,13 @@ percy_snapshot(browser, 'Empty Todo State') # snapshot with a new todo -new_todo_input = browser.find_element_by_class_name('new-todo') +new_todo_input = browser.find_element('class name', 'new-todo') new_todo_input.send_keys('Try Percy') new_todo_input.send_keys(Keys.ENTER) percy_snapshot(browser, 'With a Todo') # snapshot with a completed todo -todo_toggle = browser.find_element_by_class_name('toggle') +todo_toggle = browser.find_element('class name', 'toggle') todo_toggle.click() percy_snapshot(browser, 'Completed Todo')