Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: automated cases for smoke tcs tc1618 tc1677 tc1605 tc1412 #127

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,42 @@ Feature: Artifacts - UI
#Error state
Then Element with "partial class" "has-error" should be "visible"
Then Element with "partial class" "amount-input-error" should be "visible"

@id1618
Scenario: Check the Empty wallet Artifacts on the Bridge Deposit Page
Given I go to page "/bridge?network=era-goerli"
When I click by text "Deposit"
When I choose "ETH" as token and insert "0" as amount
When Element with "text" " Insufficient " should be "visible"
Then Message "ETH" should be visible
Then Message " balance on Ethereum Goerli Testnet to cover the fee. We recommend having at least " should be visible
Then Message " on Goerli Testnet for deposit. " should be visible
Then Element with "text" "Fee:" should be "invisible"
#Fee component
Then Element with "testId" "fee-amount" should be "invisible"

pcheremu marked this conversation as resolved.
Show resolved Hide resolved
@id1677
Scenario: Check "Insufficient balance" warning message (Zero token balance) (Bridge)
Given A wallet should be "empty"
When I go to page "/bridge?network=era-goerli"
When I click by text "Deposit"
When I choose "ETH" as token and insert "1000" as amount
Then Message " Insufficient balance " should be visible
#Error state
Then Element with "partial class" "has-error" should be "visible"
Then Element with "partial class" "amount-input-error" should be "visible"
When I confirm the network switching
Then Element with "text" " Continue " should be "disabled"

pcheremu marked this conversation as resolved.
Show resolved Hide resolved
@id1678
Scenario: Check "Insufficient balance" warning message (Zero token balance) (Bridge)
Then A wallet should be "empty"
When I go to page "/bridge?network=era-goerli"
When I click by text "Withdraw"
When I choose "ETH" as token and insert "1000" as amount
Then Message " Insufficient balance " should be visible
#Error state
Then Element with "partial class" "has-error" should be "visible"
Then Element with "partial class" "amount-input-error" should be "visible"
When I confirm the network switching
Then Element with "text" " Continue " should be "disabled"
34 changes: 34 additions & 0 deletions tests/e2e/features/artifacts/bridgePage/artifacts.feature
Original file line number Diff line number Diff line change
Expand Up @@ -234,3 +234,37 @@ Feature: Withdraw
When I click by text "0x52B6...f46"
Then Element with "text" "zkSync Era Testnet address" should be "visible"
Then Element with "text" "0x52B6...f46" should be "visible"

@id1605:I @testnet
Scenario Outline: Check redirection for the Bridge "View on Explorer" links (Testnet)
Given I go to page "/bridge?network=era-goerli"
When I click by partial text "..."
Then Element with "text" "View on Explorer" should be "visible"
When I click by text "View on Explorer"
Then Modal card element with the "//*[text()='View on explorer']" xpath should be "visible"
When I click by the "<Explorer item>" text on the Explorer Modal
Then New page has "<url>" address

Examples:
| Explorer item | url |
| zkSync Era Testnet | https://goerli.explorer.zksync.io/address/0x2CF4F78917A16C9584AeB5d4c5bD2713d724C75d |
| Ethereum Goerli Testnet | https://goerli.etherscan.io/address/0x2CF4F78917A16C9584AeB5d4c5bD2713d724C75d |
| zkSync Lite Goerli | https://goerli.zkscan.io/explorer/accounts/0x2cf4f78917a16c9584aeb5d4c5bd2713d724c75d |


@id1605:II @mainnet
Scenario Outline: Check redirection for the Bridge "View on Explorer" links (Mainnet)
Given I go to page "/bridge?network=era-mainnet"
When I click by partial text "..."
Then Element with "text" "View on Explorer" should be "visible"
When I click by text "View on Explorer"
Then Modal card element with the "//*[text()='View on explorer']" xpath should be "visible"
When I click by the "<Explorer item>" text on the Explorer Modal
Then New page has "<url>" address

Examples:
| Explorer item | url |
| zkSync Era Mainnet | https://explorer.zksync.io/address/0x2CF4F78917A16C9584AeB5d4c5bD2713d724C75d |
| Ethereum Mainnet | https://etherscan.io/address/0x2CF4F78917A16C9584AeB5d4c5bD2713d724C75d |
| zkSync Lite Mainnet| https://zkscan.io/explorer/accounts/0x2cf4f78917a16c9584aeb5d4c5bd2713d724c75d |

Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,31 @@ Feature: Artifacts - UI
Then Element with "text" "0x1ab721...184" should be "visible"
Then Element with "partial src" "zz.png" should be "visible"

@id1412
Scenario: Check artifacts for "Transaction submitted" pop up (Deposit)
Given I am on the Main page
When I go to page "/transaction/zksync/era/deposit/?network=era-goerli"
When I click by "text" with "Your account" value
When I choose "ETH" as token and insert "0.0000000001" as amount
When I "confirm" transaction after clicking "Add funds to zkSync Era Testnet" button
Then Message "Transaction submitted" should be visible
Then Element with "partial class" "progress-plane-animation" should be "visible"
Then Element with "class" "button-line-body-info-underline" should be "visible"
#Token icon
Then Element with "text" "Deposit" should be "visible"
Then Element with "partial text" "0.0000000001" should be "visible"
Then Modal card element with the "//*[contains(@src, 'eth.svg')]" xpath should be "visible"
Then Modal card element with the "//*[text()='ETH']" xpath should be "visible"
Then Modal card element with the "//*[text()='<$0.01']" xpath should be "visible"
Then Arrow element for "Deposit" external link should be "visible"
Then Arrow element for "Deposit" external link should be "clickable"
Then Element with "text" " Your funds will be available on " should be "visible"
Then Element with "text" "zkSync Era Testnet" should be "visible"
Then Element with "text" " after the transaction is committed on " should be "visible"
Then Element with "text" "Ethereum Goerli Testnet" should be "visible"
Then Element with "text" " and then processed on " should be "visible"
Then Element with "text" "zkSync Era Testnet" should be "visible"
Then Element with "text" ". You are free to close this page. " should be "clickable"
Then Element with "text" " Track status " should be "clickable"
Then Element with "text" " Go to Assets page " should be "visible"

Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Feature: Withdraw
Then Element with "partial src" "eth.svg" should be "visible"
Then Element with "placeholder" "0" should be "visible"
Then Element with "class" "break-all" should be "visible"
Then Element with "data-testid" "token-dropDown" should be "visible"
Then Element with "data-testid" "token-dropDown" should be "clickable"
Then Element with "testid" "token-dropDown" should be "visible"
Then Element with "testid" "token-dropDown" should be "clickable"
Then Element with "class" "amount-input-max-button" should be "visible"
Then Element with "class" "amount-input-max-button" should be "clickable"
# Fee block tc1432
Expand Down
7 changes: 6 additions & 1 deletion tests/e2e/src/pages/base.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,11 @@ export class BasePage {

async getElementByTestId(testid: string) {
element = await this.world.page?.locator(`${this.byTestId}${testid}`).first();
await element.scrollIntoViewIfNeeded();
try {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please justify this construction?

I have some doubts regarding the necessity of it.
Also, there is a question regarding its implementation (try/catch)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try-catch block removed in the last commit

await element.scrollIntoViewIfNeeded(config.minimalTimeout);
} catch (error) {
// ignore
}
return await element;
}

Expand Down Expand Up @@ -235,6 +239,7 @@ export class BasePage {
}

async returnElementByType(elementType: string, value: string) {
//element = undefined;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is that comment about?
I need some context to understand that

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in the last commit

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is not a comment it should be uncommented but not removed, otherwise we will reuse previous selector for undefined element an it will be always true

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uncommented in latest commit

if (elementType === "alt") {
element = await this.getElementByAlt(value);
} else if (elementType === "class") {
Expand Down
9 changes: 9 additions & 0 deletions tests/e2e/src/pages/main.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ export class MainPage extends BasePage {
return "//*[@class='menu-options']";
}

get bridgeExplorerElement() {
return '//*[contains(@class, "destination-item")]';
}

get avatarModalCard() {
return '//*[contains(@class, "address-card-avatar")]';
}
Expand Down Expand Up @@ -265,6 +269,11 @@ export class MainPage extends BasePage {
await this.click(this.menuElement + selector);
}

async clickExplorerElement(text: string) {
const selector = `//*[text()='${text}']`;
pcheremu marked this conversation as resolved.
Show resolved Hide resolved
await this.click(this.bridgeExplorerElement + selector);
}

async selectNetwork(networkName: string) {
await this.click(this.networkSwitcher);

Expand Down
9 changes: 9 additions & 0 deletions tests/e2e/src/steps/portal.steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,15 @@ When("I click by the {string} text on the Menu", config.stepTimeout, async funct
await mainPage.clickMenuElement(text);
});

When(
"I click by the {string} text on the Explorer Modal",
config.stepTimeout,
async function (this: ICustomWorld, text: string) {
mainPage = new MainPage(this);
await mainPage.clickExplorerElement(text);
}
);

Then("I close modal card", config.stepTimeout, async function (this: ICustomWorld) {
const basePage = new BasePage(this);
const mainPage = new MainPage(this);
Expand Down