Skip to content

Commit eb0ceff

Browse files
authored
test(extension): fix paper wallet tests after recent UI toolkit update [LW-12796] (#1866)
* test(extension): fix paper wallet tests after recent UI toolkit update * test(extension): update unit tests for text area * test(extension): fix tests for message signing
1 parent 13359ca commit eb0ceff

File tree

6 files changed

+19
-18
lines changed

6 files changed

+19
-18
lines changed

apps/browser-extension-wallet/src/views/browser-view/features/sign-message/SignMessageDrawer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export const SignMessageDrawer: React.FC = () => {
146146
placeholder={t('core.signMessage.messagePlaceholder')}
147147
value={message}
148148
onChange={(e) => setMessage(e.target.value)}
149-
dataTestId="sign-message-input"
149+
dataTestId="sign-message"
150150
rows={4}
151151
className={styles.customTextArea}
152152
/>

packages/common/src/ui/components/Form/TextArea/TextArea.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ export const TextArea = ({
5858
return (
5959
<div className={cn(styles.wrapper, wrapperClassName)}>
6060
{label && (
61-
<span className={cn('text-area-label', styles.label, { [styles.focused]: isFocused || localVal })}>
61+
<span
62+
className={cn('text-area-label', styles.label, { [styles.focused]: isFocused || localVal })}
63+
data-testid={dataTestId ? `${dataTestId}-label` : 'text-area-label'}
64+
>
6265
{label}
6366
</span>
6467
)}
@@ -72,7 +75,7 @@ export const TextArea = ({
7275
}
7376
}}
7477
onChange={onValChange}
75-
data-testid={dataTestId}
78+
data-testid={dataTestId ? `${dataTestId}-input` : 'text-area-input'}
7679
value={localVal}
7780
autoSize
7881
rows={props.rows ?? 1}

packages/common/src/ui/components/Form/TextArea/__tests__/TextArea.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import { act } from 'react-dom/test-utils';
77
describe('TextArea', () => {
88
test('initial value is an empty string', () => {
99
const { queryByTestId } = render(<TextArea dataTestId="text-area-test" />);
10-
expect(queryByTestId('text-area-test')).toHaveValue('');
10+
expect(queryByTestId('text-area-test-input')).toHaveValue('');
1111
});
1212
test('on input change value is updated and onChange function prop is called', () => {
1313
const onChange = jest.fn();
1414
const { queryByTestId } = render(<TextArea dataTestId="text-area-test" onChange={onChange} />);
15-
const area = queryByTestId('text-area-test');
15+
const area = queryByTestId('text-area-test-input');
1616
expect(area).toHaveValue('');
1717
act(() => {
1818
area && fireEvent.change(area, { target: { value: 'new value' } });
@@ -24,7 +24,7 @@ describe('TextArea', () => {
2424
const onBlur = jest.fn();
2525
const { queryByTestId } = render(<TextArea dataTestId="text-area-test" onBlur={onBlur} />);
2626
await waitFor(() => {
27-
const area = queryByTestId('text-area-test');
27+
const area = queryByTestId('text-area-test-input');
2828
area && fireEvent.blur(area);
2929
});
3030
expect(onBlur).toHaveBeenCalled();

packages/e2e-tests/src/elements/onboarding/SecureYourPaperWalletPage.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ import clipboard from 'clipboardy';
77
import testContext from '../../utils/testContext';
88

99
class SecureYourPaperWalletPage extends CommonOnboardingElements {
10-
// TODO: update selectors when new lace-ui-toolkit package is released
11-
private PGP_KEY_NAME_INPUT = '[data-testid="pgp-public-key-reference"]';
12-
private PGP_KEY_NAME_INPUT_LABEL = '//form//label';
13-
private YOUR_PUBLIC_PGP_KEY_BLOCK_INPUT = '[data-testid="pgp-public-key-block"]';
14-
private YOUR_PUBLIC_PGP_KEY_BLOCK_INPUT_LABEL = '//span[contains(@class, "text-area-label")]';
10+
private PGP_KEY_NAME_INPUT = '[data-testid="pgp-public-key-reference-input"]';
11+
private PGP_KEY_NAME_INPUT_LABEL = '[data-testid="pgp-public-key-reference-label"]';
12+
private YOUR_PUBLIC_PGP_KEY_BLOCK_INPUT = '[data-testid="pgp-public-key-block-input"]';
13+
private YOUR_PUBLIC_PGP_KEY_BLOCK_INPUT_LABEL = '[data-testid="pgp-public-key-block-label"]';
1514
private FINGERPRINT_ICON = '[data-testid="fingerprint-icon"]';
1615
private FINGERPRINT_TEXT = '[data-testid="fingerprint-text"]';
1716
private VALIDATION_ERROR = '[data-testid="validation-error"]';

packages/e2e-tests/src/elements/settings/MessageSigningAllDoneDrawer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import type { ChainablePromiseElement } from 'webdriverio';
55
class MessageSigningAllDoneDrawer extends CommonDrawerElements {
66
private IMAGE = '[data-testid="result-message-img"]';
77
private TITLE = '[data-testid="result-message-title"]';
8-
private SIGNATURE = '[data-testid="sign-message-signature"]';
8+
private SIGNATURE = '[data-testid="sign-message-signature-input"]';
99
private SIGNATURE_LABEL = '[data-testid="result-message-signature-label"]';
1010
private SIGNATURE_COPY_TO_CLIPBOARD_BUTTON = '[data-testid="signature-copy-to-clipboard-button"]';
11-
private KEY = '[data-testid="sign-message-key"]';
11+
private KEY = '[data-testid="sign-message-key-input"]';
1212
private KEY_LABEL = '[data-testid="result-message-key-label"]';
1313
private KEY_COPY_TO_CLIPBOARD_BUTTON = '[data-testid="public-key-copy-to-clipboard-button"]';
1414
private SIGN_ANOTHER_MESSAGE_BUTTON = '[data-testid="sign-another-message-button"]';

packages/e2e-tests/src/elements/settings/SecureYourPaperWalletDrawer.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ import CommonDrawerElements from '../CommonDrawerElements';
33
import type { ChainablePromiseElement } from 'webdriverio';
44

55
class SecureYourPaperWalletDrawer extends CommonDrawerElements {
6-
// TODO: update selectors when new lace-ui-toolkit package is released
7-
private PGP_KEY_NAME_INPUT = '[data-testid="pgp-public-key-reference"]';
8-
private PGP_KEY_NAME_INPUT_LABEL = '//form//label';
9-
private YOUR_PUBLIC_PGP_KEY_BLOCK_INPUT = '[data-testid="pgp-public-key-block"]';
10-
private YOUR_PUBLIC_PGP_KEY_BLOCK_INPUT_LABEL = '//span[contains(@class, "text-area-label")]';
6+
private PGP_KEY_NAME_INPUT = '[data-testid="pgp-public-key-reference-input"]';
7+
private PGP_KEY_NAME_INPUT_LABEL = '[data-testid="pgp-public-key-reference-label"]';
8+
private YOUR_PUBLIC_PGP_KEY_BLOCK_INPUT = '[data-testid="pgp-public-key-block-input"]';
9+
private YOUR_PUBLIC_PGP_KEY_BLOCK_INPUT_LABEL = '[data-testid="pgp-public-key-block-label"]';
1110
private NEXT_BUTTON = '[data-testid="next-button"]';
1211

1312
get pgpKeyNameInput(): ChainablePromiseElement<WebdriverIO.Element> {

0 commit comments

Comments
 (0)