forked from datalens-tech/datalens-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In QL charts, two queries are executed on Run button click (datalens-…
…tech#852) * In QL charts, two queries are executed on Run button click * temporarily fix yagr onRender issue
- Loading branch information
Showing
2 changed files
with
38 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import {expect} from '@playwright/test'; | ||
|
||
import QLPage from '../../../page-objects/ql/QLPage'; | ||
import datalensTest from '../../../utils/playwright/globalTestDefinition'; | ||
import {openTestPage} from '../../../utils'; | ||
|
||
datalensTest.describe('QL', () => { | ||
datalensTest( | ||
'First and next click on Run button should trigger only one api/run request', | ||
async ({page, config}) => { | ||
await openTestPage(page, config.ql.urls.NewQLChartWithConnection); | ||
const qlPage = new QLPage({page}); | ||
await qlPage.setScript(`select 1`); | ||
|
||
let numberOfRequests = 0; | ||
await page.on('request', (request) => { | ||
if (request.url().includes('api/run')) { | ||
numberOfRequests += 1; | ||
} | ||
}); | ||
|
||
// Check first run | ||
await qlPage.runScript(); | ||
await qlPage.chartkit.waitUntilLoaderExists(); | ||
expect(numberOfRequests).toEqual(1); | ||
|
||
// Check second and other runs | ||
numberOfRequests = 0; | ||
await qlPage.runScript(); | ||
await qlPage.chartkit.waitUntilLoaderExists(); | ||
expect(numberOfRequests).toEqual(1); | ||
}, | ||
); | ||
}); |