Skip to content

Commit

Permalink
Merge pull request #1729 from DylanJG01/v2
Browse files Browse the repository at this point in the history
V2
  • Loading branch information
dadiorchen authored Oct 16, 2023
2 parents 891b28c + 7db15af commit e43080a
Show file tree
Hide file tree
Showing 16 changed files with 158 additions and 94 deletions.
2 changes: 1 addition & 1 deletion .env.development
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NEXT_PUBLIC_API=https://dev-k8s.treetracker.org/query/v2
NEXT_PUBLIC_API_V2=https://dev-k8s.treetracker.org/
NEXT_PUBLIC_API_V2=https://dev-k8s.treetracker.org/query
NEXT_PUBLIC_TILE_SERVER_URL=https://{s}.treetracker.org/tiles/
NEXT_PUBLIC_TILE_SERVER_SUBDOMAINS=dev-k8s
NEXT_PUBLIC_TILE_SERVER_WEBMAP_API=https://dev-k8s.treetracker.org/webmap/
Expand Down
27 changes: 27 additions & 0 deletions cypress/fixtures/capture.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"id":"0c2d6e3a-d02a-4edf-bcdc-893e1f7a4817",
"reference_id":"999940",
"tree_id":"da4d3ed8-8655-44c5-a7ba-d4c45a0dfb10",
"image_url":"https://treetracker-production-images.s3.eu-central-1.amazonaws.com/2023.02.17.11.59.47_38.364922414000006_-122.51189396800001_a906ab31-5169-421c-8df3-be43f24d4d9c_IMG_20230217_111351_7976264471450881710.jpg","lat":"38.364922414000000","lon":"-122.51189396800000",
"estimated_geometric_location":"0101000020E610000019E5EADEC2A05EC08BDA14C7B52E4340",
"gps_accuracy":null,
"morphology":null,
"age":0,"note":"",
"attributes":null,
"domain_specific_data":null,
"created_at":"2023-07-31T02:24:26.446Z",
"updated_at":"2023-07-31T02:24:26.446Z",
"estimated_geographic_location":"0101000020E610000019E5EADEC2A05EC08BDA14C7B52E4340",
"device_configuration_id":"23d77b5b-2b87-42c7-93c3-8eb837541052",
"session_id":"39ab7585-6360-4d6a-9efa-52f0e35c4eaf",
"status":"active",
"grower_account_id":"c82cc807-8e35-418b-88ce-fda398cf4e89",
"planting_organization_id":null,"species_id":null,
"captured_at":"2023-02-17T19:15:19.000Z","token_id":null,"token_issued":null,
"tags":null,
"device_identifier":"something",
"wallet":"wallet10@test",
"grower_reference_id":null,
"wallet_name":null,
"wallet_token_id":null
}
63 changes: 63 additions & 0 deletions cypress/fixtures/oldTree.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"id": 186734,
"time_created": "2020-10-19T06:46:40.000Z",
"time_updated": "2020-10-19T06:46:40.000Z",
"missing": false,
"priority": false,
"cause_of_death_id": null,
"planter_id": 940,
"primary_location_id": null,
"settings_id": null,
"override_settings_id": null,
"dead": 0,
"photo_id": null,
"image_url": "https://treetracker-dev-images.s3.eu-central-1.amazonaws.com/2020.10.19.09.50.38_-5.508172399749922_38.98146973686408_6bebe71e-5369-4ae0-8c47-9eeff6599fb0_IMG_20201019_094615_7537040365910944885.jpg",
"certificate_id": null,
"estimated_geometric_location": "0101000020E610000027ECE2CCA07D43407E9F76585E0816C0",
"lat": "-5.508172399749922",
"lon": "38.98146973686408",
"gps_accuracy": 4,
"active": true,
"planter_photo_url": "https://treetracker-dev-images.s3.eu-central-1.amazonaws.com/2020.10.19.09.47.53_-5.508107173727935_38.981361706266256_39f0cc9d-0f13-4547-8142-150f15cabb67_IMG_20201019_094513_6614320100195503436.jpg",
"device_id": null,
"sequence": null,
"note": "",
"verified": false,
"uuid": "38572a5b-ac5b-4a77-943a-72254376735e",
"approved": false,
"status": "planted",
"cluster_regions_assigned": true,
"species_id": null,
"planting_organization_id": 1,
"payment_id": null,
"contract_id": null,
"token_issued": false,
"morphology": null,
"age": null,
"species": null,
"capture_approval_tag": null,
"rejection_reason": null,
"matching_hash": null,
"device_identifier": "651f04008af0d91a",
"images": {},
"domain_specific_data": {},
"token_id": null,
"name": null,
"earnings_id": null,
"species_name": null,
"first_name": "Sebastian ",
"last_name": "Gaertner",
"user_image_url": "https://treetracker-production.nyc3.digitaloceanspaces.com/2019.07.10.18.32.42_b4fad89a-10b6-40cc-a134-0085d0e581d2_IMG_20190710_183201_8089920786231467340.jpg",
"token_uuid": null,
"wallet": null,
"attributes": {
"dbh": "13",
"abs_step_count": "75351",
"delta_step_count": "0",
"height_color": "yellow",
"app_build": "1.4.0",
"app_flavor": "justdiggit",
"app_version": "113"
}
}

80 changes: 20 additions & 60 deletions cypress/fixtures/tree186734.json
Original file line number Diff line number Diff line change
@@ -1,62 +1,22 @@
{
"id": 186734,
"time_created": "2020-10-19T06:46:40.000Z",
"time_updated": "2020-10-19T06:46:40.000Z",
"missing": false,
"priority": false,
"cause_of_death_id": null,
"planter_id": 940,
"primary_location_id": null,
"settings_id": null,
"override_settings_id": null,
"dead": 0,
"photo_id": null,
"image_url": "https://treetracker-dev-images.s3.eu-central-1.amazonaws.com/2020.10.19.09.50.38_-5.508172399749922_38.98146973686408_6bebe71e-5369-4ae0-8c47-9eeff6599fb0_IMG_20201019_094615_7537040365910944885.jpg",
"certificate_id": null,
"estimated_geometric_location": "0101000020E610000027ECE2CCA07D43407E9F76585E0816C0",
"lat": "-5.508172399749922",
"lon": "38.98146973686408",
"gps_accuracy": 4,
"active": true,
"planter_photo_url": "https://treetracker-dev-images.s3.eu-central-1.amazonaws.com/2020.10.19.09.47.53_-5.508107173727935_38.981361706266256_39f0cc9d-0f13-4547-8142-150f15cabb67_IMG_20201019_094513_6614320100195503436.jpg",
"device_id": null,
"sequence": null,
"note": "",
"verified": false,
"uuid": "38572a5b-ac5b-4a77-943a-72254376735e",
"approved": false,
"status": "planted",
"cluster_regions_assigned": true,
"species_id": null,
"planting_organization_id": 1,
"payment_id": null,
"contract_id": null,
"token_issued": false,
"morphology": null,
"age": null,
"species": null,
"capture_approval_tag": null,
"rejection_reason": null,
"matching_hash": null,
"device_identifier": "651f04008af0d91a",
"images": {},
"domain_specific_data": {},
"token_id": null,
"name": null,
"earnings_id": null,
"species_name": null,
"first_name": "Sebastian ",
"last_name": "Gaertner",
"user_image_url": "https://treetracker-production.nyc3.digitaloceanspaces.com/2019.07.10.18.32.42_b4fad89a-10b6-40cc-a134-0085d0e581d2_IMG_20190710_183201_8089920786231467340.jpg",
"token_uuid": null,
"wallet": null,
"attributes": {
"dbh": "13",
"abs_step_count": "75351",
"delta_step_count": "0",
"height_color": "yellow",
"app_build": "1.4.0",
"app_flavor": "justdiggit",
"app_version": "113"
}
"id":"da4d3ed8-8655-44c5-a7ba-d4c45a0dfb10",
"latest_capture_id":"b74f65d8-bd25-4ca4-a4f7-8ad50ba9a936",
"image_url":"https://treetracker-production-images.s3.eu-central-1.amazonaws.com/2022.01.27.00.19.43_8.430052995999995_-13.204408322000003_8ad6e7a1-3b35-4998-80c9-faccaa9faaf1_IMG_20220125_120721_490991521.jpg",
"lat":"8.430052996",
"lon":"-13.204408322",
"estimated_geometric_location":"0101000020E61000005E0A2435A8682AC0CDBB02E82FDC2040",
"gps_accuracy":0,
"morphology":null,
"age":null,"created_at":"2022-01-25T12:06:36.000Z",
"updated_at":"2022-01-25T12:06:36.000Z",
"estimated_geographic_location":"0101000020E61000005E0A2435A8682AC0CDBB02E82FDC2040",
"status":"active",
"attributes":null,
"species_id":null,
"planter_id":940,
"name":"The Best Tree"

}



2 changes: 1 addition & 1 deletion cypress/tests/integration/moneytree.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ describe('Money Tree', () => {
// nocksIntercept for extra data that I want to show up
cy.visit(path);
// misc code to confirm changes
cy.get('.mui-nmovop > :nth-child(1)').contains(`Money Tree`);
cy.contains(`${tree.id}`);
});
});
11 changes: 11 additions & 0 deletions cypress/tests/integration/nockRoutes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import organization1 from '../../../doc/examples/organizations/1.json';
import planter940 from '../../../doc/examples/planters/940.json';
import { defaultConfig } from '../../../src/context/configContext';
import capture1 from '../../fixtures/capture.json';
import leader from '../../fixtures/countries/leader.json';
import tree186734 from '../../fixtures/tree186734.json';

Expand All @@ -9,11 +10,13 @@ export function getNockRoutes(
tree: {},
organization: {},
planter: {},
capture: {},
},
) {
const organization = { ...organization1, ...props.organization };
const planter = { ...planter940, ...props.planter };
const tree = { ...tree186734, ...props.tree };
const capture = { ...capture1, ...props.capture };
return [
{
method: 'GET',
Expand Down Expand Up @@ -103,6 +106,14 @@ export function getNockRoutes(
statusCode: 200,
body: leader,
},
{
method: 'GET',
path: '/captures',
statusCode: 200,
body: {
captures: [capture],
},
},
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ describe('Organizations', () => {
prepareNocks({ organization: { ...org, photo_url } });
});

cy.visit(path, {
failOnStatusCode: false,
});
cy.visit(path);

cy.url().should('include', '/organizations');
cy.contains(org.name);
Expand Down
4 changes: 1 addition & 3 deletions cypress/tests/integration/planters/[planterid].cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ describe('Planter page', () => {
it('getServerSideProps return mocks', () => {
const path = `/planters/${planter.id}`;
prepareNocks({ planter });
cy.visit(path, {
failOnStatusCode: false,
});
cy.visit(path);
cy.get('.MuiTypography-h2').contains(/sebastian g/i);
cy.screenshot();
});
Expand Down
14 changes: 6 additions & 8 deletions cypress/tests/integration/tokens/[tokenid].cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('Token page', () => {
cy.task('nockIntercept', {
hostname: 'https://dev-k8s.treetracker.org',
method: 'get',
path: '/query/tokens/6c85c551-ed63-456f-ba0f-8d632897f560',
path: '/query/v2/tokens/6c85c551-ed63-456f-ba0f-8d632897f560',
statusCode: 200,
body: {
id: '6c85c551-ed63-456f-ba0f-8d632897f560',
Expand All @@ -23,7 +23,7 @@ describe('Token page', () => {
created_at: '2021-11-14T22:49:28.495Z',
updated_at: '2021-11-14T22:49:28.495Z',
claim: false,
tree_id: 951836,
tree_id: 'da4d3ed8-8655-44c5-a7ba-d4c45a0dfb10',
tree_image_url:
'https://treetracker-production-images.s3.eu-central-1.amazonaws.com/2021.03.26.03.04.00_8.442396096679852_-13.234358212401096_90318a55-0f01-436f-8c0a-f29e7059caff_IMG_20210310_131020_6428924620633541327.jpg',
tree_species_name: 'apple',
Expand All @@ -32,7 +32,7 @@ describe('Token page', () => {
cy.task('nockIntercept', {
hostname: 'https://dev-k8s.treetracker.org',
method: 'get',
path: '/query/wallets/eecdf253-05b6-419a-8425-416a3e5fc9a0',
path: '/query/v2/wallets/eecdf253-05b6-419a-8425-416a3e5fc9a0',
statusCode: 200,
body: {
id: 'eecdf253-05b6-419a-8425-416a3e5fc9a0',
Expand All @@ -56,17 +56,15 @@ describe('Token page', () => {
cy.task('nockIntercept', {
hostname: 'https://dev-k8s.treetracker.org',
method: 'get',
path: '/query/trees/951836',
path: '/query/v2/trees/da4d3ed8-8655-44c5-a7ba-d4c45a0dfb10',
statusCode: 200,
body: {
id: 951836,
id: 'da4d3ed8-8655-44c5-a7ba-d4c45a0dfb10',
planter_id: 940,
},
});

cy.visit(path, {
failOnStatusCode: false,
});
cy.visit(path);
cy.contains(token.id);
cy.screenshot();
});
Expand Down
20 changes: 15 additions & 5 deletions cypress/tests/integration/top.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import leaders from '../../../doc/examples/countries/leader.json';
import organization1 from '../../../doc/examples/organizations/1.json';
import planter940 from '../../../doc/examples/planters/940.json';
import wallets from '../../../doc/examples/wallets/180Earth.json';
import capture from '../../fixtures/capture.json';
import tree186734 from '../../fixtures/tree186734.json';

describe('top', () => {
Expand All @@ -16,7 +17,16 @@ describe('top', () => {
cy.task('nockIntercept', {
hostname: 'https://dev-k8s.treetracker.org',
method: 'get',
path: '/query/organizations/featured',
path: '/query/v2/captures',
statusCode: 200,
body: {
captures: [capture],
},
});
cy.task('nockIntercept', {
hostname: 'https://dev-k8s.treetracker.org',
method: 'get',
path: '/query/v2/organizations/featured',
statusCode: 200,
body: {
organizations: [organization1],
Expand All @@ -26,17 +36,17 @@ describe('top', () => {
cy.task('nockIntercept', {
hostname: 'https://dev-k8s.treetracker.org',
method: 'get',
path: '/query/planters/featured',
path: '/query/v2/growers/featured',
statusCode: 200,
body: {
planters: [planter940],
grower_accounts: [planter940],
},
});

cy.task('nockIntercept', {
hostname: 'https://dev-k8s.treetracker.org',
method: 'get',
path: '/query/wallets/featured',
path: '/query/v2/wallets/featured',
statusCode: 200,
body: {
wallets: [wallets],
Expand All @@ -49,7 +59,7 @@ describe('top', () => {
});

cy.visit('/top');
cy.contains('Featured trees');
cy.contains('Featured captures');
cy.contains('Check out the global leaders in the tree planting effort');
cy.contains('Tanzania');
cy.screenshot();
Expand Down
Loading

0 comments on commit e43080a

Please sign in to comment.