Skip to content

Commit

Permalink
Use MPW-playback submodule instead of storing the files directly (#479)
Browse files Browse the repository at this point in the history
* Use MPW-playback submodule instead of storing the files directly

* Try using https?

* Submodule

* Enable lfs

* Update e2e playbacks

* Empty commit

* Fix e2e test for real this time

* Use different chain params for e2e testing

* Oh wow, it now works. I can't believe it. It will never break again

* Finally works gg
  • Loading branch information
Duddino authored Dec 3, 2024
1 parent 3407e2e commit 29f7a81
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 38 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,17 @@ jobs:
steps:
- name: Check out Git repository
uses: actions/checkout@v4
with:
submodules: 'true'
lfs: 'true'

- name: Set up Node.js
uses: actions/setup-node@v4

- name: Install Node.js dependencies
run: npm ci
run: |
cp chain_params.test.json chain_params.json
npm ci
- name: Run e2e tests
run: npm run cy:ci
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "cypress/fixtures/e2e"]
path = cypress/fixtures/e2e
url = https://github.com/PIVX-Labs/MPW-playbacks.git
54 changes: 30 additions & 24 deletions chain_params.test.json
Original file line number Diff line number Diff line change
@@ -1,51 +1,57 @@
{
"main": {
"name": "main",
"name": "mainnet",
"collateralInSats": 1000000000000,
"isTestnet": true,
"TICKER": "tPIV",
"PUBKEY_PREFIX": ["x", "y"],
"STAKING_PREFIX": "W",
"PUBKEY_ADDRESS": 139,
"STAKING_ADDRESS": 73,
"SECRET_KEY": 239,
"BIP44_TYPE": 1,
"BIP44_TYPE_LEDGER": 1,
"PROTOCOL_VERSION": 70926,
"MASTERNODE_PORT": 51474,
"Explorers": [{ "name": "regtest", "url": "http://localhost:8081" }],
"isTestnet": false,
"TICKER": "PIV",
"PUBKEY_PREFIX": ["D"],
"STAKING_PREFIX": "S",
"PUBKEY_ADDRESS": [30],
"EXCHANGE_ADDRESS_PREFIX": [1, 185, 162],
"STAKING_ADDRESS": [63],
"SECRET_KEY": 212,
"BIP44_TYPE": 119,
"BIP44_TYPE_LEDGER": 77,
"PROTOCOL_VERSION": 70927,
"MASTERNODE_PORT": 51472,
"SHIELD_PREFIX": "ps",
"Explorers": [
{ "name": "Duddino", "url": "https://explorer.duddino.com" }
],
"Nodes": [
{ "name": "regtest", "url": "http://localhost:8082/mainnet" }
{ "name": "Duddino", "url": "https://rpc.duddino.com/mainnet" }
],
"Consensus": {},
"coinbaseMaturity": 15,
"budgetCycleBlocks": 144,
"coinbaseMaturity": 100,
"budgetCycleBlocks": 43200,
"proposalFee": 5000000000,
"proposalFeeConfirmRequirement": 3,
"maxPaymentCycles": 20,
"maxPayment": 144000000000,
"defaultColdStakingAddress": "WmNziUEPyhnUkiVdfsiNX93H6rSJnios44"
"proposalFeeConfirmRequirement": 6,
"maxPaymentCycles": 6,
"maxPayment": 43200000000000,
"defaultColdStakingAddress": "SdgQDpS8jDRJDX8yK8m9KnTMarsE84zdsy"
},
"testnet": {
"name": "testnet",
"collateralInSats": 1000000000000,
"isTestnet": true,
"TICKER": "tPIV",
"PUBKEY_PREFIX": ["x", "y"],
"EXCHANGE_ADDRESS_PREFIX": [1, 185, 177],
"STAKING_PREFIX": "W",
"PUBKEY_ADDRESS": 139,
"STAKING_ADDRESS": 73,
"PUBKEY_ADDRESS": [139],
"STAKING_ADDRESS": [73],
"SECRET_KEY": 239,
"BIP44_TYPE": 1,
"BIP44_TYPE_LEDGER": 1,
"PROTOCOL_VERSION": 70926,
"PROTOCOL_VERSION": 70927,
"MASTERNODE_PORT": 51474,
"SHIELD_PREFIX": "ptestsapling",
"Explorers": [
{ "name": "rockdev", "url": "https://testnet.rockdev.org" },
{ "name": "duddino", "url": "https://testnet.duddino.com" }
],
"Nodes": [
{ "name": "Duddino", "url": "https://rpc.duddino.com/testnet" }
{ "name": "Duddino", "url": "https://rpc2.duddino.com/testnet" }
],
"Consensus": {},
"coinbaseMaturity": 15,
Expand Down
30 changes: 17 additions & 13 deletions cypress/e2e/private_mode.cy.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,38 @@
describe('public/private mode tests', () => {
beforeEach(() => {
const before = () => {
cy.playback('GET', /(xpub|address|getshielddata|duddino|block)/, {
matching: { ignores: ['hostname', 'port'] },
}).as('sync');
cy.intercept('GET', 'https://rpc.duddino.com/mainnet/getblockcount', {
statusCode: 200,
body: 4669846,
});
cy.clearDb();
cy.visit('/');
cy.waitForLoading().should('be.visible');
cy.playback('GET', /(xpub|address|getshielddata)/, {
matching: { ignores: ['hostname', 'port'] },
}).as('sync');
cy.setExplorer(0);
cy.setNode(1);

cy.goToTab('dashboard');
cy.importWallet(
'hawk crash art bottom rookie surprise grit giant fitness entire course spray'
);
cy.encryptWallet('123456');

cy.waitForSync();
cy.togglePrivateMode();
});
};

it('switches back to public mode when not available', () => {
// It should remember private mode
before();
cy.visit('/');
cy.waitForSync();

cy.get('[data-testid="shieldModePrefix"]').should('exist');
// We should be in private mode here
cy.get('[data-testid="shieldModePrefix"]').should('exist');
cy.deleteWallet();
// When importing a non shield capable wallet, we should be in public mode
cy.importWallet('DLabsktzGMnsK5K9uRTMCF6NoYNY6ET4Bb');
cy.waitForSync();
cy.get('[data-testid="shieldModePrefix"]').should('not.exist');
});

it('remembers private mode', () => {
cy.visit('/');
cy.get('[data-testid="shieldModePrefix"]').should('exist');
});
});
1 change: 1 addition & 0 deletions cypress/fixtures/e2e
Submodule e2e added at 2e250d
Binary file not shown.

0 comments on commit 29f7a81

Please sign in to comment.