Skip to content

Commit 62c755e

Browse files
authored
Merge pull request #269 from COS301-SE-2024/dev
Dev
2 parents 5d54d00 + c9fbe12 commit 62c755e

70 files changed

Lines changed: 2564 additions & 1574 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/backend_deploy.yml

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
build_and_deploy:
10-
name: "Deploy API"
10+
name: Deploy API
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout Code
@@ -25,29 +25,18 @@ jobs:
2525
git checkout feature/backend/API
2626
git pull
2727
su - farm -c "pm2 restart sample_farm_api"
28+
2829
test-curl-action:
29-
name: "Assertible API"
30+
name: Test API with Assertible
3031
runs-on: ubuntu-latest
3132
needs: build_and_deploy
3233
steps:
33-
- name: "Call API"
34+
- name: Run Assertible Tests
3435
uses: indiesdev/curl@v1.1
3536
with:
36-
# The target URL
37-
# Required: true if custom-config is not set
3837
url: https://assertible.com/apis/9e78aa9b-a667-4256-93b3-f89a9b26961b/run?api_token=${{ secrets.ASSERTIBLE_API_TOKEN }}
39-
40-
# The request method, basically it's one of GET|POST|PUT|PATCH
41-
# Default is GET
4238
method: "GET"
4339
accept: 200,201,204
44-
45-
# Request timeout (millisec)
4640
timeout: 1000
47-
48-
# If it is set to true, it will show the response log in the GitHub UI
4941
log-response: true
50-
51-
# The number of attempts before giving up
52-
# Default: 1
5342
retries: 3
Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
1-
name: Automated Integration tests using Postman CLI
1+
name: Automated Integration tests with Postman CLI
22

33
on:
4-
workflow_run:
5-
workflows: ["Deploy Backend"]
6-
branches: [main, dev, feature/backend/API]
7-
types:
8-
- completed
4+
pull_request:
5+
branches:
6+
- main
7+
- dev
8+
- feature/backend/API
99

1010
jobs:
11-
automated-integration-tests:
11+
run-postman-tests:
12+
name: Run Postman API Tests
1213
runs-on: ubuntu-latest
1314
steps:
14-
- uses: actions/checkout@v4
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
1518
- name: Install Postman CLI
1619
run: |
1720
curl -o- "https://dl-cli.pstmn.io/install/linux64.sh" | sh
21+
1822
- name: Login to Postman CLI
1923
run: postman login --with-api-key ${{ secrets.POSTMAN_API_KEY }}
24+
2025
- name: Run API tests
2126
run: |
2227
postman collection run "26558432-89a30ebe-9eb6-4e38-a7c6-0c4408737984" -e "26558432-5841d9b8-9d3a-4e2d-a70b-a120e35065ab"

.github/workflows/backend_unit.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ name: Backend Unit Tests
33
on:
44
workflow_dispatch:
55
pull_request:
6-
branches: [main, dev, feature/backend/**]
7-
push:
8-
branches: feature/backend/**
6+
branches:
7+
- main
8+
- dev
9+
- feature/backend/**
910

1011
jobs:
11-
automated-backend-unit-tests:
12+
run-unit-tests:
13+
name: Run Python Unit Tests
1214
runs-on: ubuntu-latest
1315

1416
steps:

.github/workflows/ci.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,40 @@ name: Continuous Integration
33
on:
44
workflow_dispatch:
55
pull_request:
6-
branches: [main, dev]
6+
branches:
7+
- main
8+
- dev
9+
710
jobs:
811
format-lint-build:
912
runs-on: ubuntu-latest
1013
steps:
11-
- uses: actions/checkout@v4
12-
- name: Install pnpm
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Setup PNPM
1318
uses: pnpm/action-setup@v4
1419
with:
1520
version: 9
16-
- uses: actions/setup-node@v4
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
1724
with:
18-
node-version: v21.7.0
25+
node-version: "21.7.0"
1926
cache: "pnpm"
27+
2028
- name: Install dependencies
2129
run: pnpm install
2230
working-directory: ./frontend
31+
2332
- name: Run Formatter
2433
run: pnpm run format
2534
working-directory: ./frontend
35+
2636
- name: Run Linter
2737
run: pnpm run lint
2838
working-directory: ./frontend
39+
2940
- name: Run Build
3041
run: pnpm run build
3142
working-directory: ./frontend

.github/workflows/frontend_unit.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,42 @@ name: Frontend Unit Tests
33
on:
44
workflow_dispatch:
55
pull_request:
6-
branches: [main, dev, feature/frontend/**]
6+
branches:
7+
- main
8+
- dev
9+
- feature/frontend/**
10+
711
jobs:
8-
test-upload:
12+
run-tests:
13+
name: Run Frontend Tests
914
runs-on: ubuntu-latest
15+
1016
steps:
11-
- uses: actions/checkout@v4
12-
- name: Install pnpm
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Setup PNPM
1321
uses: pnpm/action-setup@v4
1422
with:
1523
version: 9
16-
- uses: actions/setup-node@v4
24+
25+
- name: Setup Node.js
26+
uses: actions/setup-node@v4
1727
with:
18-
node-version: v21.7.0
28+
node-version: "21.7.0"
1929
cache: "pnpm"
30+
2031
- name: Install dependencies
2132
run: pnpm install
2233
working-directory: ./frontend
34+
2335
- name: Run tests
2436
env:
2537
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
2638
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
2739
run: pnpm run test
2840
working-directory: ./frontend
41+
2942
- name: Upload coverage report to Codecov
3043
uses: codecov/codecov-action@v4
3144
with:
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<template>
2+
<Card v-if="activeIndex === 3" class="mt-6 p-5">
3+
<template #content>
4+
<div class="w-full flex flex-col justify-between items-start gap-4">
5+
<h1 class="text-2xl font-semibold">Add Field Help</h1>
6+
<p>
7+
Welcome to the Add Field page! This page guides you through the process of adding a new field to your account.
8+
The process consists of three main steps:
9+
</p>
10+
11+
<h2 class="text-xl font-semibold">1. Field Info</h2>
12+
<p>In this step, you provide basic information about your new field:</p>
13+
<ul class="list-disc ml-6">
14+
<li><strong>Field Name:</strong> Enter a unique name for your field.</li>
15+
<li><strong>Crop Type:</strong> Select the type of crop you are planting from the dropdown menu.</li>
16+
</ul>
17+
<p>Example:</p>
18+
<div class="flex flex-col gap-2">
19+
<label for="field_name">Field Name</label>
20+
<InputText id="field_name" placeholder="Name" class="w-full sm:w-[250px]" />
21+
<small id="field_name">Enter your new field name above.</small>
22+
<Dropdown
23+
v-model="selectedItem"
24+
:options="cropOptions"
25+
optionLabel="name"
26+
placeholder="Select a Crop Type"
27+
class="w-full sm:w-[250px] mt-4"
28+
/>
29+
</div>
30+
31+
<h2 class="text-xl font-semibold">2. Field Map</h2>
32+
<p>In this step, you draw the boundaries of your field on the map:</p>
33+
<ul class="list-disc ml-6">
34+
<li>Use the map to locate your field's area.</li>
35+
<li>Use the drawing tools to outline the field's boundaries.</li>
36+
<li>You can edit the shape by dragging the corners or edges of the polygon.</li>
37+
</ul>
38+
39+
<h2 class="text-xl font-semibold">3. Confirm</h2>
40+
<p>In the final step, review the information you have entered:</p>
41+
<ul class="list-disc ml-6">
42+
<li><strong>Field Name:</strong> Verify the field name is correct.</li>
43+
<li><strong>Crop Type:</strong> Ensure you have selected the correct crop type.</li>
44+
<li><strong>Field Map:</strong> Check that the field area has been properly drawn.</li>
45+
</ul>
46+
<p>
47+
If everything is correct, click the <Button label="Save Field" size="small" icon="pi pi-check" /> button to
48+
save your new field.
49+
</p>
50+
51+
<h2 class="text-xl font-semibold">Navigation Buttons</h2>
52+
<p>Use the navigation buttons at the bottom of each step to move between steps:</p>
53+
<ul class="list-disc ml-6">
54+
<li class="mb-2"><Button label="Back" size="small" icon="pi pi-arrow-left" />: Go to the previous step.</li>
55+
<li>
56+
<Button label="Next" size="small" icon="pi pi-arrow-right" iconPos="right" />: Proceed to the next step.
57+
</li>
58+
</ul>
59+
60+
<h2 class="text-xl font-semibold">Loading Indicators</h2>
61+
<p>
62+
When saving the field, a loading indicator will appear on the
63+
<Button label="Save Field" size="small" icon="pi pi-check" /> button. Please wait until the process is
64+
complete.
65+
</p>
66+
67+
<h2 class="text-xl font-semibold">Success Message</h2>
68+
<p>
69+
After successfully saving the field, a success message will appear confirming that your field has been saved.
70+
</p>
71+
<p>Example:</p>
72+
<div class="flex items-center gap-2">
73+
<i class="pi pi-check-circle text-green-500"></i>
74+
<span class="text-green-500">Field saved successfully!</span>
75+
</div>
76+
</div>
77+
</template>
78+
</Card>
79+
</template>
80+
81+
<script setup>
82+
const props = defineProps({
83+
activeIndex: {
84+
type: Number,
85+
default: 0,
86+
},
87+
})
88+
89+
const selectedItem = ref()
90+
const cropOptions = ref([
91+
{ name: 'Wheat', id: 1 },
92+
{ name: 'Maize', id: 2 },
93+
{ name: 'Soybeans', id: 3 },
94+
{ name: 'Canola', id: 4 },
95+
{ name: 'Barley', id: 5 },
96+
{ name: 'Sunflower', id: 6 },
97+
{ name: 'Groundnuts', id: 7 },
98+
{ name: 'Sorghum', id: 8 },
99+
{ name: 'Oats', id: 9 },
100+
])
101+
</script>

0 commit comments

Comments
 (0)