Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List items bdd #132

Merged
merged 3 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading