Skip to content
Open
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
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines +12 to +14

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we detect this automatically ? also just uncommenting wont work right? we should ideally comment above as well.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also we can reduce the duplication by using a variable in makefile


$(VENV)/$(MARKER): $(VENVDEPS) | $(VENV)
$(VENV)/pip install $(foreach path,$(REQUIREMENTS),-r $(path))
touch $(VENV)/$(MARKER)
Expand All @@ -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
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
selenium==3.*
selenium==4.*
percy-selenium==1.*
requests==2.*
6 changes: 3 additions & 3 deletions tests/todo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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')

Expand Down