Skip to content

Commit 622b617

Browse files
committed
try to fix dataset history test 2
1 parent 8d8a09e commit 622b617

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

tests/suites/dataset/history.test.ts

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ datalensTest.describe('Dataset history', () => {
2929
datasetPage = new DatasetPage({page});
3030
await openTestPage(page, url);
3131
await page.waitForSelector(slct(DatasetFieldsTabQa.FieldNameColumnInput));
32+
// Wait for initial dataset validation to complete, ensuring the edit history is initialized
33+
await page.waitForResponse(
34+
(response) => response.url().includes('/validateDataset') && response.ok(),
35+
);
3236
});
3337

3438
datalensTest('Undo button is disabled when no changes were made', async ({page}) => {
@@ -57,6 +61,7 @@ datalensTest.describe('Dataset history', () => {
5761
expect(undoValue).toBe(originalValue);
5862

5963
const redoBtn = page.locator(slct(EditHistoryQA.RedoBtn));
64+
await expect(redoBtn).toBeEnabled();
6065
await redoBtn.click();
6166

6267
const redoValue = await fieldInput.inputValue();
@@ -68,6 +73,7 @@ datalensTest.describe('Dataset history', () => {
6873

6974
// Undo
7075
const undoBtn = page.locator(slct(EditHistoryQA.UndoBtn));
76+
await expect(undoBtn).toBeEnabled();
7177
await undoBtn.click();
7278

7379
const redoBtn = page.locator(slct(EditHistoryQA.RedoBtn));
@@ -101,6 +107,7 @@ datalensTest.describe('Dataset history', () => {
101107

102108
// Undo the hide
103109
const undoBtn = page.locator(slct(EditHistoryQA.UndoBtn));
110+
await expect(undoBtn).toBeEnabled();
104111
await undoBtn.click();
105112

106113
const rowsCountAfterUndo = await page
@@ -124,10 +131,12 @@ datalensTest.describe('Dataset history', () => {
124131

125132
// Undo the hide
126133
const undoBtn = page.locator(slct(EditHistoryQA.UndoBtn));
134+
await expect(undoBtn).toBeEnabled();
127135
await undoBtn.click();
128136

129137
// Redo the hide
130138
const redoBtn = page.locator(slct(EditHistoryQA.RedoBtn));
139+
await expect(redoBtn).toBeEnabled();
131140
await redoBtn.click();
132141

133142
const visibleClassAfterRedo = await firstFieldVisibleIcon.getAttribute('title');
@@ -156,6 +165,7 @@ datalensTest.describe('Dataset history', () => {
156165

157166
// Undo the duplication
158167
const undoBtn = page.locator(slct(EditHistoryQA.UndoBtn));
168+
await expect(undoBtn).toBeEnabled();
159169
await undoBtn.click();
160170

161171
const rowsCountAfterUndo = await page
@@ -165,6 +175,7 @@ datalensTest.describe('Dataset history', () => {
165175

166176
// Redo the duplication
167177
const redoBtn = page.locator(slct(EditHistoryQA.RedoBtn));
178+
await expect(redoBtn).toBeEnabled();
168179
await redoBtn.click();
169180

170181
const rowsCountAfterRedo = await page
@@ -195,6 +206,7 @@ datalensTest.describe('Dataset history', () => {
195206

196207
// Undo the removal
197208
const undoBtn = page.locator(slct(EditHistoryQA.UndoBtn));
209+
await expect(undoBtn).toBeEnabled();
198210
await undoBtn.click();
199211

200212
const rowsCountAfterUndo = await page
@@ -228,6 +240,7 @@ datalensTest.describe('Dataset history', () => {
228240

229241
// Undo the description change
230242
const undoBtn = page.locator(slct(EditHistoryQA.UndoBtn));
243+
await expect(undoBtn).toBeEnabled();
231244
await undoBtn.click();
232245

233246
const restoredValue = await descriptionInput.inputValue();
@@ -247,13 +260,15 @@ datalensTest.describe('Dataset history', () => {
247260

248261
// Undo
249262
const undoBtn = page.locator(slct(EditHistoryQA.UndoBtn));
263+
await expect(undoBtn).toBeEnabled();
250264
await undoBtn.click();
251265

252266
const afterUndo = await descriptionInput.inputValue();
253267
expect(afterUndo).toBe(originalValue);
254268

255269
// Redo
256270
const redoBtn = page.locator(slct(EditHistoryQA.RedoBtn));
271+
await expect(redoBtn).toBeEnabled();
257272
await redoBtn.click();
258273

259274
const afterRedo = await descriptionInput.inputValue();
@@ -281,6 +296,7 @@ datalensTest.describe('Dataset history', () => {
281296

282297
// Undo the type change
283298
const undoBtn = page.locator(slct(EditHistoryQA.UndoBtn));
299+
await expect(undoBtn).toBeEnabled();
284300
await undoBtn.click();
285301

286302
const restoredTypeText = await typeSelectBtn.textContent();
@@ -305,13 +321,15 @@ datalensTest.describe('Dataset history', () => {
305321

306322
// Undo
307323
const undoBtn = page.locator(slct(EditHistoryQA.UndoBtn));
324+
await expect(undoBtn).toBeEnabled();
308325
await undoBtn.click();
309326

310327
const afterUndo = await typeSelectBtn.textContent();
311328
expect(afterUndo).toBe(originalTypeText);
312329

313330
// Redo
314331
const redoBtn = page.locator(slct(EditHistoryQA.RedoBtn));
332+
await expect(redoBtn).toBeEnabled();
315333
await redoBtn.click();
316334

317335
const afterRedo = await typeSelectBtn.textContent();
@@ -343,6 +361,7 @@ datalensTest.describe('Dataset history', () => {
343361

344362
// Undo
345363
const undoBtn = page.locator(slct(EditHistoryQA.UndoBtn));
364+
await expect(undoBtn).toBeEnabled();
346365
await undoBtn.click();
347366

348367
const restoredAggregationText = await aggregationSelectBtn.textContent();
@@ -372,13 +391,15 @@ datalensTest.describe('Dataset history', () => {
372391

373392
// Undo
374393
const undoBtn = page.locator(slct(EditHistoryQA.UndoBtn));
394+
await expect(undoBtn).toBeEnabled();
375395
await undoBtn.click();
376396

377397
const afterUndo = await aggregationSelectBtn.textContent();
378398
expect(afterUndo).toBe(originalAggregationText);
379399

380400
// Redo
381401
const redoBtn = page.locator(slct(EditHistoryQA.RedoBtn));
402+
await expect(redoBtn).toBeEnabled();
382403
await redoBtn.click();
383404

384405
const afterRedo = await aggregationSelectBtn.textContent();
@@ -409,13 +430,15 @@ datalensTest.describe('Dataset history', () => {
409430

410431
// Undo
411432
const undoBtn = page.locator(slct(EditHistoryQA.UndoBtn));
433+
await expect(undoBtn).toBeEnabled();
412434
await undoBtn.click();
413435

414436
const afterUndo = await fieldInput.inputValue();
415437
expect(afterUndo).toBe(originalName);
416438

417439
// Redo
418440
const redoBtn = page.locator(slct(EditHistoryQA.RedoBtn));
441+
await expect(redoBtn).toBeEnabled();
419442
await redoBtn.click();
420443

421444
const afterRedo = await fieldInput.inputValue();
@@ -445,6 +468,7 @@ datalensTest.describe('Dataset history', () => {
445468
expect(rowsCountAfterDelete).toBe(rowsCountBefore - 2);
446469

447470
const undoBtn = page.locator(slct(EditHistoryQA.UndoBtn));
471+
await expect(undoBtn).toBeEnabled();
448472
await undoBtn.click();
449473

450474
const rowsCountAfterUndo = await page
@@ -453,6 +477,7 @@ datalensTest.describe('Dataset history', () => {
453477
expect(rowsCountAfterUndo).toBe(rowsCountBefore);
454478

455479
const redoBtn = page.locator(slct(EditHistoryQA.RedoBtn));
480+
await expect(redoBtn).toBeEnabled();
456481
await redoBtn.click();
457482

458483
const rowsCountAfterRedo = await page
@@ -489,6 +514,7 @@ datalensTest.describe('Dataset history', () => {
489514

490515
// Undo the batch hide
491516
const undoBtn = page.locator(slct(EditHistoryQA.UndoBtn));
517+
await expect(undoBtn).toBeEnabled();
492518
await undoBtn.click();
493519

494520
const rowsCountAfterUndo = await page
@@ -497,6 +523,7 @@ datalensTest.describe('Dataset history', () => {
497523
expect(rowsCountAfterUndo).toBe(rowsCountBefore);
498524

499525
const redoBtn = page.locator(slct(EditHistoryQA.RedoBtn));
526+
await expect(redoBtn).toBeEnabled();
500527
await redoBtn.click();
501528

502529
const rowsCountAfterRedo = await page
@@ -517,22 +544,26 @@ datalensTest.describe('Dataset history', () => {
517544
const undoBtn = page.locator(slct(EditHistoryQA.UndoBtn));
518545
const redoBtn = page.locator(slct(EditHistoryQA.RedoBtn));
519546

547+
await expect(undoBtn).toBeEnabled();
520548
await undoBtn.click();
521549

522550
const afterFirstUndo = await fieldInput.inputValue();
523551
expect(afterFirstUndo).toBe(step1Value);
552+
await expect(undoBtn).toBeEnabled();
524553
await undoBtn.click();
525554

526555
const afterUndoAll = await fieldInput.inputValue();
527556
expect(afterUndoAll).toBe(originalValue);
528557

529558
// Redo first
559+
await expect(redoBtn).toBeEnabled();
530560
await redoBtn.click();
531561

532562
const afterFirstRedo = await fieldInput.inputValue();
533563
expect(afterFirstRedo).toBe(step1Value);
534564

535565
// Redo second
566+
await expect(redoBtn).toBeEnabled();
536567
await redoBtn.click();
537568

538569
const afterSecondRedo = await fieldInput.inputValue();
@@ -550,6 +581,7 @@ datalensTest.describe('Dataset history', () => {
550581
datalensTest('Redo button becomes disabled at the end of history', async ({page}) => {
551582
await datasetPage.renameFirstField();
552583
const undoBtn = page.locator(slct(EditHistoryQA.UndoBtn));
584+
await expect(undoBtn).toBeEnabled();
553585
await undoBtn.click();
554586

555587
const redoBtn = page.locator(slct(EditHistoryQA.RedoBtn));
@@ -565,7 +597,7 @@ datalensTest.describe('Dataset history', () => {
565597
await expect(undoBtn).toBeEnabled();
566598
// Click outside the input to unfocus before using hotkey
567599
await page.locator(slct(DatasetFieldsTabQa.DatasetEditor)).click();
568-
await page.keyboard.press(`Meta+z`);
600+
await page.keyboard.press(`ControlOrMeta+z`);
569601

570602
const restoredValue = await fieldInput.inputValue();
571603
expect(restoredValue).toBe(originalValue);
@@ -577,13 +609,14 @@ datalensTest.describe('Dataset history', () => {
577609

578610
// Undo via button
579611
const undoBtn = page.locator(slct(EditHistoryQA.UndoBtn));
612+
await expect(undoBtn).toBeEnabled();
580613
await undoBtn.click();
581614

582615
const redoBtn = page.locator(slct(EditHistoryQA.RedoBtn));
583616
await expect(redoBtn).toBeEnabled();
584617
// Click outside the input to unfocus before using hotkey
585618
await page.locator(slct(DatasetFieldsTabQa.DatasetEditor)).click();
586-
await page.keyboard.press(`Meta+Shift+z`);
619+
await page.keyboard.press(`ControlOrMeta+Shift+z`);
587620

588621
const restoredValue = await fieldInput.inputValue();
589622
expect(restoredValue).toBe(changedValue);
@@ -617,6 +650,7 @@ datalensTest.describe('Dataset history', () => {
617650
const undoBtn = page.locator(slct(EditHistoryQA.UndoBtn));
618651

619652
// Undo step 2 (duplicate)
653+
await expect(undoBtn).toBeEnabled();
620654
await undoBtn.click();
621655

622656
const rowsCountAfterUndoDup = await page
@@ -627,6 +661,7 @@ datalensTest.describe('Dataset history', () => {
627661
expect(afterUndoFirst).toBe(newValue);
628662

629663
// Undo step 1 (rename)
664+
await expect(undoBtn).toBeEnabled();
630665
await undoBtn.click();
631666
const afterUndoAll = await fieldInput.inputValue();
632667
expect(afterUndoAll).toBe(originalValue);

0 commit comments

Comments
 (0)