muly / product-track

online product price and availability tracking
MIT License
0 stars 0 forks source link

integration tests failing #70

Closed muly closed 10 months ago

muly commented 10 months ago

need to troubleshoot and fix . run make test to reproduce this


--- Failed steps:

  Scenario: test product availability # integration_testing/features/web-scraping.feature:2
    Then the response should be "amazon_available_product_response.json" # integration_testing/features/web-scraping.feature:8
      Error: {Url:http://localhost:8006/mock/amazon_available.html Price:49.99 Availability:true Image: Name:} is not equal to {Url: Price:0 Availability:false Image: Name:} 

  Scenario: test product availability # integration_testing/features/web-scraping.feature:2
    Then the response should be "amazon_unavailable_product_response.json" # integration_testing/features/web-scraping.feature:8
      Error: {Url:http://localhost:8006/mock/amazon_unavailable.html Price:0 Availability:false Image: Name:} is not equal to {Url: Price:0 Availability:false Image: Name:} 

  Scenario: test product availability # integration_testing/features/web-scraping.feature:2
    Then the response should be "flipkart_available_product_response.json" # integration_testing/features/web-scraping.feature:8
      Error: {Url:http://localhost:8006/mock/flipkart_available.html Price:123 Availability:true Image: Name:} is not equal to {Url: Price:0 Availability:false Image: Name:} 

  Scenario: test product availability # integration_testing/features/web-scraping.feature:2
    Then the response should be "flipkart_unavailable_product_response.json" # integration_testing/features/web-scraping.feature:8
      Error: {Url:http://localhost:8006/mock/flipkart_unavailable.html Price:0 Availability:false Image: Name:} is not equal to {Url: Price:0 Availability:false Image: Name:} 

  Scenario: test product availability # integration_testing/features/web-scraping.feature:2
    Then the response code should be 406 # integration_testing/features/web-scraping.feature:9
      Error: 405 is not equal to 406
Rohithknaidu commented 10 months ago

make test go test ./... --cover running test test amazon product availability .U----running test test amazon product unavailability .U----running test test flipkart product availability .U----running test test flipkart product unavailability .U----running test test unsupport website .U---- 30

5 scenarios (5 undefined) 30 steps (5 passed, 5 undefined, 20 skipped) 3.6641ms

You can implement step definitions for undefined steps with these snippets:

func theDeployedLocalHost(arg1 string) error { return godog.ErrPending }

func InitializeScenario(ctx godog.ScenarioContext) { ctx.Step(`^the deployed local host "([^"])"$`, theDeployedLocalHost) }

2024/01/12 22:40:29 visiting https://www.flipkart.com/vivo-t2-pro-5g-new-moon-black-256-gb/p/itm1230688cdef18?pid=MOBGT4RZMZFEWDY7&lid=LSTMOBGT4RZMZFEWDY7EEVQUQ&marketplace=FLIPKART&store=tyy%2F4io&srno=b_1_1&otracker=browse&fm=organic&iid=d4fd9eb7-9cb7-48a6-82db-134e1077255b.MOBGT4RZMZFEWDY7.SEARCH&ppt=hp&ppn=homepage&ssid=oj2jvrt9ls0000001699124880241 2024/01/12 22:40:39 visiting https://www.amazon.in/Fastrack-Limitless-Biggest-SingleSync-Watchfaces/dp/B0BZ8T21V4?ref_=Oct_DLandingS_D_8dbdc968_0 {https://www.amazon.in/Fastrack-Limitless-Biggest-SingleSync-Watchfaces/dp/B0BZ8T21V4?ref_=Oct_DLandingS_D_8dbdc968_0 1799 true https://m.media-amazon.com/images/I/41W7U1ZQhDL._SX300_SY300_QL70_ML2_.jpg Fastrack Limitless FS1 Smartwatch|Biggest 1.95" Horizon Curve Display|SingleSync BT Calling v5.3|Built-in Alexa|Upto 5 Day Battery|ATS Chipset|100+ Sports Modes|150+ Watchfaces } 2024/01/12 22:40:42 visiting https://scrapeme.live/shop/Bulbasaur/ {https://scrapeme.live/shop/Bulbasaur/ 63 false } --- FAIL: Test_callScraping (13.62s) --- FAIL: Test_callScraping/flipkart (10.01s) main_test.go:37: process() error = Get "https://www.flipkart.com/vivo-t2-pro-5g-new-moon-black-256-gb/p/itm1230688cdef18?pid=MOBGT4RZMZFEWDY7&lid=LSTMOBGT4RZMZFEWDY7EEVQUQ&marketplace=FLIPKART&store=tyy%2F4io&srno=b_1_1&otracker=browse&fm=organic&iid=d4fd9eb7-9cb7-48a6-82db-134e1077255b.MOBGT4RZMZFEWDY7.SEARCH&ppt=hp&ppn=homepage&ssid=oj2jvrt9ls0000001699124880241": context deadline exceeded (Client.Timeout exceeded while awaiting headers), wantErr false FAIL coverage: 6.5% of statements FAIL github.com/muly/product-track 13.958s FAIL make: *** [Makefile:5: test] Error 1 i got this sir when i pulled the recent main code

Rohithknaidu commented 10 months ago

running test test amazon product availability ...2024/01/13 02:35:46 { "url": "https://smuly-test-ground.ue.r.appspot.com/mock/amazon_available.html",
"emailid": "" } .F-running test test amazon product unavailability ...2024/01/13 02:35:47 { "url": "https://smuly-test-ground.ue.r.appspot.com/mock/amazon_unavailable.html",
"emailid": "" } .F-running test test flipkart product availability ...2024/01/13 02:35:48 { "url": "https://smuly-test-ground.ue.r.appspot.com/mock/flipkart_available.html",
"emailid": "" } .F-running test test flipkart product unavailability ...2024/01/13 02:35:49 { "url": "https://smuly-test-ground.ue.r.appspot.com/mock/flipkart_unavailable.html", "emailid": "" } .F-running test test unsupport website ...2024/01/13 02:35:49 { "url": "https://smuly-test-ground.ue.r.appspot.com/mock/unsupported_file.html", "emailid": "" } it is workiing from postman sir but when it comes to testing the emailid field is empty that is the reason the test is failing