Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
superstar54 committed Dec 13, 2023
1 parent ce75ef3 commit 932fb8f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,18 @@ jobs:
- name: Start AiiDA daemon
run: verdi daemon start 2

- name: Install Dependencies
working-directory: aiida_worktree/web/frontend
run: npm install
- name: FastAPI
working-directory: aiida_worktree/web/backend
run: |
python main.py &
- name: Start React Application
- name: Install Dependencies, Start React Application
working-directory: aiida_worktree/web/frontend
run: npm start
background: true

- name: Wait for React App to Start
run: sleep 10
run: |
npm install
# npm run build
npm run start &
sleep 5
- name: Run pytest
env:
Expand Down
8 changes: 6 additions & 2 deletions tests/web/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@ def test_root_route(client):
assert response.json() == {"message": "Welcome to AiiDA-WorkTree."}


# Add more test cases for your other routes and features
# For example, testing authentication, database interactions, etc.
# Sample test case for the root route
def test_worktree_route(client, wt_calcfunction):
wt_calcfunction.submit(wait=True)
response = client.get("/api/worktree-data")
assert response.status_code == 200
assert len(response.json()) > 0
4 changes: 3 additions & 1 deletion tests/web/test_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def test_homepage(page):
pytest.fail("Element 'a[href='/wortre']' not found on the page")


def test_worktree(page):
def test_worktree(page, wt_calcfunction):
wt_calcfunction.submit(wait=True)
page.goto("http://localhost:3000/worktree")

# Check for the existence of a specific element on the page
Expand All @@ -38,6 +39,7 @@ def test_worktree(page):
assert page.locator(".pagination").is_visible()

# Verify the presence of at least one row in the table
page.wait_for_timeout(3000)
assert page.locator("tr").count() >= 2 # Including header row


Expand Down

0 comments on commit 932fb8f

Please sign in to comment.