From ae47a5204a00d12a1c4ad799b6a2bec6bb451294 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 30 Jul 2025 15:36:19 +0000
Subject: [PATCH] Fix contest logging locator field length and tab navigation
issues
Co-authored-by: magicbug <84308+magicbug@users.noreply.github.com>
---
application/views/contesting/index.php | 18 ++++-----
cypress/e2e/6-contest-logging.cy.js | 54 ++++++++++++++++++++++++++
cypress/support/commands.js | 6 +++
3 files changed, 69 insertions(+), 9 deletions(-)
create mode 100644 cypress/e2e/6-contest-logging.cy.js
diff --git a/application/views/contesting/index.php b/application/views/contesting/index.php
index 1ca451bd..54425989 100644
--- a/application/views/contesting/index.php
+++ b/application/views/contesting/index.php
@@ -102,48 +102,48 @@
diff --git a/cypress/e2e/6-contest-logging.cy.js b/cypress/e2e/6-contest-logging.cy.js
new file mode 100644
index 00000000..a91e5feb
--- /dev/null
+++ b/cypress/e2e/6-contest-logging.cy.js
@@ -0,0 +1,54 @@
+describe('Contest Logging', () => {
+ beforeEach(() => {
+ // Navigate to contest logging page
+ // Note: This test assumes the application is already set up and accessible
+ cy.visit('/index.php/contesting?manual=1');
+
+ // Wait for page to load and set exchange type to Serialgridsquare
+ cy.get('#exchangetype').select('Serialgridsquare');
+ });
+
+ it('should allow 6-character locator input in gridsquare field', () => {
+ // Test that the locator field accepts 6-character locators like JO42JA
+ cy.get('#exch_gridsquare_r').should('be.visible');
+ cy.get('#exch_gridsquare_r').type('JO42JA');
+ cy.get('#exch_gridsquare_r').should('have.value', 'JO42JA');
+
+ // Test that it also accepts 8-character locators
+ cy.get('#exch_gridsquare_r').clear();
+ cy.get('#exch_gridsquare_r').type('JO42JA67');
+ cy.get('#exch_gridsquare_r').should('have.value', 'JO42JA67');
+ });
+
+ it('should support proper tab navigation through contest fields for Serialgridsquare exchange', () => {
+ // Start from callsign field
+ cy.get('#callsign').focus();
+
+ // Tab through fields and verify the order
+ cy.get('#callsign').tab();
+ cy.focused().should('have.id', 'rst_sent');
+
+ cy.focused().tab();
+ cy.focused().should('have.id', 'exch_serial_s');
+
+ cy.focused().tab();
+ cy.focused().should('have.id', 'rst_rcvd');
+
+ cy.focused().tab();
+ cy.focused().should('have.id', 'exch_serial_r');
+
+ cy.focused().tab();
+ cy.focused().should('have.id', 'exch_gridsquare_r');
+ });
+
+ it('should show correct fields for Serialgridsquare exchange type', () => {
+ // Verify that the correct fields are visible for Serialgridsquare exchange
+ cy.get('.serials').should('be.visible');
+ cy.get('.serialr').should('be.visible');
+ cy.get('.gridsquarer').should('be.visible');
+
+ // Verify that other exchange type fields are hidden
+ cy.get('.exchanges').should('not.be.visible');
+ cy.get('.exchanger').should('not.be.visible');
+ });
+});
\ No newline at end of file
diff --git a/cypress/support/commands.js b/cypress/support/commands.js
index 489fe9a3..c81a8233 100644
--- a/cypress/support/commands.js
+++ b/cypress/support/commands.js
@@ -12,3 +12,9 @@ Cypress.Commands.add("waitForSelectOptions", (selector, minOptions = 1) => {
cy.get(selector).should('be.visible');
cy.get(`${selector} option`).should('have.length.greaterThan', minOptions);
});
+
+// Custom command to simulate tab key press
+Cypress.Commands.add("tab", { prevSubject: 'element' }, (subject) => {
+ cy.wrap(subject).trigger('keydown', { key: 'Tab', code: 'Tab', keyCode: 9 });
+ return cy.focused();
+});