Some Changes
This commit is contained in:
@@ -9,16 +9,25 @@ fs.mkdirSync(screenshotDir, { recursive: true });
|
||||
* Test Case: Create Zones After Moving Canvas
|
||||
*/
|
||||
test('Create zones after moving canvas', async ({ page }) => {
|
||||
test.setTimeout(120000); // Increase timeout to 2 minutes
|
||||
|
||||
// 1. Navigate to the application, log in, and set up
|
||||
await loginAndSetup(page);
|
||||
|
||||
// 2. Switch to 2D mode
|
||||
console.log('Switching to 2D mode...');
|
||||
await page.locator('.toggle-option:has-text("2d")').click();
|
||||
|
||||
// 3. Move the canvas to the top position
|
||||
await moveCanvas(page);
|
||||
|
||||
await page.waitForTimeout(2000); // Wait for the canvas to be moved
|
||||
// Wait for the canvas to stabilize
|
||||
console.log('Waiting for canvas to stabilize...');
|
||||
await page.waitForTimeout(5000); // Increased delay to ensure stability
|
||||
|
||||
// Take a screenshot after moving the canvas
|
||||
await page.screenshot({ path: `${screenshotDir}/canvas-moved.png` });
|
||||
console.log('Canvas moved. Screenshot saved.');
|
||||
|
||||
// 4. Select the zone tool
|
||||
console.log('Selecting zone tool...');
|
||||
@@ -53,15 +62,22 @@ test('Create zones after moving canvas', async ({ page }) => {
|
||||
* Test Case: Delete Zones After Moving Canvas
|
||||
*/
|
||||
test('Delete zones after moving canvas', async ({ page }) => {
|
||||
test.setTimeout(120000); // Increase timeout to 2 minutes
|
||||
|
||||
// 1. Navigate to the application, log in, and set up
|
||||
await loginAndSetup(page);
|
||||
|
||||
// 2. Switch to 2D mode
|
||||
console.log('Switching to 2D mode...');
|
||||
await page.locator('.toggle-option:has-text("2d")').click();
|
||||
|
||||
// 3. Move the canvas to the top position
|
||||
await moveCanvas(page);
|
||||
|
||||
// Wait for the canvas to stabilize
|
||||
console.log('Waiting for canvas to stabilize...');
|
||||
await page.waitForTimeout(5000); // Increased delay to ensure stability
|
||||
|
||||
// Open the "3 dots" menu and select the delete tool
|
||||
console.log('Opening three-dot menu...');
|
||||
await page.locator('.drop-down-option-button > svg').click();
|
||||
@@ -69,7 +85,7 @@ test('Delete zones after moving canvas', async ({ page }) => {
|
||||
await page.locator('div').filter({ hasText: /^Delete$/ }).first().click();
|
||||
|
||||
// Wait for the delete tool to be active
|
||||
await page.waitForTimeout(500); // Adjust timeout if necessary
|
||||
await page.waitForTimeout(2000); // Adjust timeout if necessary
|
||||
|
||||
// Define zone paths (same as creation)
|
||||
const zonePaths = [
|
||||
@@ -108,11 +124,11 @@ async function createZones(page, zonePaths) {
|
||||
|
||||
// First click (start point)
|
||||
await simulatePointerClick(page, start.x, start.y);
|
||||
await page.waitForTimeout(500); // Delay after the first click
|
||||
await page.waitForTimeout(500); // Increased delay after the first click
|
||||
|
||||
// Second click (end point)
|
||||
await simulatePointerClick(page, end.x, end.y);
|
||||
await page.waitForTimeout(500); // Delay after the second click
|
||||
await page.waitForTimeout(500); // Increased delay after the second click
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,11 +144,11 @@ async function deleteZones(page, zonePaths) {
|
||||
|
||||
// First click (start point)
|
||||
await simulatePointerClick(page, start.x, start.y);
|
||||
await page.waitForTimeout(500); // Delay after the first click
|
||||
await page.waitForTimeout(500); // Increased delay after the first click
|
||||
|
||||
// Second click (end point)
|
||||
await simulatePointerClick(page, end.x, end.y);
|
||||
await page.waitForTimeout(500); // Delay after the second click
|
||||
await page.waitForTimeout(500); // Increased delay after the second click
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user