Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ test.describe('Validate Transcoder Settings', () => {
await page.focus("input[id='new-api-key']");
await licenseSettings.fill("8c1a107c6c89bd9dda666a635f441890");
await page.locator("button[id='api-key-submit']").click();
await page.screenshot({ path: "uploads/uploads.png" })
//verify Save key
await expect(page.locator("div[class='updated']")).not.toBeNull()
await page.locator("#submit").click();
Expand Down
18 changes: 12 additions & 6 deletions tests/e2e-playwright/specs/02_validate-webm-completed.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ test.describe('Validate Webm File upload Asssert All Status', () => {
await page.waitForSelector("div[id*='span_status']");
const tweets = page.locator("div[id*='span_status']");
var result = await tweets.evaluate(node => node.innerText);
// Declaring Variables so that Loops Will break after certain period of time
// Declaring Variables so that Loops Will break after Successfull Execution
var _hasTimeElasped = false;
setTimeout(() => {
_hasTimeElasped = true;
console.log("Time Elapsed")
}, 90000)
}, 60000)
// Loop To Assert Updated Messages
while (result == TransCodeStatus.Processing || result == TransCodeStatus.Queue || TransCodeStatus.ServerReady) {
// Loop Breaker After Timeout
Expand All @@ -65,10 +65,16 @@ test.describe('Validate Webm File upload Asssert All Status', () => {
if (result == TransCodeStatus.Completed || result == TransCodeStatus.Error) {
break;
}

}
// Final Assertion after completion.
const comPleteMessage = page.locator("div[id*='span_status']");
expect(await comPleteMessage.evaluate(node => node.innerText)).toContain('Your file is transcoded successfully.');
// Delete The media to Execute the next Test cases
await page.locator("td.title.column-title.has-row-actions.column-primary ").first().hover();
await page.locator("td.title.column-title.has-row-actions.column-primary > div > span.edit").first().click();
// Wait for New page to load
await page.waitForSelector("#title");
await page.waitForSelector("#attachment_caption");
await expect(page).toHaveURL(/action=edit/)
// Delete media After testing
page.on('dialog', dialog => dialog.accept());
await page.locator("#delete-action > a").click();
});
});
15 changes: 10 additions & 5 deletions tests/e2e-playwright/specs/03_validate-3gp-completed.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,15 @@ test.describe('Validate 3gp File Upload and assert All transcoded Status', () =>
break;
}
}
// Final Assertion after completion.
const comPleteMessage = page.locator("div[id*='span_status']");
expect(await comPleteMessage.evaluate(node => node.innerText)).toContain('Your file is transcoded successfully.');
await page.reload();
await expect(checkStatus).toBeHidden();
// Delete The media to Execute the next Test cases
await page.locator("td.title.column-title.has-row-actions.column-primary ").first().hover();
await page.locator("td.title.column-title.has-row-actions.column-primary > div > span.edit").first().click();
// Wait for New page to load
await page.waitForSelector("#title");
await page.waitForSelector("#attachment_caption");
await expect(page).toHaveURL(/action=edit/)
// Delete media After testing
page.on('dialog', dialog => dialog.accept());
await page.locator("#delete-action > a").click();
});
});
13 changes: 8 additions & 5 deletions tests/e2e-playwright/specs/04_validate-3g2-error.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,15 @@ test.describe('Validate 3g2 Media types and error message', () => {
break;
}
}
const comPleteMessage = page.locator("div[id*='span_status']");
expect(await comPleteMessage.evaluate(node => node.innerText)).toContain('Transcoder failed to transcode this file.');
// Delete The media to Execute the next Test cases
await page.locator("role=link[name='“3g2-sample” (Edit)']").first().hover();
await page.locator("td.title.column-title.has-row-actions.column-primary ").first().hover();
await page.locator("td.title.column-title.has-row-actions.column-primary > div > span.edit").first().click();
// Wait for New page to load
await page.waitForSelector("#title");
await page.waitForSelector("#attachment_caption");
await expect(page).toHaveURL(/action=edit/)
// Delete media After testing
page.on('dialog', dialog => dialog.accept());
await page.locator("role=button[name='Delete “3g2-sample” permanently']").click();
await expect(checkStatus).toBeHidden();
await page.locator("#delete-action > a").click();
});
});
62 changes: 37 additions & 25 deletions tests/e2e-playwright/specs/05_validate-other-file-status.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,16 @@ test.describe('Validate mp3 and mp4 ogg, PDF types and Assert All Steps', () =>
break;
}
}
// Final Assertion after completion.
const comPleteMessage = page.locator("div[id*='span_status']");
expect(await comPleteMessage.evaluate(node => node.innerText)).toContain('processed');
// Delete The media to Execute the next Test cases
await page.locator("role=link[name='“ogg-sample” (Edit)']").first().hover();
// Delete the media and verify Media can be accessed
await page.locator("td.title.column-title.has-row-actions.column-primary ").first().hover();
await page.locator("td.title.column-title.has-row-actions.column-primary > div > span.edit").first().click();
// Wait for New page to load
await page.waitForSelector("#title");
await page.waitForSelector("#attachment_caption");
await expect(page).toHaveURL(/action=edit/)
// Delete media After testing
page.on('dialog', dialog => dialog.accept());
await page.locator("role=button[name='Delete “ogg-sample” permanently']").first().click();
await expect(checkStatus).toBeHidden();
await page.locator("#delete-action > a").click();
});

test('Check mp3 sample', async ({ admin, page, editor }) => {
Expand Down Expand Up @@ -102,10 +104,15 @@ test.describe('Validate mp3 and mp4 ogg, PDF types and Assert All Steps', () =>
// Check File is already transcoded
const checkMessage = page.locator("div[id*='span_status']").first();
expect(checkMessage).not.toBeNull();
// Delete The media to Execute the next Test cases
await page.locator("role=link[name='“Impact Moderato” (Edit)']").first().hover();
await page.locator("td.title.column-title.has-row-actions.column-primary ").first().hover();
await page.locator("td.title.column-title.has-row-actions.column-primary > div > span.edit").first().click();
// Wait for New page to load
await page.waitForSelector("#title");
await page.waitForSelector("#attachment_caption");
await expect(page).toHaveURL(/action=edit/)
// Delete media After testing
page.on('dialog', dialog => dialog.accept());
await page.locator("role=button[name='Delete “Impact Moderato” permanently']").first().click();
await page.locator("#delete-action > a").click();
});

test('Check mp4 sample', async ({ admin, page, editor }) => {
Expand Down Expand Up @@ -166,13 +173,15 @@ test.describe('Validate mp3 and mp4 ogg, PDF types and Assert All Steps', () =>
}
}
// Final Assertion after completion.
const comPleteMessage = page.locator("div[id*='span_status']");
expect(await comPleteMessage.evaluate(node => node.innerText)).toContain('processed');
//Delete The media to Execute the next Test cases
await page.locator("role=link[name='“mp4-sample” (Edit)']").first().hover();
await page.locator("td.title.column-title.has-row-actions.column-primary ").first().hover();
await page.locator("td.title.column-title.has-row-actions.column-primary > div > span.edit").first().click();
// Wait for New page to load
await page.waitForSelector("#title");
await page.waitForSelector("#attachment_caption");
await expect(page).toHaveURL(/action=edit/)
// Delete media After testing
page.on('dialog', dialog => dialog.accept());
await page.locator("role=button[name='Delete “mp4-sample” permanently']").first().click();
await expect(checkStatus).toBeHidden();
await page.locator("#delete-action > a").click();
});
test('Check pdf sample', async ({ admin, page, editor }) => {
const pdfPath = "assets/pdf-sample.pdf";
Expand Down Expand Up @@ -205,16 +214,16 @@ test.describe('Validate mp3 and mp4 ogg, PDF types and Assert All Steps', () =>
expect(checkMessage).not.toBeNull();

// Check For Transcoding status and wait until File is getting transcoded
await checkStatus.click();
await page.focus("div[id*='span_status']")
await page.waitForSelector("div[id*='span_status']");
// await checkStatus.click();
// await page.focus("div[id*='span_status']")
// await page.waitForSelector("div[id*='span_status']");
const tweets = page.locator("div[id*='span_status']");
var result = await tweets.evaluate(node => node.innerText);
var _hasTimeElasped = false;
setTimeout(() => {
_hasTimeElasped = true;
console.log("Time Elapsed")
}, 10000)
}, 20000)
// Loop To Assert Updated Messages
while (result == TransCodeStatus.Processing || result == TransCodeStatus.Queue || TransCodeStatus.ServerReady) {
// Loop Breaker After Timeout
Expand All @@ -232,12 +241,15 @@ test.describe('Validate mp3 and mp4 ogg, PDF types and Assert All Steps', () =>
}
}
// Final Assertion after completion.
const comPleteMessage = page.locator("div[id*='span_status']");
expect(await comPleteMessage.evaluate(node => node.innerText)).toContain('Your file is transcoded successfully. Please refresh the page.');
// Delete The media to Execute the next Test cases
await page.locator("role=link[name='“pdf-sample” (Edit)']").first().hover();
await page.locator("td.title.column-title.has-row-actions.column-primary ").first().hover();
await page.locator("td.title.column-title.has-row-actions.column-primary > div > span.edit").first().click();
// Wait for New page to load
await page.waitForSelector("#title");
await page.waitForSelector("#attachment_caption");
await expect(page).toHaveURL(/action=edit/)
// Delete media After testing
page.on('dialog', dialog => dialog.accept());
await page.locator("role=button[name='Delete “pdf-sample” permanently']").first().click();
await page.locator("#delete-action > a").click();

});
});
64 changes: 58 additions & 6 deletions tests/e2e-playwright/specs/07_validate-retranscoded-media.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,82 @@
* WordPress dependencies
*/
const { test, expect } = require('@wordpress/e2e-test-utils-playwright');

const { setTimeout } = require('timers');
const { TransCodeStatus } = require("../utils/locator.js");
test.describe('Validate ReTranscoded Settings', () => {
test.beforeEach(async ({ admin }) => {
await admin.visitAdminPage('/');
});
test('Validate new retranscoded Settings', async ({ admin, page, editor }) => {
await admin.visitAdminPage("media-new.php")
const pdfPath = "assets/pdf-sample.pdf";
// Upload Video
const videoPath = "assets/3gp-sample.3gp";
const [fileChooser] = await Promise.all([
// It is important to call waitForEvent before click to set up waiting.
page.waitForEvent('filechooser'),
// Opens the file chooser.
page.locator('#plupload-browse-button').click(),

])
await fileChooser.setFiles([
pdfPath,
videoPath,
])
// Check Upload is completed
const item = await page.locator("#wpbody-content > div.wrap > h1");
await expect(item).toBeVisible();

// Check Copy to clipboard is working
const copyButton = "button[class='button button-small copy-attachment-url']";
if (await page.locator(copyButton).isEnabled()) {
await page.click(copyButton)
}
// Goto Media and Check for Check status Button visibility
await admin.visitAdminPage("upload.php");
//Select Grid
//Select Grid Type
await page.locator("a[id='view-switch-list']").click();
const checkStatus = page.locator("button[id^='btn_check_status']").first();
expect(checkStatus).not.toBeNull();
await checkStatus.click();
const checkMessage = page.locator("div[id*='span_status']").first();
expect(checkMessage).not.toBeNull();

// Check For Transcoding status and wait until File is getting transcoded
await checkStatus.click();
await page.focus("div[id*='span_status']")
await page.waitForSelector("div[id*='span_status']");
const tweets = page.locator("div[id*='span_status']");
var result = await tweets.evaluate(node => node.innerText);
var _hasTimeElasped = false;
setTimeout(() => {
_hasTimeElasped = true;
console.log("Time Elapsed")
}, 90000)
// Loop To Assert Updated Messages
while (result == TransCodeStatus.Processing || result == TransCodeStatus.Queue || TransCodeStatus.ServerReady) {
// Loop Breaker After Timeout
if (_hasTimeElasped) {
break;
}
await checkStatus.click();
await page.focus("div[id*='span_status']")
await page.waitForSelector("div[id*='span_status']");
const tweets = page.locator("div[id*='span_status']");
result = await tweets.evaluate(node => node.innerText);
console.log("Inside Loop:", result);
if (result == TransCodeStatus.Completed || result == TransCodeStatus.Error) {
break;
}
}
// Final Assertion after completion.
const comPleteMessage = page.locator("div[id*='span_status']");
expect(await comPleteMessage.evaluate(node => node.innerText)).toContain('Your file is transcoded successfully.');
await expect(checkStatus).toBeHidden();
// Retranscode
await page.locator("td.title.column-title.has-row-actions.column-primary > strong > a").first().hover();
await page.locator("a[title='Retranscode this single media']").first().click();
// Validate with proper visiblity
const result = await page.locator("div[id='retranscodemedia-bar-percent']").innerText();
if (result == '100%' && page.locator("div[id='retranscodemedia-bar-percent']").isEnabled()) {
const result_text = await page.locator("div[id='retranscodemedia-bar-percent']").innerText();
if (result_text == '100%' && page.locator("div[id='retranscodemedia-bar-percent']").isEnabled()) {
await page.locator("#toplevel_page_rt-transcoder > a > div.wp-menu-name").click()
}
});
Expand All @@ -55,5 +97,15 @@ test.describe('Validate ReTranscoded Settings', () => {
await page.locator("#toplevel_page_rt-transcoder > a > div.wp-menu-name").click()
}
});
test('Clear All Media after Testing', async ({admin, page }) => {
await admin.visitAdminPage("upload.php");
//Select All Media
await page.locator("#cb-select-all-1").check();
// Select Bulk Delete Option
await page.locator("#bulk-action-selector-top").selectOption("delete");
// Click Apply
page.on('dialog', dialog => dialog.accept());
await page.locator("#doaction").click();
});

});