Skip to content

Commit

Permalink
test: add e2e test for transformation traceability event (#216)
Browse files Browse the repository at this point in the history
* test: add e2e test for transformation traceability event

* test: implement traceability event
  • Loading branch information
ldhyen99 authored Feb 19, 2025
1 parent 4640856 commit 524e51d
Show file tree
Hide file tree
Showing 9 changed files with 2,859 additions and 1,330 deletions.
14 changes: 14 additions & 0 deletions e2e/constant.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export const ORCHARD_FACILITY = 'Orchard Facility';
export const APP_CONFIG_FEATURE_APP = 'apps';

export const DIGITAL_TRACEABILITY_EVENT = 'DigitalTraceabilityEvent';
export const DIGITAL_PRODUCT_PASSPORT = 'DigitalProductPassport';

export const ISSUE_DPP = 'Issue DPP';
export const ISSUE_TRACEABILITY_TRANSFORMATION_EVENT = 'Issue Traceability Transformation Event';
export const ISSUE_TRACEABILITY_OBJECT_EVENT = 'Issue Traceability Object Event';
export const ISSUE_TRACEABILITY_ASSOCIATION_EVENT = 'Issue Traceability Association Event';
export const ISSUE_TRACEABILITY_AGGREGATION_EVENT = 'Issue Traceability Aggregation Event';
export const MOVE_TO_NEXT_FACILITY = 'Move to Next Facility';

export const TRACEABILITY_LINK_TYPE = 'http://localhost:3000/gs1/01/09359502000034/21/123456';
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import {
APP_CONFIG_FEATURE_APP,
DIGITAL_TRACEABILITY_EVENT,
ISSUE_TRACEABILITY_AGGREGATION_EVENT,
ORCHARD_FACILITY,
TRACEABILITY_LINK_TYPE,
} from 'constant';
import IssuePage from 'cypress/page/issuePage';

const aggregationEvent = new IssuePage();

describe('Issue Digital Traceability Aggregation Event end-to-end testing flow', () => {
beforeEach(() => {
aggregationEvent.beforeAll();
});

it('should access the right the app config data', () => {
aggregationEvent.testAppConfig();
});

it('should visit the homepage, navigate to "Orchard Facility", handle API calls, and show success message', () => {
aggregationEvent.generateWorkflow(
ORCHARD_FACILITY,
ISSUE_TRACEABILITY_AGGREGATION_EVENT,
DIGITAL_TRACEABILITY_EVENT,
APP_CONFIG_FEATURE_APP,
);
});

it('Verify linkType', () => {
aggregationEvent.verifyLinkType(TRACEABILITY_LINK_TYPE);
});

it('Runs testing UNTP test suite for Digital Traceability Aggregation Event', () => {
aggregationEvent.runUntpTest('digitalTraceabilityEvent', 'v0.5.0');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { APP_CONFIG_FEATURE_APP, DIGITAL_TRACEABILITY_EVENT, ISSUE_TRACEABILITY_ASSOCIATION_EVENT, ORCHARD_FACILITY, TRACEABILITY_LINK_TYPE } from 'constant';
import IssuePage from 'cypress/page/issuePage';

const associationEvent = new IssuePage();

describe('Issue Digital Traceability Association Event end-to-end testing flow', () => {
beforeEach(() => {
associationEvent.beforeAll();
});

it('should access the right the app config data', () => {
associationEvent.testAppConfig();
});

it('should visit the homepage, navigate to "Orchard Facility", handle API calls, and show success message', () => {
associationEvent.generateWorkflow(
ORCHARD_FACILITY,
ISSUE_TRACEABILITY_ASSOCIATION_EVENT,
DIGITAL_TRACEABILITY_EVENT,
APP_CONFIG_FEATURE_APP,
);

});

it('Verify linkType', () => {
associationEvent.verifyLinkType(TRACEABILITY_LINK_TYPE);
});

it('Runs testing UNTP test suite for Digital Traceability Association Event', () => {
associationEvent.runUntpTest('digitalTraceabilityEvent', 'v0.5.0');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import {
APP_CONFIG_FEATURE_APP,
DIGITAL_TRACEABILITY_EVENT,
ISSUE_TRACEABILITY_OBJECT_EVENT,
ORCHARD_FACILITY,
TRACEABILITY_LINK_TYPE,
} from 'constant';
import IssuePage from 'cypress/page/issuePage';

const objectEvent = new IssuePage();

describe('Issue Digital Traceability Object Event end-to-end testing flow', () => {
beforeEach(() => {
objectEvent.beforeAll();
});

it('should access the right the app config data', () => {
objectEvent.testAppConfig();
});

it('should visit the homepage, navigate to "Orchard Facility", handle API calls, and show success message', () => {
objectEvent.generateWorkflow(
ORCHARD_FACILITY,
ISSUE_TRACEABILITY_OBJECT_EVENT,
DIGITAL_TRACEABILITY_EVENT,
APP_CONFIG_FEATURE_APP,
);
});

it('Verify linkType', () => {
objectEvent.verifyLinkType(TRACEABILITY_LINK_TYPE);
});

it('Runs testing UNTP test suite for Digital Traceability Object Event', () => {
objectEvent.runUntpTest('digitalTraceabilityEvent', 'v0.5.0');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import {
APP_CONFIG_FEATURE_APP,
DIGITAL_PRODUCT_PASSPORT,
DIGITAL_TRACEABILITY_EVENT,
ISSUE_DPP,
MOVE_TO_NEXT_FACILITY,
ORCHARD_FACILITY,
TRACEABILITY_LINK_TYPE,
} from 'constant';
import IssuePage from 'cypress/page/issuePage';

const transactionEvent = new IssuePage();
const dppIssue = new IssuePage();

describe('Issue Digital Traceability Transaction Event end-to-end testing flow', () => {
beforeEach(() => {
transactionEvent.beforeAll();
cy.clearLocalStorage();
});

it('should access the right the app config data', () => {
transactionEvent.testAppConfig();
});

it('should issue DPP first and then issue Digital Traceability Transaction Event', () => {
dppIssue.generateWorkflow(ORCHARD_FACILITY, ISSUE_DPP, DIGITAL_PRODUCT_PASSPORT, APP_CONFIG_FEATURE_APP);

cy.visit('/');

transactionEvent.generateWorkflow(
ORCHARD_FACILITY,
MOVE_TO_NEXT_FACILITY,
DIGITAL_TRACEABILITY_EVENT,
APP_CONFIG_FEATURE_APP,
);
});

it('Verify linkType', () => {
transactionEvent.verifyLinkType(TRACEABILITY_LINK_TYPE);
});

it('Runs testing UNTP test suite for Digital Traceability Transaction Event', () => {
transactionEvent.runUntpTest('digitalTraceabilityEvent', 'v0.5.0');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import {
APP_CONFIG_FEATURE_APP,
DIGITAL_TRACEABILITY_EVENT,
ISSUE_TRACEABILITY_TRANSFORMATION_EVENT,
ORCHARD_FACILITY,
TRACEABILITY_LINK_TYPE,
} from 'constant';
import IssuePage from 'cypress/page/issuePage';

const transformationEvent = new IssuePage();

describe('Issue Digital Traceability Transformation Event end-to-end testing flow', () => {
beforeEach(() => {
transformationEvent.beforeAll();
});

it('should access the right the app config data', () => {
transformationEvent.testAppConfig();
});

it('should visit the homepage, navigate to "Orchard Facility", handle API calls, and show success message', () => {
transformationEvent.generateWorkflow(
ORCHARD_FACILITY,
ISSUE_TRACEABILITY_TRANSFORMATION_EVENT,
DIGITAL_TRACEABILITY_EVENT,
APP_CONFIG_FEATURE_APP,
);
});

it('Verify linkType', () => {
transformationEvent.verifyLinkType(TRACEABILITY_LINK_TYPE);
});

it('Runs testing UNTP test suite for Digital Traceability Transformation Event', () => {
transformationEvent.runUntpTest('digitalTraceabilityEvent', 'v0.5.0');
});
});
Loading

0 comments on commit 524e51d

Please sign in to comment.