parent
2f391cde5b
commit
e883ef5c5e
@ -61,7 +61,7 @@ context(
|
|||||||
// 3002-PROP-007
|
// 3002-PROP-007
|
||||||
cy.get(newProposalDescription).type('E2E test for proposals');
|
cy.get(newProposalDescription).type('E2E test for proposals');
|
||||||
|
|
||||||
cy.get(proposalParameterSelect).find('option').should('have.length', 115);
|
cy.get(proposalParameterSelect).find('option').should('have.length', 116);
|
||||||
cy.get(proposalParameterSelect).select(
|
cy.get(proposalParameterSelect).select(
|
||||||
// 3007-PNEC-002
|
// 3007-PNEC-002
|
||||||
'governance_proposal_asset_minEnact'
|
'governance_proposal_asset_minEnact'
|
||||||
|
@ -93,6 +93,7 @@ context(
|
|||||||
.contains(2.0, epochTimeout)
|
.contains(2.0, epochTimeout)
|
||||||
.should('be.visible');
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.close_staking_dialog();
|
||||||
cy.navigate_to('validators');
|
cy.navigate_to('validators');
|
||||||
|
|
||||||
// 2002-SINC-007
|
// 2002-SINC-007
|
||||||
@ -145,6 +146,7 @@ context(
|
|||||||
.contains(2.0, epochTimeout)
|
.contains(2.0, epochTimeout)
|
||||||
.should('be.visible');
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.close_staking_dialog();
|
||||||
cy.navigate_to('validators');
|
cy.navigate_to('validators');
|
||||||
|
|
||||||
cy.validate_validator_list_total_stake_and_share(
|
cy.validate_validator_list_total_stake_and_share(
|
||||||
@ -209,6 +211,7 @@ context(
|
|||||||
.contains(6.0, epochTimeout)
|
.contains(6.0, epochTimeout)
|
||||||
.should('be.visible');
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.close_staking_dialog();
|
||||||
cy.navigate_to('validators');
|
cy.navigate_to('validators');
|
||||||
|
|
||||||
cy.validate_validator_list_total_stake_and_share(
|
cy.validate_validator_list_total_stake_and_share(
|
||||||
@ -243,6 +246,7 @@ context(
|
|||||||
.parent()
|
.parent()
|
||||||
.should('contain', 2.0, txTimeout);
|
.should('contain', 2.0, txTimeout);
|
||||||
|
|
||||||
|
cy.close_staking_dialog();
|
||||||
cy.navigate_to('validators');
|
cy.navigate_to('validators');
|
||||||
|
|
||||||
cy.click_on_validator_from_list(1);
|
cy.click_on_validator_from_list(1);
|
||||||
@ -264,6 +268,7 @@ context(
|
|||||||
.eq(1)
|
.eq(1)
|
||||||
.should('contain', 1.0, txTimeout);
|
.should('contain', 1.0, txTimeout);
|
||||||
|
|
||||||
|
cy.close_staking_dialog();
|
||||||
cy.navigate_to('validators');
|
cy.navigate_to('validators');
|
||||||
|
|
||||||
cy.get(`[row-id="${0}"]`).within(() => {
|
cy.get(`[row-id="${0}"]`).within(() => {
|
||||||
@ -323,6 +328,7 @@ context(
|
|||||||
txTimeout
|
txTimeout
|
||||||
);
|
);
|
||||||
|
|
||||||
|
cy.close_staking_dialog();
|
||||||
cy.navigate_to('validators');
|
cy.navigate_to('validators');
|
||||||
// 2001-STKE-040
|
// 2001-STKE-040
|
||||||
cy.click_on_validator_from_list(0);
|
cy.click_on_validator_from_list(0);
|
||||||
@ -388,6 +394,7 @@ context(
|
|||||||
txTimeout
|
txTimeout
|
||||||
);
|
);
|
||||||
|
|
||||||
|
cy.close_staking_dialog();
|
||||||
cy.navigate_to('validators');
|
cy.navigate_to('validators');
|
||||||
|
|
||||||
cy.click_on_validator_from_list('0');
|
cy.click_on_validator_from_list('0');
|
||||||
@ -447,6 +454,7 @@ context(
|
|||||||
txTimeout
|
txTimeout
|
||||||
);
|
);
|
||||||
|
|
||||||
|
cy.close_staking_dialog();
|
||||||
cy.navigate_to('validators');
|
cy.navigate_to('validators');
|
||||||
|
|
||||||
cy.click_on_validator_from_list(0);
|
cy.click_on_validator_from_list(0);
|
||||||
@ -488,6 +496,7 @@ context(
|
|||||||
txTimeout
|
txTimeout
|
||||||
);
|
);
|
||||||
|
|
||||||
|
cy.close_staking_dialog();
|
||||||
cy.navigate_to('validators');
|
cy.navigate_to('validators');
|
||||||
|
|
||||||
cy.click_on_validator_from_list(0);
|
cy.click_on_validator_from_list(0);
|
||||||
|
@ -170,6 +170,27 @@ context(
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Unable to withdraw asset on pub key view', function () {
|
||||||
|
const vegaWalletPubKey = Cypress.env('vegaWalletPublicKey');
|
||||||
|
const expectedErrorTxt = `You are connected in a view only state for public key: ${vegaWalletPubKey}. In order to send transactions you must connect to a real wallet.`;
|
||||||
|
|
||||||
|
// Disconnect vega wallet
|
||||||
|
cy.getByTestId('manage-vega-wallet').click();
|
||||||
|
cy.getByTestId('disconnect').click();
|
||||||
|
|
||||||
|
cy.connectPublicKey(vegaWalletPubKey);
|
||||||
|
cy.getByTestId(withdraw).should('be.visible').click();
|
||||||
|
cy.getByTestId(selectAsset).select(usdtName);
|
||||||
|
cy.getByTestId(balanceAvailable, txTimeout).should('exist');
|
||||||
|
cy.getByTestId(amountInput).click().type('100');
|
||||||
|
cy.getByTestId(submitWithdrawalButton).click();
|
||||||
|
|
||||||
|
cy.getByTestId('dialog-content').within(() => {
|
||||||
|
cy.get('h1').should('have.text', 'Transaction failed');
|
||||||
|
cy.getByTestId('Error').should('have.text', expectedErrorTxt);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
function waitForAssetsDisplayed(expectedAsset) {
|
function waitForAssetsDisplayed(expectedAsset) {
|
||||||
cy.contains(expectedAsset, txTimeout).should('be.visible');
|
cy.contains(expectedAsset, txTimeout).should('be.visible');
|
||||||
}
|
}
|
||||||
|
62
apps/token-e2e/src/integration/view/pubkey-view.cy.js
Normal file
62
apps/token-e2e/src/integration/view/pubkey-view.cy.js
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
/// <reference types="cypress" />
|
||||||
|
const vegaWalletPubKey = Cypress.env('vegaWalletPublicKey2');
|
||||||
|
const vegaPubkeyTruncated = Cypress.env('vegaWalletPublicKey2Short');
|
||||||
|
const banner = 'view-banner';
|
||||||
|
|
||||||
|
context('View functionality with public key', { tags: '@smoke' }, function () {
|
||||||
|
before('send asset to wallet', function () {
|
||||||
|
cy.vega_wallet_faucet_assets_without_check(
|
||||||
|
'fUSDC',
|
||||||
|
'1000000',
|
||||||
|
vegaWalletPubKey
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach('visit home page', function () {
|
||||||
|
cy.visit('/');
|
||||||
|
cy.wait_for_spinner();
|
||||||
|
cy.connectPublicKey(vegaWalletPubKey);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Able to connect public key via wallet', function () {
|
||||||
|
verifyConnectedToPubKey();
|
||||||
|
cy.getByTestId('currency-title').should('contain.text', 'USDC (fake)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Able to connect public key using url', function () {
|
||||||
|
cy.getByTestId('exit-view').click();
|
||||||
|
cy.visit(`/?address=${vegaWalletPubKey}`);
|
||||||
|
verifyConnectedToPubKey();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Unable to submit proposal with public key', function () {
|
||||||
|
const expectedErrorTxt = `You are connected in a view only state for public key: ${vegaWalletPubKey}. In order to send transactions you must connect to a real wallet.`;
|
||||||
|
|
||||||
|
cy.navigate_to('proposals');
|
||||||
|
cy.go_to_make_new_proposal('Freeform');
|
||||||
|
cy.enter_unique_freeform_proposal_body('50', 'pub key proposal test');
|
||||||
|
cy.getByTestId('proposal-submit').should('be.visible').click();
|
||||||
|
cy.getByTestId('dialog-content').within(() => {
|
||||||
|
cy.get('h1').should('have.text', 'Transaction failed');
|
||||||
|
cy.getByTestId('Error').should('have.text', expectedErrorTxt);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Able to disconnect via banner', function () {
|
||||||
|
cy.getByTestId('exit-view').click();
|
||||||
|
cy.getByTestId(banner).should('not.exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Able to disconnect via wallet', function () {
|
||||||
|
cy.getByTestId('manage-vega-wallet').click();
|
||||||
|
cy.getByTestId('disconnect').click();
|
||||||
|
cy.getByTestId(banner).should('not.exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
function verifyConnectedToPubKey() {
|
||||||
|
cy.getByTestId(banner).should(
|
||||||
|
'contain.text',
|
||||||
|
`Viewing as Vega user: ${vegaPubkeyTruncated}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
@ -40,7 +40,6 @@ Cypress.Commands.add('staking_validator_page_add_stake', (stake) => {
|
|||||||
.and('contain', `Add ${stake} $VEGA tokens`)
|
.and('contain', `Add ${stake} $VEGA tokens`)
|
||||||
.and('be.visible')
|
.and('be.visible')
|
||||||
.click();
|
.click();
|
||||||
cy.get(dialogCloseButton).click();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('staking_validator_page_remove_stake', (stake) => {
|
Cypress.Commands.add('staking_validator_page_remove_stake', (stake) => {
|
||||||
|
@ -16,6 +16,7 @@ import {
|
|||||||
} from './lib/commands/vega-wallet-connect';
|
} from './lib/commands/vega-wallet-connect';
|
||||||
import { addMockTransactionResponse } from './lib/commands/mock-transaction-response';
|
import { addMockTransactionResponse } from './lib/commands/mock-transaction-response';
|
||||||
import { addCreateMarket } from './lib/commands/create-market';
|
import { addCreateMarket } from './lib/commands/create-market';
|
||||||
|
import { addConnectPublicKey } from './lib/commands/add-connect-public-key';
|
||||||
|
|
||||||
addGetTestIdcommand();
|
addGetTestIdcommand();
|
||||||
addSlackCommand();
|
addSlackCommand();
|
||||||
@ -33,6 +34,7 @@ addVegaWalletConnect();
|
|||||||
addSetVegaWallet();
|
addSetVegaWallet();
|
||||||
addMockTransactionResponse();
|
addMockTransactionResponse();
|
||||||
addCreateMarket();
|
addCreateMarket();
|
||||||
|
addConnectPublicKey();
|
||||||
|
|
||||||
export { mockConnectWallet } from './lib/commands/vega-wallet-connect';
|
export { mockConnectWallet } from './lib/commands/vega-wallet-connect';
|
||||||
export type { onMessage } from './lib/mock-ws';
|
export type { onMessage } from './lib/mock-ws';
|
||||||
|
23
libs/cypress/src/lib/commands/add-connect-public-key.ts
Normal file
23
libs/cypress/src/lib/commands/add-connect-public-key.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
declare global {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||||
|
namespace Cypress {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
interface Chainable<Subject> {
|
||||||
|
connectPublicKey(publicKey: string): void;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const addConnectPublicKey = () => {
|
||||||
|
Cypress.Commands.add('connectPublicKey', (publicKey) => {
|
||||||
|
cy.getByTestId('connect-vega-wallet').then((connectWallet) => {
|
||||||
|
if (connectWallet.length) {
|
||||||
|
cy.getByTestId('connect-vega-wallet').click();
|
||||||
|
cy.getByTestId('connector-view').should('be.visible').click();
|
||||||
|
cy.getByTestId('address').click();
|
||||||
|
cy.getByTestId('address').type(publicKey);
|
||||||
|
cy.getByTestId('connect').click();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
@ -21,11 +21,16 @@ export const ViewingAsBanner = ({
|
|||||||
disconnect,
|
disconnect,
|
||||||
}: ViewingAsBannerProps) => {
|
}: ViewingAsBannerProps) => {
|
||||||
return (
|
return (
|
||||||
<div className="w-full p-2 bg-neutral-800 flex justify-between text-neutral-400">
|
<div
|
||||||
|
data-testid="view-banner"
|
||||||
|
className="w-full p-2 bg-neutral-800 flex justify-between text-neutral-400"
|
||||||
|
>
|
||||||
<div className="text-base flex items-center justify-center">
|
<div className="text-base flex items-center justify-center">
|
||||||
{t('Viewing as Vega user:')} {pubKey && truncateMiddle(pubKey)}
|
{t('Viewing as Vega user:')} {pubKey && truncateMiddle(pubKey)}
|
||||||
</div>
|
</div>
|
||||||
<Button onClick={disconnect}>{t('Exit view as')}</Button>
|
<Button data-testid="exit-view" onClick={disconnect}>
|
||||||
|
{t('Exit view as')}
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -56,7 +56,7 @@ export function ViewConnectorForm({
|
|||||||
<InputError intent="danger">{errors.address.message}</InputError>
|
<InputError intent="danger">{errors.address.message}</InputError>
|
||||||
)}
|
)}
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<Button variant="primary" type="submit" fill={true}>
|
<Button data-testid="connect" variant="primary" type="submit" fill={true}>
|
||||||
{t('Connect')}
|
{t('Connect')}
|
||||||
</Button>
|
</Button>
|
||||||
</form>
|
</form>
|
||||||
|
Loading…
Reference in New Issue
Block a user