This test suite contains UI-tests for the "GeoNode 4.4.x". The "advanced workflow" of GeoNode is covered by these tests, too. It's possible to run the tests with no advanced workflow then several tests will fail. It uses Cypress.io as testing framework and Mocha Awesome for report generation.
$ sudo apt update && sudo apt upgrade --yes
$ sudo apt install npm --yes
$ npm install
Create the .env file (important)
$ npm run web
$ npm run test
$ npm run report
$ npm run test-and-report
Path of the Report HTML: ./reports
Path of the Report JSON: ./results
Path of the Test Screenshots: ./cypress/screenshots
$ sudo apt update && sudo apt upgrade --yes
$ sudo apt install python3 --yes
Create the .env file (important)
$ python3 ./functions/python/upload.py --iterations <int> --datasetsize medium
--iterations How many Datasets should be uploaded, int >= 0
--datasetsize Size of the Dataset that should be uploaded small|medium|large
$ python3 ./functions/python/upload.py
This will delete all Datasets with prefixes python_|cypress_|Suuushi
This process might take a while... \
1. Get Auth-Token: GET {baseURL}/account/login/
2. Upload Dataset: POST {baseURL}/api/v2/uploads/upload
3. Wait for execID: GET {baseURL}/api/v2/executionrequest/{execID}
1. Get Auth-Token: GET {baseURL}/account/login/
2. Get Dataset-List: GET {baseURL}/api/v2/resources?page_size={pagesize}
3. Delete Dataset: DELETE {baseURL}/api/v2/resources/{pk}/delete
4. Get execID: GET {baseURL}/api/v2/executionrequest
5. Wait for execID: GET {baseURL}/api/v2/executionrequest/{execID}
<no api calls>
<no api calls>
- Use the Edge Dev Tools Network Log to get an idea of the API Calls
- Use Postman to reproduce the API Calls
- Postman can generate Code for all Programming Languages
GET {baseURL}/account/login/HTTP Code: 200
Cookies: sessionid, csrftokenimport requests
url = "http://localhost/account/login/"
payload = {}
headers = {}
response = requests.request("GET", url, headers=headers, data=payload)
csrftoken = response.cookies.get('csrftoken', None)
sessionid = response.cookies.get('sessionid', None)You need the sessionid, csrftoken from step 1
POST {baseURL}/account/login/
Headers:
Cookie: sessionid={sessionid}, csrftoken={csrftoken}
Body (form-data):
login = {username}
password = {password}
csrfmiddlewaretoken = {csrftoken}HTTP Code 302, 200 (Redirect)
302:
Cookie: csrftoken
200:
Cookie: sessionidimport requests
url = "http://localhost/account/login/"
payload = {
'csrfmiddlewaretoken': {csrftoken},
'login': {username},
'password': {password},
}
headers = {
'Cookie': f'csrftoken={csrftoken};',
'Content-Type': 'application/x-www-form-urlencoded'
}
response = requests.request("POST", url, headers=headers, data=payload)
csrftoken = response.cookies.get('csrftoken', None)
sessionid = response.cookies.get('sessionid', None)
if sessionid is None:
sessionid = response.history[0].cookies.get('sessionid', None)GET {baseURL}/api/v2/resources?page_size={pagesize}
Headers:
Cookies: csrftoken={csrfToken}; sessionid={sessionid}
x-csrftoken: {csrfToken}
Payload:
charset: 'UTF-8',
store_spatial_files: 'true'HTTP Code: 200
JSONsee delete.py