-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into kyberai-ui-improvement
- Loading branch information
Showing
32 changed files
with
401 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { FarmLocators, HeaderLocators } from "../selectors/selectors.cy" | ||
|
||
export class FarmPage { | ||
|
||
getTvlValues() { | ||
const arr: string[] = [] | ||
const listData = cy.get(FarmLocators.lblTvl) | ||
listData | ||
.each(item => { | ||
arr.push(item.text().split('$')[1]) | ||
}) | ||
return arr | ||
} | ||
|
||
getAprValues() { | ||
const arr: string[] = [] | ||
const listData = cy.get(FarmLocators.lblApr) | ||
listData | ||
.each(item => { | ||
arr.push(item.text().split('%')[0]) | ||
}) | ||
return arr | ||
} | ||
|
||
countInvalidFarms(arrApr: string[], arrTvl: string[]) { | ||
const totalFarms = arrApr.length | ||
let count = 0; | ||
for (let i = 0; i < totalFarms; i++) { | ||
if (((arrTvl[i]) === undefined || Number(arrTvl[i]) === 0) && Number(arrApr[i]) === 0) { | ||
count = count + 1; | ||
} | ||
} | ||
return count | ||
} | ||
|
||
checkExistData() { | ||
return cy.get(FarmLocators.lblApr, {timeout: 5000}).should(() => { }).then($obj => { | ||
if ($obj.length > 0) { | ||
return true | ||
} | ||
else { | ||
return false | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { FarmPage } from "../pages/farm-page.po.cy"; | ||
import { SwapPage } from "../pages/swap-page.po.cy" | ||
import { DEFAULT_URL, TAG, } from "../selectors/constants.cy" | ||
const farm = new FarmPage() | ||
|
||
describe('Farm', { tags: TAG.regression }, () => { | ||
beforeEach(() => { | ||
SwapPage.open(DEFAULT_URL) | ||
SwapPage.goToFarmPage() | ||
farm.checkExistData().then((value) => { | ||
if (value === true) { | ||
cy.wrap(farm.getAprValues()).as('arrApr') | ||
cy.wrap(farm.getTvlValues()).as('arrTvl') | ||
} | ||
cy.wrap(value).as('checkData') | ||
}) | ||
}) | ||
it('Should be displayed APR and TVL values', function () { | ||
if (this.checkData === true) { | ||
const count = farm.countInvalidFarms(this.arrApr, this.arrTvl) | ||
expect(count).not.to.equal(this.arrApr.length) | ||
} | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.