Skip to content

Commit

Permalink
add e2e start exploring flow (#5293)
Browse files Browse the repository at this point in the history
* add e2e start exploring flow

* Remove the data from the test and replace it with the data from the accounts helpers class

* Click remove for Tap in onboardingwizard methods. Updating Gherkin language in feature file
  • Loading branch information
SamuelSalas authored Nov 30, 2022
1 parent bbf3c38 commit e29a423
Show file tree
Hide file tree
Showing 10 changed files with 393 additions and 16 deletions.
18 changes: 18 additions & 0 deletions wdio/features/SkipStartExploring.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@androidApp
Feature: Skip Start Exploring

Scenario: A user should be able to tap the Skip button and the onboarding tutorial modal should disappear
Given I have imported my wallet
And the onboarding wizard is visible on wallet view
When I tap on "Take a Tour" button
Then the tutorial modal heading should read "Your Accounts"
And there should be an explanation of the accounts functionality.
And I should see the "Skip Tutorial" button
When I tap on "Got it" button
Then the tutorial modal heading should read "Edit Account Name"
And there should be an explanation about adding a nickname to your account.
And I should see the "Skip Tutorial" button
When I tap on "Skip" button
Then the onboarding wizard is no longer visible
And the "Skip" button is no longer visible

41 changes: 41 additions & 0 deletions wdio/features/StartExploring.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
@androidApp
Feature: Start Exploring

Scenario: A user should be able to go through the start exploring tutorial
Given I have imported my wallet
And the onboarding wizard is visible on wallet view
When I tap on "Take a Tour" button
Then the tutorial modal heading should read "Your Accounts"
And there should be an explanation of the accounts functionality.
And I should see the "Skip Tutorial" button
When I tap on "Got it" button
Then the tutorial modal heading should read "Edit Account Name"
And there should be an explanation about adding a nickname to your account.
And I should see the "Skip Tutorial" button
When I tap and hold on the account Name
Then I should be able to edit the account Name
When I enter "Big Bank" for account name
Then the account nickname should read "Big Bank"
When I tap on "Got it" button
Then the tutorial modal heading should read "Main Navigation"
And there should be an explanation of the what exists within the burger menu.
And I should see the "Skip Tutorial" button
When I tap on "Got it" button
Then the tutorial modal heading should read "Explore the Browser"
And there should be an explanation of the what the purpose of the browser.
And I should see the "Skip Tutorial" button
When I tap on "Back" button
Then the tutorial modal heading should read "Main Navigation"
And there should be an explanation of the what exists within the burger menu.
And I should see the "Skip Tutorial" button
When I tap on "Got it" button
Then the tutorial modal heading should read "Explore the Browser"
And there should be an explanation of the what the purpose of the browser.
And I should see the "Skip Tutorial" button
When I tap on "Got it" button
Then the tutorial modal heading should read "Search"
And there should be an explanation of the what the purpose of the search input box.
And I should see the "Skip Tutorial" button
When I tap on "Got it" button
Then the onboarding wizard is no longer visible
And the "Skip" button is no longer visible
13 changes: 11 additions & 2 deletions wdio/features/helpers/Gestures.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const Actions = {
RELEASE: 'release',
};

class Gestures {
class Gestures {
static async waitAndTap(element) {
const elem = await element;
await elem.waitForDisplayed();
Expand Down Expand Up @@ -112,6 +112,15 @@ class Gestures {
}
}

static async longPress(element, waitTime) {
const elem = await element;
(await elem).touchAction([
Actions.PRESS,
{action: Actions.WAIT, ms: waitTime},
Actions.RELEASE
])
}

static async typeText(element, text) {
const elem = await element;
await elem.waitForDisplayed();
Expand Down Expand Up @@ -205,7 +214,7 @@ class Gestures {
const endPercentage = 0;
const anchorPercentage = 50;

const { width, height } = await driver.getWindowSize();
const {width, height} = await driver.getWindowSize();
const anchor = height * anchorPercentage / 100;
const startPoint = width * startPercentage / 100;
const endPoint = width * endPercentage / 100;
Expand Down
6 changes: 5 additions & 1 deletion wdio/features/helpers/Selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@ class Selectors {
return await element;
}

static async getXpathElementByContentDecscription(text) {
static async getXpathElementByContentDescription(text) {
const element = await $(`//android.view.ViewGroup[@content-desc='${text}']`);
return await element;
}

static async getXpathElementByResourceId(text) {
return await $(`//*[@resource-id='${text}']`);
}
}

export default Selectors;
141 changes: 133 additions & 8 deletions wdio/features/screen-objects/Modals/OnboardingWizardModal.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,152 @@
import { ONBOARDING_WIZARD_STEP_1_CONTAINER_ID,
ONBOARDING_WIZARD_STEP_1_NO_THANKS_ID } from '../../testIDs/Components/OnboardingWizard.testIds';

import Selectors from '../../helpers/Selectors';
import Gestures from '../../helpers/Gestures';
import {
ONBOARDING_WIZARD_STEP_1_CONTAINER_ID,
ONBOARDING_WIZARD_STEP_1_NO_THANKS_ID,
ONBOARDING_WIZARD_STEP_1_TAKE_THE_TOUR_ID,
ONBOARDING_WIZARD_YOUR_ACCOUNTS_DESC_1,
ONBOARDING_WIZARD_YOUR_ACCOUNTS_DESC_2,
ONBOARDING_WIZARD_BACK_BUTTON,
ONBOARDING_WIZARD_NEXT_GOT_IT_BUTTON,
ONBOARDING_WIZARD_SKIP_TUTORIAL_BUTTON,
ONBOARDING_WIZARD_EDIT_ACCOUNTS_NAME_DESC_1,
ONBOARDING_WIZARD_EDIT_ACCOUNTS_NAME_DESC_2,
ONBOARDING_WIZARD_MAIN_NAVIGATION_DESC_1,
ONBOARDING_WIZARD_MAIN_NAVIGATION_DESC_2,
ONBOARDING_WIZARD_EXPLORE_BROWSER_DESC,
ONBOARDING_WIZARD_SEARCH_DESC
} from '../../testIDs/Components/OnboardingWizard.testIds';

import Selectors from '../../helpers/Selectors';
import Gestures from '../../helpers/Gestures';

class OnboardingWizardModal {

get onBoardingWizardContainer() {
return Selectors.getElementByPlatform(ONBOARDING_WIZARD_STEP_1_CONTAINER_ID);
}

get onBoardingWizardBackButton() {
get onBoardingWizardNoThanksButton() {
return Selectors.getElementByPlatform(ONBOARDING_WIZARD_STEP_1_NO_THANKS_ID);
}

async isVisible(){
get onBoardingWizardBackButton() {
return Selectors.getXpathElementByText(ONBOARDING_WIZARD_BACK_BUTTON)
}

get onBoardingWizardTakeTourButton() {
return Selectors.getElementByPlatform(ONBOARDING_WIZARD_STEP_1_TAKE_THE_TOUR_ID);
}

get onBoardingWizardYourAccountDesc1() {
return Selectors.getXpathElementByText(ONBOARDING_WIZARD_YOUR_ACCOUNTS_DESC_1);
}

get onBoardingWizardYourAccountDesc2() {
return Selectors.getXpathElementByText(ONBOARDING_WIZARD_YOUR_ACCOUNTS_DESC_2);
}

get onBoardingWizardSkipTutorialButton() {
return Selectors.getXpathElementByText(ONBOARDING_WIZARD_SKIP_TUTORIAL_BUTTON);
}

get onBoardingWizardGotItButton() {
return Selectors.getXpathElementByText(ONBOARDING_WIZARD_NEXT_GOT_IT_BUTTON);
}

get onBoardingWizardEditAccountNameDesc1() {
return Selectors.getXpathElementByText(ONBOARDING_WIZARD_EDIT_ACCOUNTS_NAME_DESC_1);
}

get onBoardingWizardEditAccountNameDesc2() {
return Selectors.getXpathElementByText(ONBOARDING_WIZARD_EDIT_ACCOUNTS_NAME_DESC_2);
}

get onBoardingWizardMainNavDesc1() {
return Selectors.getXpathElementByText(ONBOARDING_WIZARD_MAIN_NAVIGATION_DESC_1);
}

get onBoardingWizardMainNavDesc2() {
return Selectors.getXpathElementByText(ONBOARDING_WIZARD_MAIN_NAVIGATION_DESC_2);
}

get onBoardingWizardExploreBrowserDesc() {
return Selectors.getXpathElementByText(ONBOARDING_WIZARD_EXPLORE_BROWSER_DESC);
}

get onBoardingWizardSearchDesc() {
return Selectors.getXpathElementByText(ONBOARDING_WIZARD_SEARCH_DESC);
}

async isVisible() {
await expect(this.onBoardingWizardContainer).toBeDisplayed();
}

async clickBackButton(){
async tapNoThanksButton() {
await Gestures.tap(this.onBoardingWizardNoThanksButton);
}

async tapTakeTourButton() {
await Gestures.tap(this.onBoardingWizardTakeTourButton);
}

async isHeaderDisplayedByXPath(text) {
await expect(await (Selectors.getXpathElementByText(text))).toBeDisplayed();
}

async isYourAccountDesc1Displayed() {
await expect(this.onBoardingWizardYourAccountDesc1).toBeDisplayed();
}

async isYourAccountDesc2Displayed() {
await expect(this.onBoardingWizardYourAccountDesc2).toBeDisplayed();
}

async isSkipTutorialButtonDisplayed() {
await expect(this.onBoardingWizardSkipTutorialButton).toBeDisplayed();
}

async isSkipTutorialButtonNotDisplayed() {
await expect(this.onBoardingWizardSkipTutorialButton).not.toBeDisplayed();
}

async tapSkipTutorialButton() {
await Gestures.tap(this.onBoardingWizardSkipTutorialButton);
}

async tapGotItButton() {
await Gestures.tap(this.onBoardingWizardGotItButton);
}

async isGotItButtonNotDisplayed() {
await expect(this.onBoardingWizardGotItButton).not.toBeDisplayed();
}

async tapBackButton() {
await Gestures.tap(this.onBoardingWizardBackButton);
}

async isEditAccountNameDesc1Displayed() {
await expect(this.onBoardingWizardEditAccountNameDesc1).toBeDisplayed();
}

async isEditAccountNameDesc2Displayed() {
await expect(this.onBoardingWizardEditAccountNameDesc2).toBeDisplayed();
}

async isMainNavDesc1Displayed() {
await expect(this.onBoardingWizardMainNavDesc1).toBeDisplayed();
}

async isMainNavDesc2Displayed() {
await expect(this.onBoardingWizardMainNavDesc2).toBeDisplayed();
}

async isExploreBrowserDescDisplayed() {
await expect(this.onBoardingWizardExploreBrowserDesc).toBeDisplayed();
}

async isSearchDescDisplayed() {
await expect(this.onBoardingWizardSearchDesc).toBeDisplayed();
}
}

export default new OnboardingWizardModal();
38 changes: 38 additions & 0 deletions wdio/features/screen-objects/Modals/WalletAccountModal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import {
WALLET_ACCOUNT_NAME_LABEL_TEXT,
WALLET_ACCOUNT_NAME_LABEL_INPUT,
WALLET_ACCOUNT_ICON
} from '../../testIDs/Screens/WalletAccount.testIds'

import Selectors from '../../helpers/Selectors';
import Gestures from '../../helpers/Gestures';

class WalletAccountModal {
get accountNameLabelText() {
return Selectors.getXpathElementByResourceId(WALLET_ACCOUNT_NAME_LABEL_TEXT);
}

get accountNameLabelInput() {
return Selectors.getXpathElementByResourceId(WALLET_ACCOUNT_NAME_LABEL_INPUT);
}

async longPressAccountNameLabel() {
await Gestures.longPress(this.accountNameLabelText, 1000);
}

async isAccountNameLabelEditable() {
await expect(this.accountNameLabelInput).toBeDisplayed();
}

async editAccountNameLabel(text) {
await Gestures.typeText(this.accountNameLabelInput, text);
}

async isAccountNameLabelEqualTo(expected) {
const textFromElement = await this.accountNameLabelInput;
const accountName = await textFromElement.getText();
await expect(accountName).toContain(expected);
}
}

export default new WalletAccountModal();
2 changes: 1 addition & 1 deletion wdio/features/step-definitions/network-flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Given(/^I import wallet using seed phrase "([^"]*)?"/, async (phrase) => {

Given(/^I tap No thanks on the onboarding welcome tutorial/, async () => {
await OnboardingWizardModal.isVisible();
await OnboardingWizardModal.clickBackButton();
await OnboardingWizardModal.tapNoThanksButton();
});

Then(/^I tap on the navbar network title button/, async () => {
Expand Down
Loading

0 comments on commit e29a423

Please sign in to comment.