Cypress: Could not able to retrieve a specific data from downloaded excel-sheet

[亡魂溺海] 提交于 2019-12-11 07:49:44

问题


Below is the Excel from which i need 'SIP' data '37046654'

enter image description here enter image description here

I have tried below cypress code but it is failing as it is expecting all the data in the excel-sheet

Cypress Code:

describe('API Testing with Cypress', () => {
 
    it('Validate the header', () => {
		
responsebodydata = cy.readFile('C:/Users/backNew.csv').should('eq','37046654')
		
		cy.log (responsebodydata)
			
     })
  })

Assertion result: Failed with timeout by following output:

expected 'SIP\tAsset Class\tSector\tObservations\tCDP Proximity\r\n37046789\tUP1G\tRetail\t1\t100\r\n37046654\tUG8G\tRetail\t1\t0' to equal '37046ADD'

Can anyone give some idea how can i get / check '37046654' exist in the excel-sheet or not


回答1:


If you want just check that the 37046654 number is present in the backNew.csv file - use the contains.

responsebodydata = cy.readFile('C:/Users/backNew.csv').should('contains','37046654')


来源:https://stackoverflow.com/questions/57133812/cypress-could-not-able-to-retrieve-a-specific-data-from-downloaded-excel-sheet

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!