Skip to content

Commit

Permalink
Cypress OnBoaring flow through the UI
Browse files Browse the repository at this point in the history
  • Loading branch information
yodigos committed Aug 6, 2024
1 parent 8fb20d9 commit 6027742
Show file tree
Hide file tree
Showing 14 changed files with 533 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ export function CreateConnectionForm({
)}
<FieldWrapper>
<KeyvalInput
data-cy={'create-destination-input-name'}
label={SETUP.DESTINATION_NAME}
value={destinationName}
onChange={setDestinationName}
Expand Down Expand Up @@ -269,6 +270,7 @@ export function CreateConnectionForm({
</KeyvalButton>
)}
<KeyvalButton
data-cy={'create-destination-create-click'}
disabled={
isCreateButtonDisabled || isConnectionTested.enabled === false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export function renderFields(
return (
<FieldWrapper key={name}>
<KeyvalInput
data-cy={'create-destination-input-endpoint'}
label={display_name}
value={dynamicFields[name]}
onChange={(value) => onChange(name, value)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function DestinationCard({

return (
<KeyvalCard>
<DestinationCardWrapper onClick={onClick}>
<DestinationCardWrapper data-cy={'choose-destination-'+ display_name} onClick={onClick}>
<KeyvalImage
src={image_url}
width={56}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function ChooseSourcesHeader({
</TotalSelectedWrapper>
)}

<KeyvalButton onClick={onNextClick} style={{ gap: 10, width: 120 }}>
<KeyvalButton data-cy={'choose-source-next-click'} onClick={onNextClick} style={{ gap: 10, width: 120 }}>
<KeyvalText size={20} weight={600} color={theme.text.dark_button}>
{SETUP.NEXT}
</KeyvalText>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function SourceCard({ item, onClick, focus }: any) {
<RadioButtonWrapper>
<KeyvalRadioButton onChange={onClick} value={focus} />
</RadioButtonWrapper>
<SourceCardWrapper onClick={onClick}>
<SourceCardWrapper onClick={onClick} data-cy={'choose-source-' + item.name}>
<Logo width={'6vh'} height={'6vh'} />
<SourceTextWrapper>
<ApplicationNameWrapper>
Expand Down
36 changes: 36 additions & 0 deletions frontend/webapp/cypress/e2e/onboarding-flow.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
describe('On Boarding Flow Tests', () => {

beforeEach(() => {
cy.visit('localhost:3000')
});

it('Source page redirects correctly', () => {
cy.url().should('eq', 'http://localhost:3000/choose-sources');
})

it('Run on the onboarding flow', () => {
// Select All Apps
cy.get('[data-cy="choose-source-coupon"]').should('exist').click()
cy.get('[data-cy="choose-source-frontend"]').should('exist').click()
cy.get('[data-cy="choose-source-inventory"]').should('exist').click()
cy.get('[data-cy="choose-source-membership"]').should('exist').click()
cy.get('[data-cy="choose-source-pricing"]').should('exist').click()

// Click Next Page
cy.get('[data-cy="choose-source-next-click"]').should('exist').click()

// Select Tempo
cy.url().should('eq', 'http://localhost:3000/choose-destination');
cy.get('[data-cy="choose-destination-Tempo"]').should('exist').click()

// Fill Destination Form
cy.url().should('eq', 'http://localhost:3000/connect-destination?type=tempo');
cy.get('[data-cy=create-destination-input-name]').type('e2e-tests');
cy.get('[data-cy=create-destination-input-endpoint]').type('e2e-tests-tempo.traces:4317');
cy.get('[data-cy="create-destination-create-click"]').should('exist').click()

cy.url().should('eq', 'http://localhost:3000/overview');

});
}
);
2 changes: 1 addition & 1 deletion frontend/webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@focus-reactive/react-yaml": "^1.1.2",
"@keyval-dev/design-system": "^2.0.2",
"@keyval-dev/design-system": "^2.0.4",
"@next/font": "^13.4.7",
"@reduxjs/toolkit": "^2.2.1",
"@svgr/webpack": "^6.2.1",
Expand Down
8 changes: 4 additions & 4 deletions frontend/webapp/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1487,10 +1487,10 @@
"@jridgewell/resolve-uri" "3.1.0"
"@jridgewell/sourcemap-codec" "1.4.14"

"@keyval-dev/design-system@^2.0.2":
version "2.0.2"
resolved "https://registry.yarnpkg.com/@keyval-dev/design-system/-/design-system-2.0.2.tgz#6d1866af368bcfd3a1d07f66287b452ccd885f40"
integrity sha512-14+ga4fVgyo1kRTODQeRgxkZGF7Egyn/CgZcqCqq8tKKniXvimUu+RDRjDT6rzwHkktAX7E50KiT+E8bVtT3QQ==
"@keyval-dev/design-system@^2.0.4":
version "2.0.4"
resolved "https://registry.yarnpkg.com/@keyval-dev/design-system/-/design-system-2.0.4.tgz#1ee6de8c381c5668cd825b7f460dba42ed96ab3e"
integrity sha512-ZlYtAi7uE/yUp9KMSVrBod0QhCCC9/ua8FhR9F/j2MukAytMFftnq+ftfuostX1qEWj4cViAo08KL5cMPE3XMg==
dependencies:
"@focus-reactive/react-yaml" "^1.1.2"
"@svgr/core" "^8.0.0"
Expand Down
32 changes: 20 additions & 12 deletions tests/common/ui-tests/run_cypress_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,26 @@

echo "Running Cypress tests"
cd ../../../frontend/webapp || exit
npx cypress run --spec "cypress/e2e/test-overview.cy.ts"

status_cypress=$?
if [ $status_cypress -ne 0 ]; then
echo "Cypress tests failed"
run_cypress_test() {
local spec=$1
npx cypress run --spec "$spec"
local status=$?

# Stop the background process
kill "$(cat odigos-ui.pid)"
rm odigos-ui.pid
rm ../../odigos-ui.log
if [ $status -ne 0 ]; then
echo "Cypress tests failed"
# Stop the background process
kill "$(cat odigos-ui.pid)"
rm odigos-ui.pid
rm ../../odigos-ui.log
exit $status
fi
}

exit $status_cypress
else
echo "Cypress tests passed"
fi
if [ "$1" = "include-onboarding-flow" ]; then
run_cypress_test "cypress/e2e/onboarding-flow.cy.ts"
fi

run_cypress_test "cypress/e2e/test-overview.cy.ts"

echo "Cypress tests passed"
203 changes: 203 additions & 0 deletions tests/e2e/fe-synthetic/02-install-simple-demo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: coupon
namespace: default
labels:
app: coupon
spec:
selector:
matchLabels:
app: coupon
template:
metadata:
labels:
app: coupon
spec:
containers:
- name: coupon
image: keyval/odigos-demo-coupon:v0.1
imagePullPolicy: IfNotPresent
env:
- name: MEMBERSHIP_SERVICE_HOST
value: "membership:8080"
ports:
- containerPort: 8080
---
kind: Service
apiVersion: v1
metadata:
name: coupon
namespace: default
spec:
selector:
app: coupon
ports:
- protocol: TCP
port: 8080
targetPort: 8080
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
namespace: default
labels:
app: frontend
spec:
selector:
matchLabels:
app: frontend
template:
metadata:
labels:
app: frontend
spec:
containers:
- name: frontend
image: keyval/odigos-demo-frontend:v0.2
imagePullPolicy: IfNotPresent
securityContext:
runAsUser: 1000
env:
- name: INVENTORY_SERVICE_HOST
value: inventory:8080
- name: PRICING_SERVICE_HOST
value: pricing:8080
- name: COUPON_SERVICE_HOST
value: coupon:8080
ports:
- containerPort: 8080
readinessProbe:
httpGet:
path: /actuator/health/readiness
port: 8080
initialDelaySeconds: 5
periodSeconds: 5
livenessProbe:
httpGet:
path: /actuator/health/liveness
port: 8080
initialDelaySeconds: 5
periodSeconds: 5
---
kind: Service
apiVersion: v1
metadata:
name: frontend
namespace: default
spec:
selector:
app: frontend
ports:
- protocol: TCP
port: 8080
targetPort: 8080
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: inventory
namespace: default
labels:
app: inventory
spec:
selector:
matchLabels:
app: inventory
template:
metadata:
labels:
app: inventory
spec:
containers:
- name: inventory
image: keyval/odigos-demo-inventory:v0.1
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
---
kind: Service
apiVersion: v1
metadata:
name: inventory
namespace: default
spec:
selector:
app: inventory
ports:
- protocol: TCP
port: 8080
targetPort: 8080
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: membership
namespace: default
labels:
app: membership
spec:
selector:
matchLabels:
app: membership
template:
metadata:
labels:
app: membership
spec:
containers:
- name: membership
image: keyval/odigos-demo-membership:v0.1
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
---
kind: Service
apiVersion: v1
metadata:
name: membership
namespace: default
spec:
selector:
app: membership
ports:
- protocol: TCP
port: 8080
targetPort: 8080
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: pricing
namespace: default
labels:
app: pricing
spec:
selector:
matchLabels:
app: pricing
template:
metadata:
labels:
app: pricing
spec:
containers:
- name: pricing
image: keyval/odigos-demo-pricing:v0.1
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
---
kind: Service
apiVersion: v1
metadata:
name: pricing
namespace: default
spec:
selector:
app: pricing
ports:
- protocol: TCP
port: 8080
targetPort: 8080
Loading

0 comments on commit 6027742

Please sign in to comment.