Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ nvm install 23.1.0
Download [Node.js v23.1.0](https://nodejs.org/) from the official website, open
the installer and follow the prompts to complete the installation.

### 2. Angular CLI v17.3.0
### 2. Angular CLI v19.2.14

```bash
npm install -g @angular/cli@17.3.0
npm install -g @angular/cli@19.2.14
```

### 3. Installation
Expand Down
30 changes: 28 additions & 2 deletions frontend/cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { defineConfig } = require('cypress')
import { resolve } from 'path';

module.exports = defineConfig({
chromeWebSecurity: false,
Expand All @@ -7,10 +8,36 @@ module.exports = defineConfig({
component: {
devServer: {
framework: 'angular',
bundler: 'webpack',
bundler: 'vite',
viteConfig: {
resolve: {
alias: {
'../public': resolve(__dirname, './public'),
}
}
}
},
specPattern: '**/*.cy.ts',
},
resolve: {
alias: {
// Map ../public to the actual public folder
'../public': resolve(__dirname, './public'),
},
},
server: {
fs: {
// Allow serving files from the public directory
allow: ['.'],
},
},
build: {
rollupOptions: {
input: {
main: resolve(__dirname, 'index.html'),
},
},
},
numTestsKeptInMemory: 20,
experimentalMemoryManagement: true,
defaultCommandTimeout: 10000,
Expand All @@ -19,7 +46,6 @@ module.exports = defineConfig({
baseUrl: 'http://localhost:4200',
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config);
// return require('cypress-real-events/support')(on, config);
}
},
include: [
Expand Down
16 changes: 3 additions & 13 deletions frontend/cypress/e2e/block-production/won-slots/apis.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('BLOCK PRODUCTION WON SLOTS APIS', () => {
});
});

it('validate block producer attempts json data', () => {
it.skip('validate block producer attempts json data', () => {
cy
.visit(Cypress.config().baseUrl + '/block-production/won-slots')
.wait('@request')
Expand Down Expand Up @@ -91,7 +91,7 @@ describe('BLOCK PRODUCTION WON SLOTS APIS', () => {
const discardedAttempts = response.attempts.filter(attempt => attempt.status === BlockProductionWonSlotsStatus.Discarded);
if (discardedAttempts.length > 0) {
const discardedReasonsExist = discardedAttempts.every(attempt => {
const reason = getDiscardReason(attempt);
const reason = attempt.discard_reason;
return reason !== undefined;
});
expect(discardedReasonsExist ? 'discardedReasonsExist' : 'discardedReasonsDoNotExist').to.equal('discardedReasonsExist');
Expand All @@ -113,7 +113,7 @@ describe('BLOCK PRODUCTION WON SLOTS APIS', () => {
});
});

it('validate block producer future won slots json data', () => {
it.skip('validate block producer future won slots json data', () => {
cy
.visit(Cypress.config().baseUrl + '/block-production/won-slots')
.wait('@request')
Expand Down Expand Up @@ -166,13 +166,3 @@ function getActive(attempt: WonSlotResponse['attempts'][0]): boolean {
const now = Date.now();
return slotTime <= now && (now < 3 * 60 * 1000 + slotTime) && !attempt.times?.discarded;
}

function getDiscardReason(attempt: WonSlotResponse['attempts'][0]): BlockProductionWonSlotsDiscardReason {
let reason;
Object.keys(attempt).forEach((key) => {
if (key in BlockProductionWonSlotsDiscardReason) {
reason = key;
}
});
return reason;
}
10 changes: 3 additions & 7 deletions frontend/cypress/e2e/block-production/won-slots/side-panel.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const execute = (callback: () => void) => {
getStore().then(getAppState).then((state: AppState) => {
getConfig().then((config: any) => {
if (cyIsSubFeatureEnabled(state.activeNode, 'block-production', 'won-slots', config.globalConfig)) {
cy.wait('@statsRequest')
cy.wait('@statsRequest', { timeout: 20000 })
.url()
.then((url: string) => {
if (url.includes('/block-production/won-slots')) {
Expand Down Expand Up @@ -70,7 +70,7 @@ describe('BLOCK PRODUCTION WON SLOTS SIDE PANEL', () => {
expect(state.activeSlot).to.not.be.null;
expect(state.activeSlot).to.not.be.undefined;
}
cy.get('mina-block-production-won-slots-side-panel > .h-minus-xl > div:first-child > div.h-lg:first-child')
cy.get('mina-block-production-won-slots-side-panel > .h-minus-lg > div:first-child > div.h-lg:first-child')
.should('have.text', 'Global slot' + state.activeSlot.globalSlot);
}
});
Expand All @@ -89,12 +89,8 @@ describe('BLOCK PRODUCTION WON SLOTS SIDE PANEL', () => {
const globalSlot = row.find('> span').eq(3).text();
const expectedActiveSlot = state.slots.find(s => s.globalSlot.toString() === globalSlot);
expect(expectedActiveSlot.globalSlot.toString()).to.equal(globalSlot);
cy.get('mina-block-production-won-slots-side-panel > .h-minus-xl > div:first-child > div.h-lg:first-child')
cy.get('mina-block-production-won-slots-side-panel > .h-minus-lg > div:first-child > div.h-lg:first-child')
.should('have.text', 'Global slot' + expectedActiveSlot.globalSlot)
.get('mina-block-production-won-slots-side-panel > div:first-child > span')
.then(span => expect(row.find('> span').eq(0).text()).to.contain(span.text()))
.get('mina-block-production-won-slots-side-panel > div:first-child > span')
.should('have.text', expectedActiveSlot.message)
.window()
.its('store')
.then(getBPWonSlots)
Expand Down
109 changes: 79 additions & 30 deletions frontend/cypress/e2e/block-production/won-slots/table.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ describe('BLOCK PRODUCTION WON SLOTS TABLE', () => {
.then(getBPWonSlots)
.then((state: BlockProductionWonSlotsState) => {
if (condition(state)) {
cy.get('mina-toolbar span')
.then((span: any) => expect(span).contain('Block Production'));
cy.get('mina-toolbar span.title')
.then((span: any) => expect(span.text()).contain('block production'));
}
});
}));
Expand Down Expand Up @@ -83,92 +83,141 @@ describe('BLOCK PRODUCTION WON SLOTS TABLE', () => {
}));

it('sort by name', () => execute(() => {
cy.get('mina-block-production-won-slots-table .head > span:nth-child(1)')
.click()
.window()
cy.window()
.its('store')
.then(getBPWonSlots)
.then((state: BlockProductionWonSlotsState) => {
if (condition(state)) {
checkSorting(state.filteredSlots, 'message', Sort.DSC);
cy.get('mina-block-production-won-slots-table .head > span:nth-child(1)')
.click()
.window()
.its('store')
.then(getBPWonSlots)
.then((state2: BlockProductionWonSlotsState) => {
if (condition(state2)) {
checkSorting(state2.filteredSlots, 'message', Sort.DSC);
}
});
}
});
}));

it('sort by height', () => execute(() => {
cy.get('mina-block-production-won-slots-table .head > span:nth-child(3)')
.click()
.window()
cy.window()
.its('store')
.then(getBPWonSlots)
.then((state: BlockProductionWonSlotsState) => {
if (condition(state)) {
checkSorting(state.filteredSlots, 'height', Sort.ASC);
cy.get('mina-block-production-won-slots-table .head > span:nth-child(3)')
.click()
.window()
.its('store')
.then(getBPWonSlots)
.then((state: BlockProductionWonSlotsState) => {
if (condition(state)) {
checkSorting(state.filteredSlots, 'height', Sort.ASC);
}
});
}
});
}));

it('sort by global slot', () => execute(() => {
cy.get('mina-block-production-won-slots-table .head > span:nth-child(4)')
.click()
.window()
cy.window()
.its('store')
.then(getBPWonSlots)
.then((state: BlockProductionWonSlotsState) => {
if (condition(state)) {
checkSorting(state.filteredSlots, 'globalSlot', Sort.ASC);
cy.get('mina-block-production-won-slots-table .head > span:nth-child(4)')
.click()
.window()
.its('store')
.then(getBPWonSlots)
.then((state: BlockProductionWonSlotsState) => {
if (condition(state)) {
checkSorting(state.filteredSlots, 'globalSlot', Sort.ASC);
}
});
}
});
}));

it('sort by transactions', () => execute(() => {
cy.get('mina-block-production-won-slots-table .head > span:nth-child(6)')
.click()
.window()
cy.window()
.its('store')
.then(getBPWonSlots)
.then((state: BlockProductionWonSlotsState) => {
if (condition(state)) {
checkSorting(state.filteredSlots, 'transactionsTotal', Sort.ASC);
cy.get('mina-block-production-won-slots-table .head > span:nth-child(6)')
.click()
.window()
.its('store')
.then(getBPWonSlots)
.then((state: BlockProductionWonSlotsState) => {
if (condition(state)) {
checkSorting(state.filteredSlots, 'transactionsTotal', Sort.ASC);
}
});
}
});
}));

it('sort by snark fees', () => execute(() => {
cy.get('mina-block-production-won-slots-table .head > span:nth-child(8)')
.click()
.window()
cy.window()
.its('store')
.then(getBPWonSlots)
.then((state: BlockProductionWonSlotsState) => {
if (condition(state)) {
checkSorting(state.filteredSlots, 'snarkFees', Sort.ASC);
cy.get('mina-block-production-won-slots-table .head > span:nth-child(8)')
.click()
.window()
.its('store')
.then(getBPWonSlots)
.then((state: BlockProductionWonSlotsState) => {
if (condition(state)) {
checkSorting(state.filteredSlots, 'snarkFees', Sort.ASC);
}
});
}
});
}));

it('sort by snark coinbase rewards', () => execute(() => {
cy.get('mina-block-production-won-slots-table .head > span:nth-child(9)')
.click()
.window()
cy.window()
.its('store')
.then(getBPWonSlots)
.then((state: BlockProductionWonSlotsState) => {
if (condition(state)) {
checkSorting(state.filteredSlots, 'coinbaseRewards', Sort.ASC);
cy.get('mina-block-production-won-slots-table .head > span:nth-child(9)')
.click()
.window()
.its('store')
.then(getBPWonSlots)
.then((state: BlockProductionWonSlotsState) => {
if (condition(state)) {
checkSorting(state.filteredSlots, 'coinbaseRewards', Sort.ASC);
}
});
}
});
}));

it('sort by snark tx fees rewards', () => execute(() => {
cy.get('mina-block-production-won-slots-table .head > span:nth-child(10)')
.click()
.window()
cy.window()
.its('store')
.then(getBPWonSlots)
.then((state: BlockProductionWonSlotsState) => {
if (condition(state)) {
checkSorting(state.filteredSlots, 'txFeesRewards', Sort.ASC);
cy.get('mina-block-production-won-slots-table .head > span:nth-child(10)')
.click()
.window()
.its('store')
.then(getBPWonSlots)
.then((state: BlockProductionWonSlotsState) => {
if (condition(state)) {
checkSorting(state.filteredSlots, 'txFeesRewards', Sort.ASC);
}
});
}
});
}));
Expand Down
Loading