Просмотр исходного кода

test: wait for the dashboard link to be visible in the onlyDashboards test

openSidebar() returns once the sidebar is marked as shown, which happens
when it starts opening. The test then checked isDisplayed() once, which
could run before the link was visible. Wait for visibility instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jamesread 2 дней назад
Родитель
Сommit
a6c47a8b49
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      integration-tests/tests/onlyDashboards/onlyDashboards.mjs

+ 3 - 2
integration-tests/tests/onlyDashboards/onlyDashboards.mjs

@@ -1,6 +1,6 @@
 import { describe, it, before, after } from 'mocha'
 import { describe, it, before, after } from 'mocha'
 import { assert, expect } from 'chai'
 import { assert, expect } from 'chai'
-import { By } from 'selenium-webdriver'
+import { By, until } from 'selenium-webdriver'
 import {
 import {
   getRootAndWait,
   getRootAndWait,
   getActionButtons,
   getActionButtons,
@@ -41,7 +41,8 @@ describe('config: onlyDashboards', function () {
 
 
     const firstDashboardLink = await webdriver.findElement(By.css('li[title="My Dashboard"]'), 'The first dashboard link should be present')
     const firstDashboardLink = await webdriver.findElement(By.css('li[title="My Dashboard"]'), 'The first dashboard link should be present')
     assert.isNotNull(firstDashboardLink, 'First dashboard link should not be null')
     assert.isNotNull(firstDashboardLink, 'First dashboard link should not be null')
-    assert.isTrue(await firstDashboardLink.isDisplayed(), 'First dashboard link should be displayed')
+    // The sidebar is marked as shown when it starts opening, so wait for the link to become visible.
+    await webdriver.wait(until.elementIsVisible(firstDashboardLink), 5000, 'First dashboard link should be displayed')
 
 
     const actionButtonsOnDashboard = await getActionButtons()
     const actionButtonsOnDashboard = await getActionButtons()
     assert.isArray(actionButtonsOnDashboard, 'Action buttons on dashboard should be an array')
     assert.isArray(actionButtonsOnDashboard, 'Action buttons on dashboard should be an array')