Skip to content

Commit

Permalink
Added PrivateKeyCheckSend.e2e.ts and styling (multiversx#25)
Browse files Browse the repository at this point in the history
* Added PrivateKeyCheckSend.e2e.ts

* Revert setupPuppeteerTests.ts

* Login modals styling

* Fixed tests

* Fixed logout error
  • Loading branch information
razvantomegea authored Jun 21, 2024
1 parent a40095a commit fed0bcd
Show file tree
Hide file tree
Showing 14 changed files with 230 additions and 118 deletions.
2 changes: 1 addition & 1 deletion jest-puppeteer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const config = {
modulePaths: ['<rootDir>/src'],
bail: 1,
workerIdleMemoryLimit: '512MB', // Memory used per worker. Required to prevent memory leaks
maxWorkers: '65%', // Maximum tests ran in parallel. Required to prevent CPU usage at 100%
maxWorkers: '50%', // Maximum tests ran in parallel. Required to prevent CPU usage at 100%
launch: {
headless: isHeadless,
product: 'chrome',
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ module.exports = {
moduleDirectories: ['node_modules', 'src'],
bail: 1,
workerIdleMemoryLimit: '512MB', // Memory used per worker. Required to prevent memory leaks
maxWorkers: '40%', // Maximum tests ran in parallel. Required to prevent CPU usage at 100%
maxWorkers: '50%', // Maximum tests ran in parallel. Required to prevent CPU usage at 100%
resetMocks: false
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const MissingNativeAuthError = () => (
NOT
</span>
be displayed because
<span className='ml-1 mr-1 inline-block px-2 py-1 text-sm font-semibold leading-none bg-blue-500 text-white rounded'>
<span className='ml-1 mr-1 inline-block px-2 py-1 text-sm font-semibold leading-none bg-blue-600 text-white rounded'>
nativeAuth
</span>
is not active
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/app/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ export const provider: IDappProvider = {
return Boolean(address);
},
login: notInitializedError('login'),
logout: () => {
logout: async () => {
// eslint-disable-next-line
const storeObject = require('redux/store');
const storeObject = await import('redux/store');
const store: typeof reduxStore = storeObject.store;
store.dispatch(
setKeystoreLogin({
Expand Down
6 changes: 3 additions & 3 deletions src/pages/Dashboard/widgets/Account/Account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,19 @@ export const Account = () => {
<a
href={`${explorerAddress}/accounts/${address}`}
target='_blank'
className='inline-block rounded-lg bg-blue-500 px-4 py-2 text-sm text-white'
className='inline-block rounded-lg bg-blue-600 px-4 py-2 text-sm text-white'
>
Open in Explorer
</a>
<MxLink
className='inline-block rounded-lg bg-blue-500 px-4 py-2 text-sm text-white'
className='inline-block rounded-lg bg-blue-600 px-4 py-2 text-sm text-white'
data-testid={DataTestIdsEnum.sendBtn}
to={routeNames.send}
>
Send
</MxLink>
<MxLink
className='inline-block rounded-lg bg-blue-500 px-4 py-2 text-sm text-white'
className='inline-block rounded-lg bg-blue-600 px-4 py-2 text-sm text-white'
data-testid={DataTestIdsEnum.sendBtn}
to={routeNames.signMessage}
>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Dashboard/widgets/NFTs/components/NFTRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const NFTRow = ({ nft }: { nft: PartialNftType }) => {
<div className='flex items-center justify-between mt-1'>
<div className='text-xs text-gray-400'>{nft.collection}</div>
<button
className='text-white rounded bg-blue-500 px-2 py-1'
className='text-white rounded bg-blue-600 px-2 py-1'
data-testid={`send-${nft.identifier}`}
onClick={handleSend}
>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Dashboard/widgets/Tokens/components/TokenRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const TokenRow = ({ token }: { token: TokenType }) => {
</div>
)}
<button
className='text-white rounded bg-blue-500 px-2 py-1'
className='text-white rounded bg-blue-600 px-2 py-1'
data-testid={`send-${token.identifier}`}
onClick={handleSend}
>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Send/Send.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ export const Send = () => {
</div>
<div className='mt-4 flex flex-col align-middle'>
<Button
className='mt-4 mx-auto rounded-lg bg-blue-500 px-4 py-2 text-sm text-white'
className='mt-4 mx-auto rounded-lg bg-blue-600 px-4 py-2 text-sm text-white'
data-testid={DataTestIdsEnum.sendBtn}
type='submit'
>
Expand Down
30 changes: 30 additions & 0 deletions src/pages/Send/tests/PrivateKeyCheckSend.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { WALLET_SOURCE_ORIGIN } from '__mocks__';
import { DataTestIdsEnum } from 'localConstants/dataTestIds.enum';
import {
changeInputText,
getByDataTestId,
loginWithKeystore
} from 'utils/testUtils/puppeteer';

describe('Send NFT tests', () => {
it('should send NFT successfully', async () => {
await page.goto(`${WALLET_SOURCE_ORIGIN}/logout`, {
waitUntil: 'domcontentloaded'
});

await loginWithKeystore();
await page.waitForSelector(getByDataTestId(DataTestIdsEnum.sendBtn));
await page.click(getByDataTestId(DataTestIdsEnum.sendBtn));
expect(page.url()).toMatch(`${WALLET_SOURCE_ORIGIN}/send`);
await page.reload({
waitUntil: 'domcontentloaded'
});

await changeInputText({
dataTestId: DataTestIdsEnum.accessPass,
text: 'P@ssw0rd123'
});

await page.click(getByDataTestId(DataTestIdsEnum.submitButton));
});
});
6 changes: 3 additions & 3 deletions src/pages/SignMessage/SignMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const SignMessage = () => {
placeholder='Write message here'
disabled={isSignMessageHook}
value={message}
className='resize-none w-full h-32 rounded-lg focus:outline-none focus:border-blue-500'
className='resize-none w-full h-32 rounded-lg focus:outline-none focus:border-blue-600'
onChange={(event) => setMessage(event.currentTarget.value)}
/>
)}
Expand All @@ -120,7 +120,7 @@ export const SignMessage = () => {
{isSuccess || isError ? (
<Button
data-testid={DataTestIdsEnum.cancelSignMessageBtn}
className='mx-auto rounded-lg bg-blue-500 px-4 py-2 text-sm text-white'
className='mx-auto rounded-lg bg-blue-600 px-4 py-2 text-sm text-white'
id='closeButton'
onClick={handleSignMessageCloseFlow}
>
Expand All @@ -132,7 +132,7 @@ export const SignMessage = () => {
</Button>
) : (
<Button
className='mx-auto rounded-lg bg-blue-500 px-4 py-2 text-sm text-white'
className='mx-auto rounded-lg bg-blue-600 px-4 py-2 text-sm text-white'
data-testid={DataTestIdsEnum.signMessageBtn}
onClick={handleSubmit}
>
Expand Down
Loading

0 comments on commit fed0bcd

Please sign in to comment.