Skip to content

Commit

Permalink
Test improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Syed-Vtex committed Jan 18, 2023
1 parent 7057cf3 commit 9d49535
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 17 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Fixed

- Improved selectors and sorting
- In xls doc, verifying reviews are returned in sorted order

### Added

- verifying reviews are sorted by xls doc
- For verifiedPurchaser testcase, added HasShopperReviewed intercept

### Added

Expand Down
2 changes: 1 addition & 1 deletion cy-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ strategy:
stopOnFail: false
parallel: true
specs:
- 2.4.3-verify_date_search_sorting.spec.js
- cypress/integration/2.4.3-verify_date_search_sorting.spec.js
dependency:
- cypress/integration/2.1.1-anonymous_user.spec.js
- cypress/integration/2.1.2-signed_in_user.spec.js
Expand Down
3 changes: 1 addition & 2 deletions cypress/integration/2.4.3-verify_date_search_sorting.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ const currentDate = date.getUTCDate()

describe('verify sorting for reviews', () => {
loginViaCookies({ storeFrontCookie: false })

it('Download reviews for some dates', updateRetry(2), () => {
cy.getVtexItems().then(vtex => {
cy.visit(`${vtex.baseUrl}/admin/app/reviews-ratings/download`)
cy.contains('Reviews')
selectDate({ day: currentDate, position: 1 })
cy.contains('Apply').click()
cy.get('.pa1 > .vtex-button').click()
// cy.get(rrselectors.Download).click()
// selectDate({day:'20',position:2})
})
})

Expand Down
6 changes: 5 additions & 1 deletion cypress/support/testcase.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,14 @@ export function verifyExcelFile(fileName) {
sheet: 'Sheet1',
}).then(rows => {
expect(rows.length).to.be.equal(6)
const sheetData = rows.slice()
const sortedData = rows.sort(
(a, b) => new Date(a.Time) - new Date(b.Time)
)
expect(rows).to.be.equal(sortedData)

sheetData.forEach((_, index) => {
expect(sheetData[index].Time).to.be.equal(sortedData[index].Time)
})
})
})
}
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@
"husky": "^4.2.0",
"lint-staged": "^10.0.2",
"prettier": "^2.5.1",
"typescript": "^3.7.5",
"xlsx": "^0.18.5"
"typescript": "^3.7.5"
},
"dependencies": {}
"dependencies": {
"xlsx": "^0.17.3"
}
}
36 changes: 27 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,14 @@ acorn@^7.1.1:
resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa"
integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==

adler-32@~1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/adler-32/-/adler-32-1.2.0.tgz#6a3e6bf0a63900ba15652808cb15c6813d1a5f25"
integrity sha512-/vUqU/UY4MVeFsg+SsK6c+/05RZXIHZMGJA+PX5JyWI0ZRcBpupnRuPLU/NXXoFwMYCPCoxIfElM2eS+DUXCqQ==
dependencies:
exit-on-epipe "~1.0.1"
printj "~1.1.0"

adler-32@~1.3.0:
version "1.3.1"
resolved "https://registry.yarnpkg.com/adler-32/-/adler-32-1.3.1.tgz#1dbf0b36dda0012189a32b3679061932df1821e2"
Expand Down Expand Up @@ -327,7 +335,7 @@ callsites@^3.0.0:
resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73"
integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==

cfb@~1.2.1:
cfb@^1.1.4:
version "1.2.2"
resolved "https://registry.yarnpkg.com/cfb/-/cfb-1.2.2.tgz#94e687628c700e5155436dac05f74e08df23bc44"
integrity sha512-KfdUZsSOw19/ObEWasvBP/Ac4reZvAGauZhs6S/gqNhXhI7cKwvlH7ulj+dOEYnca4bm4SGo8C1bTAQvnTjgQA==
Expand Down Expand Up @@ -457,7 +465,7 @@ cosmiconfig@^7.0.0:
path-type "^4.0.0"
yaml "^1.10.0"

crc-32@~1.2.0, crc-32@~1.2.1:
crc-32@~1.2.0:
version "1.2.2"
resolved "https://registry.yarnpkg.com/crc-32/-/crc-32-1.2.2.tgz#3cad35a934b8bf71f25ca524b6da51fb7eace2ff"
integrity sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==
Expand Down Expand Up @@ -902,6 +910,11 @@ execa@^4.1.0:
signal-exit "^3.0.2"
strip-final-newline "^2.0.0"

exit-on-epipe@~1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/exit-on-epipe/-/exit-on-epipe-1.0.1.tgz#0bdd92e87d5285d267daa8171d0eb06159689692"
integrity sha512-h2z5mrROTxce56S+pnvAV890uu7ls7f1kEvVGJbw1OlFH3/mlJ5bkXu0KRyW94v37zzHPiUd55iLn3DA7TjWpw==

external-editor@^3.0.3:
version "3.1.0"
resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495"
Expand Down Expand Up @@ -1858,6 +1871,11 @@ prettier@^2.5.1:
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.6.2.tgz#e26d71a18a74c3d0f0597f55f01fb6c06c206032"
integrity sha512-PkUpF+qoXTqhOeWL9fu7As8LXsIUZ1WYaJiY/a7McAQzxjk82OF0tibkFXVCDImZtWxbvojFjerkiLb0/q8mew==

printj@~1.1.0:
version "1.1.2"
resolved "https://registry.yarnpkg.com/printj/-/printj-1.1.2.tgz#d90deb2975a8b9f600fb3a1c94e3f4c53c78a222"
integrity sha512-zA2SmoLaxZyArQTOPj5LXecR+RagfPSU5Kw1qP+jkWeNlrq+eJZyY2oS68SU1Z/7/myXM4lo9716laOFAVStCQ==

progress@^2.0.0:
version "2.0.3"
resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8"
Expand Down Expand Up @@ -2398,15 +2416,15 @@ [email protected]:
dependencies:
mkdirp "^0.5.1"

xlsx@^0.18.5:
version "0.18.5"
resolved "https://registry.yarnpkg.com/xlsx/-/xlsx-0.18.5.tgz#16711b9113c848076b8a177022799ad356eba7d0"
integrity sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==
xlsx@^0.17.3:
version "0.17.5"
resolved "https://registry.yarnpkg.com/xlsx/-/xlsx-0.17.5.tgz#78b788fcfc0773d126cdcd7ea069cb7527c1ce81"
integrity sha512-lXNU0TuYsvElzvtI6O7WIVb9Zar1XYw7Xb3VAx2wn8N/n0whBYrCnHMxtFyIiUU1Wjf09WzmLALDfBO5PqTb1g==
dependencies:
adler-32 "~1.3.0"
cfb "~1.2.1"
adler-32 "~1.2.0"
cfb "^1.1.4"
codepage "~1.15.0"
crc-32 "~1.2.1"
crc-32 "~1.2.0"
ssf "~0.11.2"
wmf "~1.0.1"
word "~0.3.0"
Expand Down

0 comments on commit 9d49535

Please sign in to comment.