Browser Management
launchBrowser()
Launches a Firefox browser instance with Playwright for automated Siigo interaction.browser: Firefox browser instancepage: Page with 1024x768 viewport
- Browser: Firefox (non-headless mode)
- Viewport: 1024x768
headless: false) to allow visual monitoring of the automation process.
Authentication
login()
Authenticates with Siigo Nube and navigates to the document creation form.page: Playwright page instanceusername: Siigo user emailpassword: Siigo user passworddocumentoSoporteLabelCode: Document type code (e.g., “25470”)nit: Provider NIT numbernit_empresa: Company NIT (“900142913” for Corprecam, “901328575” for Reciclemos)
- Navigate to login: Goes to
https://siigonube.siigo.com/#/login - Enter credentials: Fills username and password fields
- Submit login: Clicks the submit button
- Select company: Finds and clicks “Ingresar” button for the specified company NIT
- Create document: Clicks “Crear” button and selects “Documento soporte”
- Select document type: For Corprecam (900142913), selects the document type
- Search provider: Enters provider NIT in the search field
- Auto-fill consecutive: Reads and fills the automatic consecutive number
retryUntilSuccess() with label “login a Siigo” for automatic retry on failure.
Key Locators:
- Username:
#siigoSignInName - Password:
#siigoPassword - Company row:
trcontaining the NIT - Document type:
a[data-value="Documento soporte"] - Provider search: Input under “Proveedores” span
- Consecutive:
#lblAutomaticNumber
Product Selection
selectProducto()
Searches and selects a product by its code in Siigo’s autocomplete field.page: Playwright page instancecodigo: Product code to search for
- Clicks the product autocomplete input
- Clears any previous content
- Types the product code with 150ms delay between characters
- Waits for suggestions table to appear
- Finds and clicks the exact code match
- Uses
pressSequentially()with 150ms delay for Angular detection - Searches for exact text match using
:text-is()selector - Wrapped in
retryUntilSuccess()with label “selección de producto”
- Input:
#trEditRow #editProduct #autocomplete_autocompleteInput - Suggestions:
.siigo-ac-table tr
selectBodega()
Selects a warehouse (bodega) from Siigo’s dropdown.page: Playwright page instancenombre: Warehouse name (e.g., ” BODEGA DE RIOHACHA ”)
- Clicks the warehouse autocomplete input
- Waits for suggestions to load
- Finds and clicks the warehouse by name
- Input:
#trEditRow #editProductWarehouse #autocomplete_autocompleteInput - Suggestions:
.suggestions table.siigo-ac-table tr
Row Management
prepararNuevaFila()
Ensures a new product row is ready for input in the Siigo form.page: Playwright page instance
-
Check if row is ready:
- Verifies if product input is visible and enabled
- Returns immediately if ready
-
Open new row if needed:
- Clicks “Agregar otro ítem” button if row is not ready
- Waits for input to become visible
- Retries click if first attempt fails
-
Double-check mechanism:
- Includes fallback retry with 10-second timeout
- Ensures the form is truly ready before proceeding
- Input:
#trEditRow #editProduct #autocomplete_autocompleteInput - Add button:
#new-itemor#new-item-text
retryUntilSuccess() with label “preparar nueva fila”.
Data Entry
llenarCantidadValor()
Fills quantity and unit value fields for a product line and adds it to the document.page: Playwright page instancecantidad: Quantity of the productvalor: Unit price value
- Wait for inputs: Ensures quantity input is visible
- Fill quantity: Enters the product quantity
- Fill value: Enters the unit price
- Click add button: Adds the line to the document
- Wait for reset: Waits for the form to clear and reset for the next item
- Expects quantity input to have empty value after adding
- Includes 1-second timeout as safety fallback
- Prevents race conditions in the next iteration
- Quantity:
siigo-inputdecimal[formcontrolname="editQuantity"] input.dx-texteditor-input - Value:
siigo-inputdecimal[formcontrolname="editUnitValue"] input.dx-texteditor-input - Add button:
#new-itemor text “Agregar otro ítem”
retryUntilSuccess() with label “llenar cantidad y valor”.
Payment Selection
seleccionarPago()
Selects the payment account and closes the page after completing the document.page: Playwright page instancecuentaNombre: Account name (e.g., ” CAJA RIOHACHA ” or ” Efectivo ”)
- Clicks the account dropdown
- Waits for account suggestions to load
- Finds and clicks the matching account
- Closes the page
- Dropdown:
#editingAcAccount_autocompleteInput - Suggestions:
.suggestions .siigo-ac-table tr
retryUntilSuccess() with label “selección de pago”.
Note: This function closes the page after selection, marking the end of the document creation flow.
Complete Workflow Example
Here’s how all functions work together to create a support document:Error Handling
All interaction functions in this module use theretryUntilSuccess() utility:
- Automatic retries: Up to 5 attempts by default
- Labeled actions: Each function has a descriptive label for logging
- Progressive delays: 1-second delay between retries
- Detailed logging: Console output for each retry attempt
Dependencies
Related Documentation
- Data Transformations - Transform data before using these functions
- Helpers - Retry logic and string utilities
- Workflow - See how these functions orchestrate the complete process