Skip to content

Commit

Permalink
Merge pull request #132 from CSCI-GA-2820-SP24-001/list-items-bdd
Browse files Browse the repository at this point in the history
List items bdd
  • Loading branch information
vidishaholsambre authored Apr 30, 2024
2 parents 32b3fa6 + 4a2891a commit 61fcdd7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ deploy: ## Deploy the service on local Kubernetes
.PHONY: build-docker
build-docker: ## Build the docker image and push it to the registry
$(info Building the docker image and pushing it to the registry...)
docker build -t shopcarts:1.0 .
docker build -t shopcarts:latest .
sudo bash -c "echo '127.0.0.1 cluster-registry' >> /etc/hosts"
docker tag shopcarts:1.0 cluster-registry:32000/shopcarts:1.0
docker push cluster-registry:32000/shopcarts:1.0
docker tag shopcarts:latest cluster-registry:32000/shopcarts:latest
docker push cluster-registry:32000/shopcarts:latest

.PHONY: setup-cluster
setup-cluster: ## Setup the cluster and deploy the service
Expand Down
13 changes: 4 additions & 9 deletions features/shopcarts.feature
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ Feature: The shopcarts service back-end
And the "Item Product ID" field should not be empty
And the "Item Product Price" field should not be empty
And the "Item Quantity" field should not be empty

# LIST ALL ITEMS IN SHOPCART
Scenario: List all items in shopcart
When I visit the "Home Page"
Expand All @@ -152,11 +152,6 @@ Feature: The shopcarts service back-end
Then I should see the message "Success"
When I copy the "Shopcart ID" field
And I paste the "Item Shopcart ID" field
And I press the "Search Item" button
Then the "Item ID" field should not be empty
And the "Item Product Name" field should not be empty
And the "Item Product ID" field should not be empty
And the "Item Product Price" field should not be empty
And the "Item Quantity" field should not be empty


When I press the "Search Item" button
Then I should see "1" under the row "Product ID 1" in the table
And I should see "3" under the row "Product ID 3" in the table
2 changes: 1 addition & 1 deletion k8s/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
containers:
- name: shopcarts
image: cluster-registry:32000/shopcarts:latest
imagePullPolicy: IfNotPresent
imagePullPolicy: Always
ports:
- containerPort: 8080
protocol: TCP
Expand Down
2 changes: 1 addition & 1 deletion service/static/js/rest_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ $(function () {
let firstItem = "";
for (let i = 0; i < res.length; i++) {
let item = res[i];
table += `<tr id="row_${i}"><td>${item.cart_id}</td><td>${item.id}</td><td>${item.product_name}</td><td>${item.product_id}</td><td>${item.product_price}</td><td>${item.quantity}</td><td>${item.subtotal}</td></tr>`;
table += `<tr id="row_${i}"><td>${item.cart_id}</td><td>${item.id}</td><td>${item.product_name}</td><td id="product-id-${item.product_id}">${item.product_id}</td><td>${item.product_price}</td><td>${item.quantity}</td><td>${item.subtotal}</td></tr>`;
if (i == 0) {
firstItem = item;
}
Expand Down

0 comments on commit 61fcdd7

Please sign in to comment.