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

TW-812: create or restore account with edited name positive #927

Merged
1 change: 1 addition & 0 deletions e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"start": "./node_modules/.bin/cucumber-js --fail-fast",
"start:dev": "yarn start --tags @dev",
"start:remove_account": "yarn start --tags @remove_account",
"start:create_account": "yarn start --tags @create_account",
"test": "yarn start --exit --tags 'not @dev'",
"ts": "tsc --pretty"
},
Expand Down
35 changes: 33 additions & 2 deletions e2e/src/features/create-or-restore-an-account.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Feature: Create or restore an account

Scenario: As a user, I'd like to create or restore an account
@create_account
Scenario: [Positive] As a user, I'd like to create or restore an account
Given I have imported an existing account

And I press Account Icon on the Header page
Expand All @@ -15,3 +15,34 @@ Feature: Create or restore an account
Then I reveal a private key and compare with defaultSecondPrivateKey



@create_account
Scenario: [Negative] As a user, I'd like to create or restore an account with edited name + validation errors
Given I have imported an existing account

# create an account with edited name
And I press Account Icon on the Header page
And I am on the AccountsDropdown page

And I press Create Or Restore Account Button on the Account Drop-down page
And I am on the CreateOrRestoreAnAccount page

And I clear Account Name Input value on the Create Account page
And I enter shortRandomContent into Account Name Input on the Create Account page
And I press Create Or Restore Button on the Create Account page

And I am on the Home page
And I check if shortRandomContent is edited name for created account

# check validation error
And I press Account Icon on the Header page
And I am on the AccountsDropdown page

And I press Create Or Restore Account Button on the Account Drop-down page
And I am on the CreateOrRestoreAnAccount page

And I clear Account Name Input value on the Create Account page
And I enter longRandomContent into Account Name Input on the Create Account page
And I press Create Or Restore Button on the Create Account page

Then I got the 'Invalid name. It should be: 1-16 characters, without special' error with Input Error element on the Universal Component page
2 changes: 1 addition & 1 deletion e2e/src/features/remove-account.feature
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ Feature: Remove an account
And I press Remove Button on the Remove Account page
And I got the 'Required' error with Input Error element on the Universal Component page

And I enter randomContent into Password Input on the Remove Account page
And I enter shortRandomContent into Password Input on the Remove Account page
And I press Remove Button on the Remove Account page
And I got the 'Invalid password' error with Input Error element on the Universal Component page

2 changes: 2 additions & 0 deletions e2e/src/page-objects/pages/home.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export class HomePage extends Page {
ActivityTab = createPageElement(HomeSelectors.activityTab);
CollectiblesTab = createPageElement(HomeSelectors.collectiblesTab);
PublicAddressButton = createPageElement(HomeSelectors.publicAddressButton);
accountNameText = createPageElement(HomeSelectors.accountNameText);

async isVisible() {
await this.ReceiveButton.waitForDisplayed();
Expand All @@ -24,5 +25,6 @@ export class HomePage extends Page {
await this.ActivityTab.waitForDisplayed();
await this.CollectiblesTab.waitForDisplayed();
await this.PublicAddressButton.waitForDisplayed();
await this.accountNameText.waitForDisplayed();
}
}
17 changes: 17 additions & 0 deletions e2e/src/step-definitions/create-or-restore-account.steps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Given } from '@cucumber/cucumber';
import { expect } from 'chai';

import { iEnterValues } from 'e2e/src/utils/input-data.utils';
import { MEDIUM_TIMEOUT } from 'e2e/src/utils/timing.utils';

import { Pages } from '../page-objects';

Given(
/I check if (.*) is edited name for created account/,
{ timeout: MEDIUM_TIMEOUT },
async (editedName: keyof typeof iEnterValues) => {
const nameOfCreatedAccount = await Pages.Home.accountNameText.getText();

expect(nameOfCreatedAccount).eql(iEnterValues[editedName]);
}
);
2 changes: 0 additions & 2 deletions e2e/src/step-definitions/swap.steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import { iSelectTokenSlugs } from 'e2e/src/utils/input-data.utils';
import { createPageElement } from 'e2e/src/utils/search.utils';
import { MEDIUM_TIMEOUT, VERY_LONG_TIMEOUT } from 'e2e/src/utils/timing.utils';

import { BrowserContext } from '../classes/browser-context.class';

Given(
/I select (.*) token in the token drop-down list on the Swap page/,
{ timeout: VERY_LONG_TIMEOUT },
Expand Down
3 changes: 2 additions & 1 deletion e2e/src/utils/input-data.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export const iEnterValues = {
defaultPassword: envVars.DEFAULT_PASSWORD,
watchOnlyPublicKey: envVars.WATCH_ONLY_PUBLIC_KEY_HASH,
bakerAddress: '',
randomContent: generateRandomContent(),
shortRandomContent: generateRandomContent(),
longRandomContent: 'long random content for test + ' + generateRandomContent(),

// For transactions
amount_0_0001: '0.0001',
Expand Down
3 changes: 2 additions & 1 deletion src/app/pages/Home/Home.selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ export enum HomeSelectors {
fiatTezSwitchButton = 'Home/Fiat-Tez Switch Button',
notificationIconButton = 'Home/Notification Icon Button',
delegateButton = 'Home/Delegate Button',
addressModeSwitchButton = 'Home/Address Mode Switch Button'
addressModeSwitchButton = 'Home/Address Mode Switch Button',
accountNameText = 'Home/Account Name Text'
}
7 changes: 6 additions & 1 deletion src/app/pages/Home/OtherComponents/EditableTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { T, t } from 'lib/i18n';
import { useTempleClient, useAccount } from 'lib/temple/front';
import { useAlert } from 'lib/ui/dialog';

import { HomeSelectors } from '../Home.selectors';
import { EditableTitleSelectors } from './EditableTitle.selectors';

const buttonClassNames = [
Expand Down Expand Up @@ -138,7 +139,11 @@ const EditableTitle: FC = () => {
</form>
) : (
<>
<Name className="pl-1 text-gray-700 text-center text-gray-910" style={{ maxWidth: '24rem', fontSize: 23 }}>
<Name
className="pl-1 text-gray-700 text-center text-gray-910"
style={{ maxWidth: '24rem', fontSize: 23 }}
testID={HomeSelectors.accountNameText}
>
{account.name}
</Name>

Expand Down
Loading