11import { expect } from '@playwright/test' ;
22
3- import datalensTest from '../../../ utils/playwright/globalTestDefinition' ;
4- import { openTestPage , slct } from '../../../ utils' ;
3+ import datalensTest from '../../utils/playwright/globalTestDefinition' ;
4+ import { openTestPage , slct } from '../../utils' ;
55import {
66 DatasetFieldsTabQa ,
77 DatasetEditorTableSettingsItems ,
@@ -10,21 +10,31 @@ import {
1010 FieldEditorQa ,
1111 DatasetFieldTabBatchPanelQa ,
1212 DialogConfirmQA ,
13- } from '../../../../src/shared' ;
14- import { DatasetsEntities } from '../../../constants/test-entities/datasets' ;
15- import DatasetPage from '../../../page-objects/dataset/DatasetPage' ;
16- import FieldEditor from '../../../page-objects/wizard/FieldEditor' ;
17- import { getFieldNameInput , changeFieldSelect , selectTwoCheckboxes } from './helpers' ;
18- import { GET_PREVIEW_URL } from '../constants' ;
13+ DatasetPreviewQA ,
14+ } from '../../../src/shared' ;
15+ import DatasetPage from '../../page-objects/dataset/DatasetPage' ;
16+ import FieldEditor from '../../page-objects/wizard/FieldEditor' ;
17+ import {
18+ getFieldNameInput ,
19+ changeFieldSelect ,
20+ selectTwoCheckboxes ,
21+ } from '../../opensource-suites/dataset/base/helpers' ;
22+ import { VALIDATE_DATASET_URL } from '../../opensource-suites/dataset/constants' ;
23+ import { RobotChartsDatasetUrls } from '../../utils/constants' ;
1924
2025datalensTest . describe ( 'Dataset history' , ( ) => {
21- const url = `datasets ${ DatasetsEntities . Basic . url } ` ;
26+ const url = RobotChartsDatasetUrls . DatasetWithCsvConnection ;
2227 let datasetPage : DatasetPage ;
2328
2429 datalensTest . beforeEach ( async ( { page} ) => {
2530 datasetPage = new DatasetPage ( { page} ) ;
2631 await openTestPage ( page , url ) ;
2732 await page . waitForSelector ( slct ( DatasetFieldsTabQa . FieldNameColumnInput ) ) ;
33+ // close preview for not wait response for it
34+ const previewCloseBtn = page . locator ( slct ( DatasetPreviewQA . ClosePreviewBtn ) ) ;
35+ await previewCloseBtn . click ( ) ;
36+ const preview = page . locator ( DatasetPreviewQA . Preview ) ;
37+ await expect ( preview ) . not . toBeVisible ( ) ;
2838 } ) ;
2939
3040 datalensTest ( 'Undo button is disabled when no changes were made' , async ( { page} ) => {
@@ -88,9 +98,7 @@ datalensTest.describe('Dataset history', () => {
8898
8999 // Hide first field
90100 const hiddenBtn = page . locator ( slct ( DatasetFieldsTabQa . FieldVisibleColumnIcon ) ) . first ( ) ;
91- const hidePromise = datasetPage . waitForSuccessfulResponse ( GET_PREVIEW_URL ) ;
92101 await hiddenBtn . click ( ) ;
93- await hidePromise ;
94102
95103 const rowsCountAfterHide = await page
96104 . locator ( slct ( DatasetFieldsTabQa . FieldNameColumnInput ) )
@@ -115,9 +123,7 @@ datalensTest.describe('Dataset history', () => {
115123 const visibleClassBefore = await firstFieldVisibleIcon . getAttribute ( 'title' ) ;
116124
117125 // Hide first field
118- const hidePromise = datasetPage . waitForSuccessfulResponse ( GET_PREVIEW_URL ) ;
119126 await firstFieldVisibleIcon . click ( ) ;
120- await hidePromise ;
121127
122128 const visibleClassAfterHide = await firstFieldVisibleIcon . getAttribute ( 'title' ) ;
123129 expect ( visibleClassAfterHide ) . not . toBe ( visibleClassBefore ) ;
@@ -145,7 +151,7 @@ datalensTest.describe('Dataset history', () => {
145151 await contextMenuBtn . click ( ) ;
146152
147153 const duplicateItem = page . locator ( slct ( DatasetFieldContextMenuItemsQA . DUPLICATE ) ) ;
148- const duplicatePromise = datasetPage . waitForSuccessfulResponse ( GET_PREVIEW_URL ) ;
154+ const duplicatePromise = datasetPage . waitForSuccessfulResponse ( VALIDATE_DATASET_URL ) ;
149155 await duplicateItem . click ( ) ;
150156 await duplicatePromise ;
151157
@@ -184,7 +190,7 @@ datalensTest.describe('Dataset history', () => {
184190 await contextMenuBtn . click ( ) ;
185191
186192 const removeItem = page . locator ( slct ( DatasetFieldContextMenuItemsQA . REMOVE ) ) ;
187- const removePromise = datasetPage . waitForSuccessfulResponse ( GET_PREVIEW_URL ) ;
193+ const removePromise = datasetPage . waitForSuccessfulResponse ( VALIDATE_DATASET_URL ) ;
188194 await removeItem . click ( ) ;
189195 await removePromise ;
190196
@@ -221,9 +227,7 @@ datalensTest.describe('Dataset history', () => {
221227 const originalValue = await descriptionInput . inputValue ( ) ;
222228
223229 await descriptionInput . fill ( 'test description for history' ) ;
224- const validatePromise = datasetPage . waitForSuccessfulResponse ( GET_PREVIEW_URL ) ;
225230 await page . keyboard . press ( 'Enter' ) ;
226- await validatePromise ;
227231
228232 const updatedValue = await descriptionInput . inputValue ( ) ;
229233 expect ( updatedValue ) . toBe ( 'test description for history' ) ;
@@ -245,9 +249,7 @@ datalensTest.describe('Dataset history', () => {
245249 const newDescription = 'test description for redo' ;
246250
247251 await descriptionInput . fill ( newDescription ) ;
248- const validatePromise = datasetPage . waitForSuccessfulResponse ( GET_PREVIEW_URL ) ;
249252 await page . keyboard . press ( 'Enter' ) ;
250- await validatePromise ;
251253
252254 // Undo
253255 const undoBtn = page . locator ( slct ( EditHistoryQA . UndoBtn ) ) ;
@@ -276,7 +278,7 @@ datalensTest.describe('Dataset history', () => {
276278 return ;
277279 }
278280
279- const validatePromise = datasetPage . waitForSuccessfulResponse ( GET_PREVIEW_URL ) ;
281+ const validatePromise = datasetPage . waitForSuccessfulResponse ( VALIDATE_DATASET_URL ) ;
280282 await targetOption . click ( ) ;
281283 await validatePromise ;
282284
@@ -303,7 +305,7 @@ datalensTest.describe('Dataset history', () => {
303305 return ;
304306 }
305307
306- const validatePromise = datasetPage . waitForSuccessfulResponse ( GET_PREVIEW_URL ) ;
308+ const validatePromise = datasetPage . waitForSuccessfulResponse ( VALIDATE_DATASET_URL ) ;
307309 await targetOption . click ( ) ;
308310 await validatePromise ;
309311
@@ -337,7 +339,7 @@ datalensTest.describe('Dataset history', () => {
337339 }
338340
339341 const validatePromise = page . waitForResponse ( ( response ) =>
340- response . url ( ) . includes ( GET_PREVIEW_URL ) ,
342+ response . url ( ) . includes ( VALIDATE_DATASET_URL ) ,
341343 ) ;
342344 await targetOption . click ( ) ;
343345 await validatePromise ;
@@ -369,7 +371,7 @@ datalensTest.describe('Dataset history', () => {
369371 }
370372
371373 const validatePromise = page . waitForResponse ( ( response ) =>
372- response . url ( ) . includes ( GET_PREVIEW_URL ) ,
374+ response . url ( ) . includes ( VALIDATE_DATASET_URL ) ,
373375 ) ;
374376 await targetOption . click ( ) ;
375377 await validatePromise ;
@@ -407,7 +409,7 @@ datalensTest.describe('Dataset history', () => {
407409 const changedName = `${ originalName } _edited` ;
408410 await fieldEditor . changeName ( changedName ) ;
409411
410- const applyPromise = datasetPage . waitForSuccessfulResponse ( GET_PREVIEW_URL ) ;
412+ const applyPromise = datasetPage . waitForSuccessfulResponse ( VALIDATE_DATASET_URL ) ;
411413 await fieldEditor . clickToApplyButton ( ) ;
412414 await applyPromise ;
413415
@@ -439,7 +441,7 @@ datalensTest.describe('Dataset history', () => {
439441 const deleteBtn = actionsPanel . locator ( slct ( DatasetFieldTabBatchPanelQa . BatchDelete ) ) ;
440442 await deleteBtn . click ( ) ;
441443 const applyDelete = await page . waitForSelector ( slct ( DialogConfirmQA . ApplyButton ) ) ;
442- const deletePromise = datasetPage . waitForSuccessfulResponse ( GET_PREVIEW_URL ) ;
444+ const deletePromise = datasetPage . waitForSuccessfulResponse ( VALIDATE_DATASET_URL ) ;
443445 await applyDelete . click ( ) ;
444446 await deletePromise ;
445447
@@ -483,9 +485,7 @@ datalensTest.describe('Dataset history', () => {
483485 const hideBtn = actionsPanel . locator ( 'button' ) . nth ( 1 ) ;
484486 await hideBtn . click ( ) ;
485487 const applyHide = await page . waitForSelector ( slct ( DialogConfirmQA . ApplyButton ) ) ;
486- const hidePromise = datasetPage . waitForSuccessfulResponse ( GET_PREVIEW_URL ) ;
487488 await applyHide . click ( ) ;
488- await hidePromise ;
489489
490490 // After hiding, the hidden fields should disappear (Show hidden is off by default)
491491 const rowsCountAfterHide = await page
@@ -606,7 +606,7 @@ datalensTest.describe('Dataset history', () => {
606606 await contextMenuBtn . click ( ) ;
607607
608608 const duplicateItem = page . locator ( slct ( DatasetFieldContextMenuItemsQA . DUPLICATE ) ) ;
609- const dupPromise = datasetPage . waitForSuccessfulResponse ( GET_PREVIEW_URL ) ;
609+ const dupPromise = datasetPage . waitForSuccessfulResponse ( VALIDATE_DATASET_URL ) ;
610610 await duplicateItem . click ( ) ;
611611 await dupPromise ;
612612
0 commit comments