-
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.
QA-60 | E2E | Cross-chain - Add e2e tests (#2336)
- Loading branch information
Showing
17 changed files
with
139 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { NETWORK_LIST } from "../selectors/constants.cy" | ||
import { CrossChainLocators, NetworkLocators } from "../selectors/selectors.cy" | ||
|
||
export const CrossChain = { | ||
|
||
closeUnderstandPopup() { | ||
cy.get(CrossChainLocators.btnUnderstand).click() | ||
}, | ||
|
||
selectNetworkIn(networkName: string) { | ||
cy.get(CrossChainLocators.btnNetworkIn).click() | ||
cy.get(NetworkLocators.btnNetwork).contains(networkName).click({ force: true }) | ||
|
||
}, | ||
|
||
selectNetworkOut(networkName: string) { | ||
cy.get(CrossChainLocators.btnNetworkOut).click() | ||
cy.get(NetworkLocators.btnNetwork).contains(networkName).click({ force: true }) | ||
}, | ||
|
||
changeNetwork(oldNetwork: string[]) { | ||
let random = 0 | ||
do { | ||
random = Math.floor(Math.random() * NETWORK_LIST.length) | ||
} while (oldNetwork.includes(NETWORK_LIST[random]) === true) | ||
|
||
return NETWORK_LIST[random] | ||
}, | ||
|
||
checkLoadedPage() { | ||
return cy.get(CrossChainLocators.rechartsSurface, { timeout: 20000 }).should(() => { }).then($obj => { | ||
if ($obj.length > 0) { | ||
return true | ||
} | ||
return false | ||
}) | ||
}, | ||
|
||
getCurrentNetworkIn() { | ||
return cy.get(CrossChainLocators.btnNetworkIn).invoke('text').then(network => { | ||
return network | ||
}) | ||
}, | ||
|
||
getCurrentNetworkOut() { | ||
return cy.get(CrossChainLocators.btnNetworkOut).invoke('text').then(network => { | ||
return network | ||
}) | ||
}, | ||
} |
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
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,37 @@ | ||
import { CrossChain } from "../pages/cross-chain.po.cy" | ||
import { SwapPage } from "../pages/swap-page.po.cy" | ||
import { DEFAULT_URL, NETWORK, TAG } from "../selectors/constants.cy" | ||
|
||
|
||
describe(`Cross-chain on ${NETWORK}`, { tags: TAG.regression }, () => { | ||
beforeEach(() => { | ||
SwapPage.open(DEFAULT_URL) | ||
SwapPage.goToCrossChain() | ||
CrossChain.checkLoadedPage().then((checked) => { | ||
if (checked === true) { | ||
CrossChain.closeUnderstandPopup() | ||
} | ||
}) | ||
}) | ||
|
||
describe('Select network', () => { | ||
it('The network should be changed successfully', () => { | ||
const networkIn = CrossChain.changeNetwork([NETWORK]) | ||
CrossChain.selectNetworkIn(networkIn) | ||
CrossChain.getCurrentNetworkIn().then((currentNetworkIn) => { | ||
expect(currentNetworkIn).to.equal(networkIn) | ||
}) | ||
|
||
CrossChain.getCurrentNetworkOut().then((currentNetworkOut) => { | ||
const networkOut = CrossChain.changeNetwork([networkIn, currentNetworkOut]) | ||
cy.wait(1000) | ||
CrossChain.selectNetworkOut(networkOut) | ||
CrossChain.getCurrentNetworkOut().then((currentNetworkOut) => { | ||
expect(currentNetworkOut).to.equal(networkOut) | ||
}) | ||
|
||
}) | ||
}) | ||
|
||
}) | ||
}) |
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
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
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