Skip to content

Commit 523c156

Browse files
committed
Exploring Cypress selectors for failing table test
1 parent b23a434 commit 523c156

File tree

1 file changed

+35
-42
lines changed
  • frontend/cypress/e2e/block-production/won-slots

1 file changed

+35
-42
lines changed

frontend/cypress/e2e/block-production/won-slots/table.cy.ts

Lines changed: 35 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -52,53 +52,46 @@ describe('BLOCK PRODUCTION WON SLOTS TABLE', () => {
5252
.then(getBPWonSlots)
5353
.then((state: BlockProductionWonSlotsState) => {
5454
if (state && state.slots) {
55-
cy.log(state.slots.length.toString());
55+
cy.task(state.slots.length.toString());
5656
}
57-
cy.log(condition(state).toString());
58-
if (condition(state)) {
59-
60-
// First, let's see if the main table exists
61-
cy.get('mina-block-production-won-slots-table', { timeout: 15000 })
62-
.should('exist')
63-
.then(() => {
64-
cy.log('✅ Main table element found');
65-
});
66-
67-
// Check if .head exists
68-
cy.get('mina-block-production-won-slots-table .head', { timeout: 15000 })
69-
.should('exist')
70-
.then(($head) => {
71-
cy.log('✅ Table head found, length:', $head.length);
72-
cy.log('Head HTML:', $head.html());
73-
});
74-
75-
// Check all spans in head
76-
cy.get('mina-block-production-won-slots-table .head > span')
77-
.should('exist')
78-
.then(($spans) => {
79-
cy.log('✅ Header spans found, count:', $spans.length);
80-
$spans.each((index, span) => {
81-
cy.log(`Span ${index + 1}:`, span.textContent, 'Visible:', Cypress.$(span).is(':visible'));
82-
});
83-
});
57+
cy.task(condition(state).toString());
58+
// This WILL show in CI logs
59+
cy.task('log', '🔍 Starting table structure debug...');
60+
61+
cy.get('mina-block-production-won-slots-table', { timeout: 15000 })
62+
.should('exist')
63+
.then(() => {
64+
cy.task('log', '✅ Main table element found');
65+
});
8466

85-
// Try the exact failing selector
86-
cy.get('mina-block-production-won-slots-table .head > span:nth-child(1)', { timeout: 5000 })
87-
.should('exist')
88-
.then(($span) => {
89-
cy.log('✅ First span found:', $span.text());
90-
cy.log('Is visible:', $span.is(':visible'));
91-
cy.log('Has click handler:', $span.prop('onclick') !== null);
92-
});
67+
cy.get('mina-block-production-won-slots-table .head', { timeout: 15000 })
68+
.should('exist')
69+
.then(($head) => {
70+
cy.task('log', `✅ Table head found, length: ${$head.length}`);
71+
cy.task('log', `Head HTML: ${$head.html()}`);
72+
});
9373

94-
// Compare with working row selector
95-
cy.get('mina-block-production-won-slots-table .row:not(.head)')
96-
.should('exist')
97-
.then(($rows) => {
98-
cy.log('✅ Table rows found, count:', $rows.length);
74+
cy.get('mina-block-production-won-slots-table .head > span')
75+
.should('exist')
76+
.then(($spans) => {
77+
cy.task('log', `✅ Header spans found, count: ${$spans.length}`);
78+
$spans.each((index, span) => {
79+
cy.task('log', `Span ${index + 1}: "${span.textContent}" Visible: ${Cypress.$(span).is(':visible')}`);
9980
});
81+
});
10082

101-
}
83+
// Test the exact failing selector
84+
cy.get('body').then(() => {
85+
// Check if the element exists at all
86+
const element = Cypress.$('mina-block-production-won-slots-table .head > span:nth-child(1)');
87+
cy.task('log', `❓ nth-child(1) selector found: ${element.length} elements`);
88+
89+
if (element.length > 0) {
90+
cy.task('log', `Element text: "${element.text()}"`);
91+
cy.task('log', `Element visible: ${element.is(':visible')}`);
92+
cy.task('log', `Element position: ${JSON.stringify(element.offset())}`);
93+
}
94+
});
10295
});
10396
}));
10497

0 commit comments

Comments
 (0)