cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.67k stars 3.16k forks source link

Unable to run cypress suite on jenkin. Got stuck everytime. #26299

Closed Sheth90 closed 1 year ago

Sheth90 commented 1 year ago

Current behavior

While creating one of js file, which contains other spec files which are part of smoke testing. Those test cases are not running and throwing an error. While on local it is running properly.

Desired behavior

Need to run properly that suite and should produce output properly

Test code to reproduce

image

My package.json looks like as below:

{
  "name": "samsung-kiosk",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "launchcypress": "cypress open",
    "paralleltest": "npx cypress run --spec ./cypress/e2e/OtherTestcases/*.js",
    "cy:parallel": "cypress-parallel -d cypress/e2e/OtherTestcases/ -t 5 -s paralleltest",

    "testcases": "cypress run --spec ./cypress/e2e/SmokeTestSuite.cy.js --browser chrome",
    "allure:clear": "npx allure generate --clean -o allure-results",
    "testcases-allure": "npm run allure:clear && cypress run --spec ./cypress/e2e/SmokeTestSuite.cy.js --env allure=true",
    "allure:report": "allure generate allure-results --clean -o allure-report",
    "finaltest": "npm run allure:clear && npm run testcases-allure && npm run allure:report",

    "cy:run": "cypress run --env allure=true",
    "tests": "npm run cy:run || npm run aftertest"

  },

  "keywords": [],
  "author": "Sanjay Sonule",
  "license": "ISC",
  "devDependencies": {
    "@4tw/cypress-drag-drop": "^1.4.0",
    "@faker-js/faker": "^7.6.0",
    "@shelex/cypress-allure-plugin": "^2.35.2",
    "allure-commandline": "^2.21.0",
    "cypress": "^12.7.0",
    "cypress-file-upload": "^4.1.1",
    "cypress-xpath": "^1.8.0",
    "mocha-allure-reporter": "^1.4.0",
    "mochawesome": "^7.1.3",
    "mochawesome-merge": "^4.2.0",
    "mochawesome-report-generator": "^6.2.0"
  },
  "dependencies": {
    "-": "^0.0.1",
    "cypress-downloadfile": "^1.2.0",
    "faker": "^5.5.3",
    "save-dev": "^0.0.1-security"
  }
}

I am getting an error message as per attached Screenshot. My Smoke test suite spec file looks like as below. It is properly running in local. But not running over the jenkin. Please help.

// Execute this using  npx cypress run --spec=cypress/e2e/SmokeTestSuite.cy.js'

/* For All Common Settings */
import './SmokeTests/Settings.spec.js'

/* For Dynamic Order Types */
import './SmokeTests/10_DynamicOrderTypes_VerifyDisplayOrderOfOrderTypes.spec.js'
import './SmokeTests/3_DynamicOrderTypes_DineInOrderAndVerify.spec.js'
import './SmokeTests/4_DynamicOrderTypes_TakeoutOrderAndVerify.spec.js'
import './SmokeTests/5_DynamicOrderTypes_DeliveryOrderAndVerify.spec.js'

/* For Discount */
import './SmokeTests/36_Discount_VerifyItemFlatDiscount.spec.js'
import './SmokeTests/37_Discount_VerifyItemPercentageDiscount.spec.js'
import './SmokeTests/38_Discount_VerifySubtotalFlatDiscount.spec.js'
import './SmokeTests/39_Discount_VerifySubtotalPercentageDiscount.spec.js'

/* For Tip */
import './SmokeTests/25_Tip_VerifyDefaultTip.spec.js'
import './SmokeTests/26_Tip_VerifyEditTipCalculation.spec.js'

/* For Modifiers */
import './SmokeTests/85_Modifiers_VerifyDefaultIngredientSetInBackendShouldReflectOnTheKiosk.spec.js'
import './SmokeTests/80_Modifiers_VerifyThatMinMaxShouldWorkOnFrontendAsItIsEnteredInBackend.spec.js'
import './SmokeTests/76_Modifiers_VerifyShowOnKioskFlagIsOffModifierShouldNotDisplay.spec.js'
import './SmokeTests/79_Modifiers_VerifyIngredientsAreSoldOutKioskShouldNotAllowUserToAddThisIngredients.spec.js'

/* For Alcoholic limit */
import './SmokeTests/55_AlcoholicLimit_VerifyAlcoholicItemsNeedToAskIfCustomerIs21.spec.js'
import './SmokeTests/57_AlcoholicLimit_VerifyAfterDeteteAndReaddAlcoholItemShouldNotBreakMaxQtyLimitCalculations.spec.js'
import './SmokeTests/60_AlcoholicLimit_VerifyForComboItemsAlcoholLimitIsSatisfied.spec.js'
import './SmokeTests/61_AlcoholicLimit_VerifyImplementCheckForAlcoholUsingEmployeePin.spec.js'

/* For Items */
import './SmokeTests/68_Items_VerifyShowItemDetailScreenOnKioskIsCheckedRedirectToItemDetailsScreen.spec.js'
import './SmokeTests/71_Items_VerifyComboItemOnlyFlagEnableDisable.spec.js'
import './SmokeTests/99_Items_VerifyCommonLevelVariation.spec.js'
import './SmokeTests/102_Items_VerifyNestedModifiers.spec.js'
import './SmokeTests/105_Items_VerifyComboNestedModifiers.spec.js'
import './SmokeTests/75_Items_VerifyWhenUserClickOnPlusButtonTheQuantityOfItemWillIncreaseInsteadOfDuplicareItem.spec.js'

/* For Upsell */
import './SmokeTests/93_Upsell_VerifyUserCanAddMultiItemLevelUpsell.spec.js'
import './SmokeTests/92_Upsell_VerifyItemLevelUpsellQuantityUpdate.spec.js'
import './SmokeTests/94_Upsell_VerifyUpsellHeaderTextForItemLevelUpsell.spec.js'

/* For Special Request */
import './SmokeTests/65_SpecialRequest_SpecialRequestAddedForAnItemShouldBeDisplayedOnReviewOrderScreen.spec.js'

/* For Category settings */
import './SmokeTests/19_Category_VerifyCategoryHideHeaderTextFlag.spec.js'
import './SmokeTests/89_Category_VerifyLongNameForCategoryShouldBeManaged.spec.js'
import './SmokeTests/14_Category_VerifyCategoryShowKioskFlag.spec.js'
import './SmokeTests/21_Category_VerifyChildCategoryInsideParentCategory.spec.js'

/* For GENERAL SETTINGS */
import './SmokeTests/124_GeneralSettings_AllowAddItemToCartFlagCHECKEDdWithDefaultModifierIs86.spec.js'
import './SmokeTests/130_GeneralSettings_ShowItemDescriptioninNestedModifiersChecked.spec.js'
import './SmokeTests/128_GeneralSettings_ItemTableTentFlagChecked.spec.js'
import './SmokeTests/133_GeneralSettings_LoyaltyRedeemChecked.spec.js'

/* For KIOSK Settings */
import './SmokeTests/135_KioskSettings_Click5TimesOnLogoShouldLeadToKioskSettings.spec.js'
import './SmokeTests/138_KioskSettings_DeviceInfo.spec.js'
import './SmokeTests/137_KioskSettings_LogInLogOut.spec.js'
import './SmokeTests/136_KioskSettings_LaunchKiosk.spec.js'

/* For Loyalty */
import './SmokeTests/139_Loyalty_SignInWithExistingNumberWillRedirectedToLast5OrdersScreen.spec.js'
import './SmokeTests/140_Loyalty_SigningInWithNumberStartingFrom0ShouldNotBeAllowed.spec.js'
import './SmokeTests/141_Loyalty_VerifyLoyaltySignInFromMenuReviewOrderAndHomeScreen.spec.js'
import './SmokeTests/142_Loyalty_LoyaltyTotalPointsLastVisitCountAndPointsEarnedLastVisitShouldShow.spec.js

Cypress Version

12.5.1

Node version

18.14.0

Operating System

Windows 11

Debug Logs

No response

Other

NPM--9.3.1

astone123 commented 1 year ago

@Sheth90 is there a reason why you are importing all of your smoke tests into one spec file? It's possible that this is a memory issue. Could you try executing each spec separately and see if that helps? Thanks

Sheth90 commented 1 year ago

I tried it with folder creation as Smoke test and then run as **.js. Still, it was not running hence I came up with this approach. The same problem is faced again for it. @astone123

Sheth90 commented 1 year ago

Hi @astone123 yesterday night I kept running for a smoke test suite on jenkin as you suggested and I confirmed that it was not working. PFB ss for the same.

image image image

astone123 commented 1 year ago

@Sheth90 could you enable debug logging in your CI run where this happens and post those logs here? Thanks

jordanpowell88 commented 1 year ago

Is this still happening @Sheth90 ?

warrensplayer commented 1 year ago

Unfortunately we have to close this issue due to inactivity. Please comment if there is new information to provide concerning the original issue and we can reopen.