automacao-core-carga-back 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -604,15 +604,33 @@ class GrafanaUtils {
604
604
  this.locatorTotalUnackedMessagesPanel = page.getByTestId('data-testid Panel header Total/unacked messages').getByTestId(DATATESTID_PANELCONTENT);
605
605
  this.locatorPublishedAckedRatesPanel = page.getByTestId('data-testid Panel header Published/Acked messages rates').getByTestId(DATATESTID_PANELCONTENT);
606
606
  this.locatorTabelaVisaoCompletaTable = page.locator(CSS_VISAOCOMPLETA_TABLE);
607
- this.locatorTotalUnackedMaxCell = this.locatorTotalUnackedMessagesPanel.getByRole('cell', {
608
- name: 'Max'
609
- });
607
+ this._locatorTotalUnackedMaxCell = null;
610
608
  this.locatorVisaoCompletaButton = page.getByTestId(DATATESTID_PANELMENUITEMVIEW);
611
609
  this.locatorVoltarDashBoardButton = page.getByTestId(DATATESTID_BACKDASHBOARD);
612
610
  this.locatorVersoesServicoPanel = page.getByTestId('data-testid Panel header Images').getByTestId(DATATESTID_PANELCONTENT);
613
611
  this.locatorVersoesServicosVisaoCompletaPanel = page.getByTestId('data-testid Panel header Images');
614
612
  }
615
613
 
614
+ /**
615
+ * Resolve o locator da célula "Max" em runtime, aceitando role `cell` ou
616
+ * `columnheader` conforme o que estiver presente na página.
617
+ * @returns {Promise<import('@playwright/test').Locator>}
618
+ */
619
+ async _resolverLocatorMaxCell() {
620
+ if (this._locatorTotalUnackedMaxCell) {
621
+ return this._locatorTotalUnackedMaxCell;
622
+ }
623
+ const cellLocator = this.locatorTotalUnackedMessagesPanel.getByRole('cell', {
624
+ name: 'Max'
625
+ });
626
+ const columnheaderLocator = this.locatorTotalUnackedMessagesPanel.getByRole('columnheader', {
627
+ name: 'Max'
628
+ });
629
+ const isCellVisible = await cellLocator.isVisible().catch(() => false);
630
+ this._locatorTotalUnackedMaxCell = isCellVisible ? cellLocator : columnheaderLocator;
631
+ return this._locatorTotalUnackedMaxCell;
632
+ }
633
+
616
634
  /**
617
635
  * Navega para a URL do Grafana e fecha o "Dock menu" se visível.
618
636
  * @param {string} url - URL do dashboard Grafana
@@ -668,10 +686,12 @@ class GrafanaUtils {
668
686
 
669
687
  /**
670
688
  * Clica na célula Max da tabela para ordenar pelo total de mensagens.
689
+ * Aceita role `cell` ou `columnheader` dependendo do ambiente/browser.
671
690
  */
672
691
  async ordenarMensagensTotal() {
673
- await test$1.expect(this.locatorTotalUnackedMaxCell).toBeVisible();
674
- await this.locatorTotalUnackedMaxCell.click();
692
+ const locator = await this._resolverLocatorMaxCell();
693
+ await test$1.expect(locator).toBeVisible();
694
+ await locator.click();
675
695
  }
676
696
 
677
697
  /**
@@ -595,15 +595,33 @@ class GrafanaUtils {
595
595
  this.locatorTotalUnackedMessagesPanel = page.getByTestId('data-testid Panel header Total/unacked messages').getByTestId(DATATESTID_PANELCONTENT);
596
596
  this.locatorPublishedAckedRatesPanel = page.getByTestId('data-testid Panel header Published/Acked messages rates').getByTestId(DATATESTID_PANELCONTENT);
597
597
  this.locatorTabelaVisaoCompletaTable = page.locator(CSS_VISAOCOMPLETA_TABLE);
598
- this.locatorTotalUnackedMaxCell = this.locatorTotalUnackedMessagesPanel.getByRole('cell', {
599
- name: 'Max'
600
- });
598
+ this._locatorTotalUnackedMaxCell = null;
601
599
  this.locatorVisaoCompletaButton = page.getByTestId(DATATESTID_PANELMENUITEMVIEW);
602
600
  this.locatorVoltarDashBoardButton = page.getByTestId(DATATESTID_BACKDASHBOARD);
603
601
  this.locatorVersoesServicoPanel = page.getByTestId('data-testid Panel header Images').getByTestId(DATATESTID_PANELCONTENT);
604
602
  this.locatorVersoesServicosVisaoCompletaPanel = page.getByTestId('data-testid Panel header Images');
605
603
  }
606
604
 
605
+ /**
606
+ * Resolve o locator da célula "Max" em runtime, aceitando role `cell` ou
607
+ * `columnheader` conforme o que estiver presente na página.
608
+ * @returns {Promise<import('@playwright/test').Locator>}
609
+ */
610
+ async _resolverLocatorMaxCell() {
611
+ if (this._locatorTotalUnackedMaxCell) {
612
+ return this._locatorTotalUnackedMaxCell;
613
+ }
614
+ const cellLocator = this.locatorTotalUnackedMessagesPanel.getByRole('cell', {
615
+ name: 'Max'
616
+ });
617
+ const columnheaderLocator = this.locatorTotalUnackedMessagesPanel.getByRole('columnheader', {
618
+ name: 'Max'
619
+ });
620
+ const isCellVisible = await cellLocator.isVisible().catch(() => false);
621
+ this._locatorTotalUnackedMaxCell = isCellVisible ? cellLocator : columnheaderLocator;
622
+ return this._locatorTotalUnackedMaxCell;
623
+ }
624
+
607
625
  /**
608
626
  * Navega para a URL do Grafana e fecha o "Dock menu" se visível.
609
627
  * @param {string} url - URL do dashboard Grafana
@@ -659,10 +677,12 @@ class GrafanaUtils {
659
677
 
660
678
  /**
661
679
  * Clica na célula Max da tabela para ordenar pelo total de mensagens.
680
+ * Aceita role `cell` ou `columnheader` dependendo do ambiente/browser.
662
681
  */
663
682
  async ordenarMensagensTotal() {
664
- await expect(this.locatorTotalUnackedMaxCell).toBeVisible();
665
- await this.locatorTotalUnackedMaxCell.click();
683
+ const locator = await this._resolverLocatorMaxCell();
684
+ await expect(locator).toBeVisible();
685
+ await locator.click();
666
686
  }
667
687
 
668
688
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "automacao-core-carga-back",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Core compartilhado de utilitários k6 e Playwright para testes de carga dos módulos erpx_* e erp_*",
5
5
  "exports": {
6
6
  "./k6": {