Skip to content

Commit

Permalink
Merge branch 'TW-716-baner-subscrition' of github.com:madfish-solutio…
Browse files Browse the repository at this point in the history
…ns/templewallet-extension into TW-716-baner-subscrition
  • Loading branch information
herkoss committed Jun 30, 2023
2 parents 1813d50 + bcd879a commit 6f10e6d
Show file tree
Hide file tree
Showing 32 changed files with 410 additions and 48 deletions.
2 changes: 1 addition & 1 deletion e2e/src/features/change-node.feature
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Feature: Change node
@dev

Scenario: As a user, i'd like to change node
Given I have imported an existing account
And I am on the Header page
Expand Down
6 changes: 6 additions & 0 deletions e2e/src/features/create-new-wallet.feature
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,11 @@ Feature: Create a new wallet
And I press Accept Terms Checkbox on the Register Form page
And I press Create Button on the Register Form page

And I am on the OnRumpModal page
And I press Close Button on the On-ramp Modal page

And I am on the NewsletterModal page
And I press Close Button on the Newsletter Modal page

Then I am on the Home page

2 changes: 1 addition & 1 deletion e2e/src/features/delegate.feature
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Feature: Delegate
@dev
@dev
Scenario: As a user, i'd like to re-delegate TEZ to a baker
Given I have imported an existing account
And I press Asset Item Apy Button on the Assets page
Expand Down
1 change: 1 addition & 0 deletions e2e/src/features/import-account-by-private-key.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Feature: Import Account by Private Key

Scenario: As a user, I'd like to import account by private key
Given I have imported an existing account

Expand Down
3 changes: 3 additions & 0 deletions e2e/src/features/import-existing-wallet.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ Feature: Import existing wallet
And I press Accept Terms Checkbox on the Register Form page
And I press Import Button on the Register Form page

And I am on the NewsletterModal page
And I press Close Button on the Newsletter Modal page

Then I am on the Home page

14 changes: 7 additions & 7 deletions e2e/src/features/send.feature
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Feature: Send
@dev
@dev
Scenario: As a user, I'd like to send my funds to another account
Given I have imported an existing account
And I press Send Button on the Home page

And I am on the Send page
# Send TEZ
And I enter watchOnlyPublicKey into Recipient Input on the Send Form page
And I enter low_amount into Amount Input on the Send Form page
And I enter amount_0_0001 into Amount Input on the Send Form page
And I press Send Button on the Send Form page

And I am on the InternalConfirmation page
Expand All @@ -20,9 +20,9 @@ Feature: Send
# Send uUSD
And I press Asset Drop-down on the Send Form page
And I enter uUSD into Asset Drop-down Search Input on the Send Form page
And I select UUSD token in the token drop-down list on the Send page
And I select uUSD token in the token drop-down list on the Send page
And I enter watchOnlyPublicKey into Recipient Input on the Send Form page
And I enter low_amount into Amount Input on the Send Form page
And I enter amount_0_0001 into Amount Input on the Send Form page
And I press Send Button on the Send Form page

And I am on the InternalConfirmation page
Expand All @@ -36,9 +36,9 @@ Feature: Send
And I press Asset Drop-down on the Send Form page
And I clear Asset Drop-down Search Input value on the Send Form page
And I enter kUSD into Asset Drop-down Search Input on the Send Form page
And I select KUSD token in the token drop-down list on the Send page
And I select kUSD token in the token drop-down list on the Send page
And I enter watchOnlyPublicKey into Recipient Input on the Send Form page
And I enter low_amount into Amount Input on the Send Form page
And I enter amount_0_0001 into Amount Input on the Send Form page
And I press Send Button on the Send Form page

And I am on the InternalConfirmation page
Expand All @@ -54,7 +54,7 @@ Feature: Send
And I enter OBJKTCOM into Asset Drop-down Search Input on the Send Form page
And I select OBJKTCOM token in the token drop-down list on the Send page
And I enter watchOnlyPublicKey into Recipient Input on the Send Form page
And I enter high_amount into Amount Input on the Send Form page
And I enter amount_1 into Amount Input on the Send Form page
And I press Send Button on the Send Form page

And I am on the InternalConfirmation page
Expand Down
147 changes: 147 additions & 0 deletions e2e/src/features/swap.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
Feature: Swap
@dev
Scenario: As a user, i'd like to swap assets
Given I have imported an existing account
And I press Swap Button on the Home page

And I am on the Swap page
# 1.Swap TEZ -> kUSD (TEZ -> FA2)
And I enter amount_0_005 into Asset Input on the Swap Form (From) Input page
And I press Asset Drop-down Button on the Swap Form (To) Input page
And I enter uUSD into Search Input on the Swap Form (To) Input page
And I select uUSD token in the token drop-down list on the Swap page
And I click on animated Swap button on the Swap page

And I am on the InternalConfirmation page
And I press Confirm Button on the Internal Confirmation page

And I am on the OperationStatusAlert page
And I'm waiting for 'success ✓' operation status

And I am on the Swap page
# 2.Swap TEZ -> kUSD (TEZ -> FA1.2)
And I press Asset Drop-down Button on the Swap Form (To) Input page
And I clear Search Input value on the Swap Form (To) Input page
And I enter kUSD into Search Input on the Swap Form (To) Input page
And I select kUSD token in the token drop-down list on the Swap page
And I click on animated Swap button on the Swap page

And I am on the InternalConfirmation page
And I press Confirm Button on the Internal Confirmation page

And I am on the OperationStatusAlert page
And I'm waiting for 'success ✓' operation status

And I am on the Swap page
# 3.Swap kUSD -> TEZ (FA1.2 -> TEZ)
And I press Swap Places Button on the Swap Form page
And I enter amount_0_005 into Asset Input on the Swap Form (From) Input page
And I click on animated Swap button on the Swap page

And I am on the InternalConfirmation page
And I press Confirm Button on the Internal Confirmation page

And I am on the OperationStatusAlert page
And I'm waiting for 'success ✓' operation status


And I am on the Swap page
# 4.Swap uUSD -> TEZ (FA2 -> TEZ)
And I press Asset Drop-down Button on the Swap Form (From) Input page
And I enter uUSD into Search Input on the Swap Form (From) Input page
And I select uUSD token in the token drop-down list on the Swap page
And I click on animated Swap button on the Swap page

And I am on the InternalConfirmation page
And I press Confirm Button on the Internal Confirmation page

And I am on the OperationStatusAlert page
And I'm waiting for 'success ✓' operation status


And I am on the Swap page
# 5.Swap uUSD -> WTZ (FA2 -> FA1.2)
And I press Asset Drop-down Button on the Swap Form (To) Input page
And I enter WTZ into Search Input on the Swap Form (To) Input page
And I select WTZ token in the token drop-down list on the Swap page
And I click on animated Swap button on the Swap page

And I am on the InternalConfirmation page
And I press Confirm Button on the Internal Confirmation page

And I am on the OperationStatusAlert page
And I'm waiting for 'success ✓' operation status


And I am on the Swap page
# 6.Swap WTZ -> uUSD (FA1.2 -> FA2)
And I press Swap Places Button on the Swap Form page
And I enter amount_0_005 into Asset Input on the Swap Form (From) Input page
And I click on animated Swap button on the Swap page

And I am on the InternalConfirmation page
And I press Confirm Button on the Internal Confirmation page

And I am on the OperationStatusAlert page
And I'm waiting for 'success ✓' operation status


And I am on the Swap page
# 7.Swap WTZ -> kUSD (FA1.2 -> FA1.2)
And I press Asset Drop-down Button on the Swap Form (To) Input page
And I enter kUSD into Search Input on the Swap Form (To) Input page
And I select kUSD token in the token drop-down list on the Swap page
And I click on animated Swap button on the Swap page

And I am on the InternalConfirmation page
And I press Confirm Button on the Internal Confirmation page

And I am on the OperationStatusAlert page
And I'm waiting for 'success ✓' operation status


And I am on the Swap page
# 8.Swap kUSD -> WTZ (FA1.2 -> FA1.2)
And I press Swap Places Button on the Swap Form page
And I enter amount_0_005 into Asset Input on the Swap Form (From) Input page
And I click on animated Swap button on the Swap page

And I am on the InternalConfirmation page
And I press Confirm Button on the Internal Confirmation page

And I am on the OperationStatusAlert page
And I'm waiting for 'success ✓' operation status


And I am on the Swap page
# 9.Swap wUSDT -> uUSD (FA2 -> FA2)
And I press Asset Drop-down Button on the Swap Form (From) Input page
And I enter wUSDT into Search Input on the Swap Form (From) Input page
And I select wUSDT token in the token drop-down list on the Swap page
And I clear Asset Input value on the Swap Form (From) Input page
And I enter amount_0_03 into Asset Input on the Swap Form (From) Input page
And I press Asset Drop-down Button on the Swap Form (To) Input page
And I enter uUSD into Search Input on the Swap Form (To) Input page
And I select uUSD token in the token drop-down list on the Swap page
And I click on animated Swap button on the Swap page

And I am on the InternalConfirmation page
And I press Confirm Button on the Internal Confirmation page

And I am on the OperationStatusAlert page
And I'm waiting for 'success ✓' operation status


And I am on the Swap page
# 10.Swap wUSDT -> uUSD (FA2 -> FA2)
And I press Swap Places Button on the Swap Form page
And I enter amount_0_03 into Asset Input on the Swap Form (From) Input page
And I click on animated Swap button on the Swap page

And I am on the InternalConfirmation page
And I press Confirm Button on the Internal Confirmation page

And I am on the OperationStatusAlert page
And I'm waiting for 'success ✓' operation status

Then I am on the Swap page
1 change: 1 addition & 0 deletions e2e/src/features/unlock-screen.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Feature: Unlock Screen

Scenario: As a user, I'd like to unlock my wallet
Given I have imported an existing account
And I press Account Icon on the Header page
Expand Down
4 changes: 4 additions & 0 deletions e2e/src/hooks/before.hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ Before({ timeout: MEDIUM_TIMEOUT }, async () => {

const page = await retry(async () => {
const page = await BrowserContext.browser.newPage();
await page.setViewport({
height: 800,
width: 800
});
try {
const response = await page.goto(url);
if (response == null || !response.ok) throw new Error('Failed to open page');
Expand Down
9 changes: 8 additions & 1 deletion e2e/src/page-objects/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { SwapPage } from 'e2e/src/page-objects/pages/swap.page';

import { NetworksDropDown } from 'e2e/src/page-objects/pages/drop-down-lists/networks.drop-down';
import { NewsletterModalPage } from 'e2e/src/page-objects/pages/newsletter-modal.page';
import { OnRumModalPage } from 'e2e/src/page-objects/pages/on-rum-modal.page';

import { OperationStatusAlert } from './pages/alerts/operation-status.alert';
import { CreateOrRestoreAnAccountPage } from './pages/create-or-restore-an-account.page';
Expand Down Expand Up @@ -45,5 +49,8 @@ export const Pages = {
InternalConfirmation: new InternalConfirmationPage(),
OperationStatusAlert: new OperationStatusAlert(),
Send: new SendPage(),
NetworksDropDown: new NetworksDropDown()
NetworksDropDown: new NetworksDropDown(),
OnRumpModal: new OnRumModalPage(),
NewsletterModal: new NewsletterModalPage(),
Swap: new SwapPage()
};
25 changes: 19 additions & 6 deletions e2e/src/page-objects/pages/internal-confirmation.page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { InternalConfirmationSelectors } from 'src/app/templates/InternalConfirmation.selectors';
import { OperationsBannerSelectors } from 'src/app/templates/OperationsBanner/OperationsBanner.selectors';

import { LONG_TIMEOUT } from 'e2e/src/utils/timing.utils';

import { InternalConfirmationSelectors } from '../../../../src/app/templates/InternalConfirmation.selectors';
import { Page } from '../../classes/page.class';
import { createPageElement } from '../../utils/search.utils';

Expand All @@ -11,12 +13,23 @@ export class InternalConfirmationPage extends Page {
rawTab = createPageElement(InternalConfirmationSelectors.rawTab);
previewTab = createPageElement(InternalConfirmationSelectors.previewTab);
retryButton = createPageElement(InternalConfirmationSelectors.retryButton);
errorText = createPageElement(OperationsBannerSelectors.errorText);
errorDropDownButton = createPageElement(OperationsBannerSelectors.errorDropDownButton);
errorValue = createPageElement(OperationsBannerSelectors.errorValue);

async isVisible() {
await this.confirmButton.waitForDisplayed(LONG_TIMEOUT);
await this.declineButton.waitForDisplayed();
await this.bytesTab.waitForDisplayed();
await this.rawTab.waitForDisplayed();
await this.previewTab.waitForDisplayed();
try {
await this.errorText.waitForDisplayed(5000);
await this.errorDropDownButton.click();

const errorLog = await this.errorValue.getText();
console.log('Confirmation page includes error logs:', errorLog);
} catch (error) {
await this.confirmButton.waitForDisplayed(LONG_TIMEOUT);
await this.declineButton.waitForDisplayed();
await this.bytesTab.waitForDisplayed();
await this.rawTab.waitForDisplayed();
await this.previewTab.waitForDisplayed();
}
}
}
16 changes: 16 additions & 0 deletions e2e/src/page-objects/pages/newsletter-modal.page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { NewsletterOverlaySelectors } from 'src/app/layouts/PageLayout/NewsletterOverlay/NewsletterOverlay.selectors';

import { Page } from '../../classes/page.class';
import { createPageElement } from '../../utils/search.utils';

export class NewsletterModalPage extends Page {
closeButton = createPageElement(NewsletterOverlaySelectors.closeButton);
emailInput = createPageElement(NewsletterOverlaySelectors.emailInput);
subscribeButton = createPageElement(NewsletterOverlaySelectors.subscribeButton);

async isVisible() {
await this.closeButton.waitForDisplayed();
await this.emailInput.waitForDisplayed();
await this.subscribeButton.waitForDisplayed();
}
}
20 changes: 20 additions & 0 deletions e2e/src/page-objects/pages/on-rum-modal.page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { OnRampOverlaySelectors } from 'src/app/layouts/PageLayout/OnRampOverlay/OnRampOverlay.selectors';

import { Page } from '../../classes/page.class';
import { createPageElement } from '../../utils/search.utils';

export class OnRumModalPage extends Page {
closeButton = createPageElement(OnRampOverlaySelectors.closeButton);
fiftyDollarButton = createPageElement(OnRampOverlaySelectors.fiftyDollarButton);
oneHundredDollarButton = createPageElement(OnRampOverlaySelectors.oneHundredDollarButton);
twoHundredDollarButton = createPageElement(OnRampOverlaySelectors.twoHundredDollarButton);
customAmountButton = createPageElement(OnRampOverlaySelectors.customAmountButton);

async isVisible() {
await this.closeButton.waitForDisplayed();
await this.fiftyDollarButton.waitForDisplayed();
await this.oneHundredDollarButton.waitForDisplayed();
await this.twoHundredDollarButton.waitForDisplayed();
await this.customAmountButton.waitForDisplayed();
}
}
47 changes: 47 additions & 0 deletions e2e/src/page-objects/pages/swap.page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import retry from 'async-retry';
import {
SwapFormFromInputSelectors,
SwapFormSelectors,
SwapFormToInputSelectors
} from 'src/app/templates/SwapForm/SwapForm.selectors';
import { AssetsMenuSelectors } from 'src/app/templates/SwapForm/SwapFormInput/AssetsMenu/selectors';

import { sleep } from 'e2e/src/utils/timing.utils';

import { Page } from '../../classes/page.class';
import { createPageElement, findElement } from '../../utils/search.utils';

export class SwapPage extends Page {
swapPlacesButton = createPageElement(SwapFormSelectors.swapPlacesButton);
swapButton = createPageElement(SwapFormSelectors.swapButton);

assetInputFrom = createPageElement(SwapFormFromInputSelectors.assetInput);
assetItemFrom = createPageElement(SwapFormFromInputSelectors.assetDropDownButton);
searchInputFrom = createPageElement(SwapFormFromInputSelectors.searchInput);

assetInputTo = createPageElement(SwapFormToInputSelectors.assetInput);
assetItemTo = createPageElement(SwapFormToInputSelectors.assetDropDownButton);
searchInputTo = createPageElement(SwapFormToInputSelectors.searchInput);

async isVisible() {
await this.swapPlacesButton.waitForDisplayed();
await this.swapButton.waitForDisplayed();
await this.assetInputFrom.waitForDisplayed();
await this.assetItemFrom.waitForDisplayed();
await this.assetInputTo.waitForDisplayed();
await this.assetItemTo.waitForDisplayed();
}

async selectAsset(slug: string) {
// Retrying here, because sometimes element reference is lost between
// finding it and clicking. Common for drop-down menus.
await retry(
async () => {
const tokenItemElem = await findElement(AssetsMenuSelectors.assetsMenuAssetItem, { slug });
await sleep(1000);
await tokenItemElem.click();
},
{ retries: 10 }
);
}
}
Loading

0 comments on commit 6f10e6d

Please sign in to comment.