Merge pull request #6410 from mempool/mononaut/fix-cypress-address-poisoning-tests

fix cypress test for address poisoning highlighting
This commit is contained in:
mononaut 2026-03-26 16:24:02 +09:00 committed by GitHub
commit 086508a70e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -229,18 +229,15 @@ describe('Mainnet', () => {
cy.get('.alert-mempool').should('exist');
cy.get('.poison-alert').its('length').should('equal', 2);
cy.get('.prefix')
.should('have.length', 2)
.each(($el) => {
cy.wrap($el).should('have.text', prefix);
});
cy.get('.poison-alert').parent().find('.address-content').should('have.length', 2).then(($containers) => {
const prefixes = $containers.map((i, el) => Cypress.$(el).find('.prefix').text()).get();
const infixes = $containers.map((i, el) => Cypress.$(el).find('.infix').text()).get().sort();
cy.get('.infix')
.should('have.length', 2)
.then(($infixes) => {
cy.wrap($infixes[0]).should('have.text', infix1);
cy.wrap($infixes[1]).should('have.text', infix2);
});
expect(prefixes).to.have.length(2);
prefixes.forEach((p) => expect(p).to.equal(prefix));
expect(infixes).to.deep.equal([infix1, infix2].sort());
});
});
it('highlights potential address poisoning attacks on inputs and outputs, prefix, infix and postfix', () => {
@ -256,26 +253,17 @@ describe('Mainnet', () => {
cy.get('.alert-mempool').should('exist');
cy.get('.poison-alert').its('length').should('equal', 2);
cy.get('.prefix')
.should('have.length', 2)
.each(($el) => {
cy.wrap($el).should('have.text', prefix);
});
cy.get('.poison-alert').parent().find('.address-content').should('have.length', 2).then(($containers) => {
const prefixes = $containers.map((i, el) => Cypress.$(el).find('.prefix').text()).get();
const infixes = $containers.map((i, el) => Cypress.$(el).find('.infix').text()).get().sort();
const postfixes = $containers.map((i, el) => Cypress.$(el).find('.postfix').text()).get().sort();
cy.get('.infix')
.should('have.length', 2)
.then(($infixes) => {
cy.wrap($infixes[0]).should('have.text', infix1);
cy.wrap($infixes[1]).should('have.text', infix2);
});
cy.get('.postfix')
.should('have.length', 2)
.then(($postfixes) => {
cy.wrap($postfixes[0]).should('include.text', postfix1);
cy.wrap($postfixes[1]).should('include.text', postfix2);
});
expect(prefixes).to.have.length(2);
prefixes.forEach((p) => expect(p).to.equal(prefix));
expect(infixes).to.deep.equal([infix1, infix2].sort());
expect(postfixes).to.deep.equal([postfix1, postfix2].sort());
});
});
});