Conexio amb la api
This commit is contained in:
parent
207c0ba819
commit
b12369cb47
48513 changed files with 7391639 additions and 7 deletions
22
node_modules/blocking-proxy/examples/README.md
generated
vendored
Executable file
22
node_modules/blocking-proxy/examples/README.md
generated
vendored
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
This is an example test that makes use of Blocking Proxy.
|
||||
|
||||
## Running the example
|
||||
|
||||
The example requires python 2.7 and the python selenium module. Assuming you
|
||||
have pip and python, you can run the example like so:
|
||||
|
||||
```
|
||||
pip install selenium
|
||||
./run_example.sh
|
||||
```
|
||||
|
||||
## What it does
|
||||
|
||||
The example test is a simple WebDriver test of angularjs.io. It starts a
|
||||
selenium server (using [WebDriver Manager](https://github.com/angular/webdriver-manager),
|
||||
starts a Blocking Proxy instance, then runs the test.
|
||||
|
||||
Blocking Proxy is set to use a 3 second highlight delay, so you'll see elements
|
||||
highlighted before they're interacted with. It will also generate a log of WebDriver
|
||||
commands in the current directory, with the file like `webdriver_log_xxxxxxxx.txt`.
|
||||
|
||||
31
node_modules/blocking-proxy/examples/e2e_test.py
generated
vendored
Executable file
31
node_modules/blocking-proxy/examples/e2e_test.py
generated
vendored
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
from selenium import webdriver
|
||||
|
||||
capabilities = webdriver.DesiredCapabilities.CHROME.copy()
|
||||
WD_URL = 'http://localhost:8001'
|
||||
|
||||
driver = webdriver.Remote(desired_capabilities=capabilities, command_executor=WD_URL)
|
||||
|
||||
print "Loading angularjs.org"
|
||||
driver.get('https://angularjs.org/')
|
||||
|
||||
print "Testing hello app"
|
||||
sample_app = driver.find_element_by_css_selector("[app-run='hello.html']")
|
||||
sample_app.location_once_scrolled_into_view
|
||||
name_box = sample_app.find_element_by_css_selector('[ng-model="yourName"]')
|
||||
hello_box = sample_app.find_element_by_css_selector('h1')
|
||||
|
||||
name_box.send_keys('Bob')
|
||||
|
||||
assert "Hello Bob!" in hello_box.text
|
||||
|
||||
print "Testing todo app"
|
||||
todo_app = driver.find_element_by_css_selector("[app-run='todo.html']")
|
||||
todo_app.location_once_scrolled_into_view
|
||||
todo_input = todo_app.find_element_by_css_selector('[ng-model="todoList.todoText"]')
|
||||
todo_list = todo_app.find_element_by_css_selector('ul')
|
||||
|
||||
todo_input.send_keys('write some tests');
|
||||
add_button = todo_app.find_element_by_css_selector('[value="add"]')
|
||||
add_button.click()
|
||||
|
||||
assert 'write some tests' in todo_list.text
|
||||
22
node_modules/blocking-proxy/examples/run_example.sh
generated
vendored
Executable file
22
node_modules/blocking-proxy/examples/run_example.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
trap "kill -- -$$" EXIT
|
||||
|
||||
cd ..
|
||||
npm install
|
||||
|
||||
# Start Selenium Server
|
||||
./node_modules/.bin/webdriver-manager update
|
||||
./node_modules/.bin/webdriver-manager start &> /dev/null &
|
||||
|
||||
# Start Blocking Proxy
|
||||
node ./built/lib/bin.js \
|
||||
--seleniumAddress http://localhost:4444/wd/hub \
|
||||
--port 8001 \
|
||||
--highlightDelay 3000 \
|
||||
--logDir examples/ &> /dev/null &
|
||||
|
||||
# Wait a bit for things to come up
|
||||
sleep 2
|
||||
|
||||
# Run the test
|
||||
python examples/e2e_test.py
|
||||
Loading…
Add table
Add a link
Reference in a new issue