Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
321 changes: 161 additions & 160 deletions tests/test-env/playwright-specific/drag-n-drop.spec.js
Original file line number Diff line number Diff line change
@@ -1,160 +1,161 @@
import { test } from '@playwright/test';

const TIMEOUT = 5000;

test.describe('Locator API - Drag Ang Drop - Tests', () => {
test.beforeEach(async ({ page }) => {
await page.goto('https://healenium.github.io/healenium-test-env/index.html', { waitUntil: 'load' });
});

test('source - playwright-specific', async ({ page }) => {
test.slow();

const draggableElement = page.locator('.drag-container').getByText('Green Item');
const droppableElement = page.locator('#drop1');
await draggableElement.dragTo(droppableElement, { timeout: TIMEOUT });

// Click Change locators button to test healing
const submitBtn = page.locator('#Submit');
await submitBtn.click();

// Test healing - same action should work after locator change
const healedDraggableElement = page.locator('.drag-container').getByText('Green Item');
const healedDroppableElement = page.locator('#drop1');
await healedDraggableElement.dragTo(healedDroppableElement, { timeout: TIMEOUT });
});

test('source - XPath', async ({ page }) => {
test.slow();

const draggableElement = page.locator('//div[@class="drag-container"]/div[@name="dragRed"]');
const droppableElement = page.locator('#drop1');
await draggableElement.dragTo(droppableElement, { timeout: TIMEOUT });

// Click Change locators button to test healing
const submitBtn = page.locator('#Submit');
await submitBtn.click();

// Test healing - same action should work after locator change
const healedDraggableElement = page.locator('//div[@class="drag-container"]/div[@name="dragRed"]');
const healedDroppableElement = page.locator('#drop1');
await healedDraggableElement.dragTo(healedDroppableElement, { timeout: TIMEOUT });
});

test('target - playwright-specific', async ({ page }) => {
test.slow();

const draggableElement = page.locator('.drag-container').getByText('Green Item');
const droppableElement = page.getByTestId('testid_drop1');
await draggableElement.dragTo(droppableElement, { timeout: TIMEOUT });

// Click Change locators button to test healing
const submitBtn = page.locator('#Submit_checkbox');
await submitBtn.click();

// Test healing - same action should work after locator change
const healedDraggableElement = page.locator('.drag-container').getByText('Green Item');
const healedDroppableElement = page.getByTestId('testid_drop1');
await healedDraggableElement.dragTo(healedDroppableElement, { timeout: TIMEOUT });
});

test('target - CSS', async ({ page }) => {
test.slow();

const draggableElement = page.locator('.drag-container').getByText('Green Item');
const droppableElement = page.locator('#drop1');
await draggableElement.dragTo(droppableElement, { timeout: TIMEOUT });

// Click Change locators button to test healing
const submitBtn = page.locator('#Submit_checkbox');
await submitBtn.click();

// Test healing - same action should work after locator change
const healedDraggableElement = page.locator('.drag-container').getByText('Green Item');
const healedDroppableElement = page.locator('#drop1');
await healedDraggableElement.dragTo(healedDroppableElement, { timeout: TIMEOUT });
});

test('source and target - playwright-specific both', async ({ page }) => {
test.slow();

const draggableElement = page.locator('.drag-container').getByText('Green Item');
const droppableElement = page.getByTestId('testid_drop1');
await draggableElement.dragTo(droppableElement, { timeout: TIMEOUT });

// Click Change locators button to test healing
await page.locator('#Submit').click();
await page.locator('#Submit_checkbox').click();

// Test healing - same action should work after locator change
const healedDraggableElement = page.locator('.drag-container').getByText('Green Item');
const healedDroppableElement = page.getByTestId('testid_drop1');
await healedDraggableElement.dragTo(healedDroppableElement, { timeout: TIMEOUT });
});

test('source and target - XPath, CSS', async ({ page }) => {
test.slow();

const draggableElement = page.locator('//div[@class="drag-container"]/div[@name="dragRed"]');
const droppableElement = page.locator('#drop1');
await draggableElement.dragTo(droppableElement, { timeout: TIMEOUT });

// Click Change locators button to test healing
await page.locator('#Submit').click();
await page.locator('#Submit_checkbox').click();

// Test healing - same action should work after locator change
const healedDraggableElement = page.locator('//div[@class="drag-container"]/div[@name="dragRed"]');
const healedDroppableElement = page.locator('#drop1');
await healedDraggableElement.dragTo(healedDroppableElement, { timeout: TIMEOUT });
});

test('source and target - XPath, playwright-specific', async ({ page }) => {
test.slow();

const draggableElement = page.locator('//div[@class="drag-container"]/div[@name="dragRed"]');
const droppableElement = page.getByTestId('testid_drop1');
await draggableElement.dragTo(droppableElement, { timeout: TIMEOUT });

// Click Change locators button to test healing
await page.locator('#Submit').click();
await page.locator('#Submit_checkbox').click();

// Test healing - same action should work after locator change
const healedDraggableElement = page.locator('//div[@class="drag-container"]/div[@name="dragRed"]');
const healedDroppableElement = page.getByTestId('testid_drop1');
await healedDraggableElement.dragTo(healedDroppableElement, { timeout: TIMEOUT });
});

test('source and target - playwright-specific, CSS', async ({ page }) => {
test.slow();

const draggableElement = page.locator('.drag-container').getByText('Green Item');
const droppableElement = page.locator('#drop1');
await draggableElement.dragTo(droppableElement, { timeout: TIMEOUT });

// Click Change locators button to test healing
await page.locator('#Submit').click();
await page.locator('#Submit_checkbox').click();

// Test healing - same action should work after locator change
const healedDraggableElement = page.locator('.drag-container').getByText('Green Item');
const healedDroppableElement = page.locator('#drop1');
await healedDraggableElement.dragTo(healedDroppableElement, { timeout: TIMEOUT });
});


test('page.dragAndDrop', async ({ page }) => {
test.slow();

await page.dragAndDrop('//div[@class="drag-container"]/div[@name="dragRed"]', '#drop1', { timeout: TIMEOUT });

// Click Change locators button to test healing
await page.locator('#Submit').click();
await page.locator('#Submit_checkbox').click();

// Test healing - same action should work after locator change
await page.dragAndDrop('//div[@class="drag-container"]/div[@name="dragRed"]', '#drop1', { timeout: TIMEOUT });
});

});

import { test } from '@playwright/test';

const TIMEOUT = 5000;

test.describe('Locator API - Drag Ang Drop - Tests', () => {
test.beforeEach(async ({ page }) => {
await page.goto('https://healenium.github.io/healenium-test-env/index.html', { waitUntil: 'load' });
});

test('source - playwright-specific', async ({ page }) => {
test.slow();

const draggableElement = page.locator('div.drag-container > div.draggable-item.green-item');
const droppableElement = page.locator('#drop1');
await draggableElement.dragTo(droppableElement, { timeout: TIMEOUT });

// Click Change locators button to test healing
const submitBtn = page.locator('#Submit');
await submitBtn.click();

// Test healing - same action should work after locator change
const healedDraggableElement = page.locator('div.drag-container > div.draggable-item.green-item');
const healedDroppableElement = page.locator('#drop1');
await healedDraggableElement.dragTo(healedDroppableElement, { timeout: TIMEOUT });
});

test('source - XPath', async ({ page }) => {
test.slow();

const draggableElement = page.locator('//div[@class="drag-container"]/div[@name="dragRed"]');
const droppableElement = page.locator('#drop1');
await draggableElement.dragTo(droppableElement, { timeout: TIMEOUT });

// Click Change locators button to test healing
const submitBtn = page.locator('#Submit');
await submitBtn.click();

// Test healing - same action should work after locator change
const healedDraggableElement = page.locator('//div[@class="drag-container"]/div[@name="dragRed"]');
const healedDroppableElement = page.locator('#drop1');
await healedDraggableElement.dragTo(healedDroppableElement, { timeout: TIMEOUT });
});

test('target - playwright-specific', async ({ page }) => {
test.slow();

const draggableElement = page.locator('div.drag-container > div.draggable-item.green-item');
const droppableElement = page.getByTestId('testid_drop1');
await draggableElement.dragTo(droppableElement, { timeout: TIMEOUT });

// Click Change locators button to test healing
const submitBtn = page.locator('#Submit_checkbox');
await submitBtn.click();

// Test healing - same action should work after locator change
const healedDraggableElement = page.locator('div.drag-container > div.draggable-item.green-item');
const healedDroppableElement = page.getByTestId('testid_drop1');
await healedDraggableElement.dragTo(healedDroppableElement, { timeout: TIMEOUT });
});

test('target - CSS', async ({ page }) => {
test.slow();

const draggableElement = page.locator('div.drag-container > div.draggable-item.green-item');
const droppableElement = page.locator('#drop1');
await draggableElement.dragTo(droppableElement, { timeout: TIMEOUT });

// Click Change locators button to test healing
const submitBtn = page.locator('#Submit_checkbox');
await submitBtn.click();

// Test healing - same action should work after locator change
const healedDraggableElement = page.locator('div.drag-container > div.draggable-item.green-item');
const healedDroppableElement = page.locator('#drop1');
await healedDraggableElement.dragTo(healedDroppableElement, { timeout: TIMEOUT });
});

test('source and target - playwright-specific both', async ({ page }) => {
test.slow();

const draggableElement = page.locator('div.drag-container > div.draggable-item.green-item');
const droppableElement = page.getByTestId('testid_drop1');
await draggableElement.dragTo(droppableElement, { timeout: TIMEOUT });

// Click Change locators button to test healing
await page.locator('#Submit').click();
await page.locator('#Submit_checkbox').click();

// Test healing - same action should work after locator change
const healedDraggableElement = page.locator('div.drag-container > div.draggable-item.green-item');
const healedDroppableElement = page.getByTestId('testid_drop1');
await healedDraggableElement.dragTo(healedDroppableElement, { timeout: TIMEOUT });
});

test('source and target - XPath, CSS', async ({ page }) => {
test.slow();

const draggableElement = page.locator('//div[@class="drag-container"]/div[@name="dragRed"]');
const droppableElement = page.locator('#drop1');
await draggableElement.dragTo(droppableElement, { timeout: TIMEOUT });

// Click Change locators button to test healing
await page.locator('#Submit').click();
await page.locator('#Submit_checkbox').click();

// Test healing - same action should work after locator change
const healedDraggableElement = page.locator('//div[@class="drag-container"]/div[@name="dragRed"]');
const healedDroppableElement = page.locator('#drop1');
await healedDraggableElement.dragTo(healedDroppableElement, { timeout: TIMEOUT });
});

test('source and target - XPath, playwright-specific', async ({ page }) => {
test.slow();

const draggableElement = page.locator('//div[@class="drag-container"]/div[@name="dragRed"]');
const droppableElement = page.getByTestId('testid_drop1');
await draggableElement.dragTo(droppableElement, { timeout: TIMEOUT });

// Click Change locators button to test healing
await page.locator('#Submit').click();
await page.locator('#Submit_checkbox').click();

// Test healing - same action should work after locator change
const healedDraggableElement = page.locator('//div[@class="drag-container"]/div[@name="dragRed"]');
const healedDroppableElement = page.getByTestId('testid_drop1');
await healedDraggableElement.dragTo(healedDroppableElement, { timeout: TIMEOUT });
});

test('source and target - playwright-specific, CSS', async ({ page }) => {
test.slow();

const draggableElement = page.locator('div.drag-container > div.draggable-item.green-item');
const droppableElement = page.locator('#drop1');
await draggableElement.dragTo(droppableElement, { timeout: TIMEOUT });

// Click Change locators button to test healing
await page.locator('#Submit').click();
await page.locator('#Submit_checkbox').click();

// Test healing - same action should work after locator change
const healedDraggableElement = page.locator('div.drag-container > div.draggable-item.green-item');
const healedDroppableElement = page.locator('#drop1');
await healedDraggableElement.dragTo(healedDroppableElement, { timeout: TIMEOUT });
});


test('page.dragAndDrop', async ({ page }) => {
test.slow();

await page.dragAndDrop('//div[@class="drag-container"]/div[@name="dragRed"]', '#drop1', { timeout: TIMEOUT });

// Click Change locators button to test healing
await page.locator('#Submit').click();
await page.locator('#Submit_checkbox').click();

// Test healing - same action should work after locator change
await page.dragAndDrop('//div[@class="drag-container"]/div[@name="dragRed"]', '#drop1', { timeout: TIMEOUT });
});

});