Skip to content
Open
Binary file added nala/assets/1-PDF-merge-pdf-1.pdf
Binary file not shown.
Binary file added nala/assets/1-PDF-merge-pdf-2.pdf
Binary file not shown.
Binary file added nala/assets/guddy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions nala/features/merge-pdf/merge-pdf.page.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import AcrobatWidget from '../../widget/acrobat-widget.cjs';

export default class MergePdf extends AcrobatWidget {
constructor(page, nth = 0) {
super(page, '.combine-pdf.unity-enabled', nth);
}
}
16 changes: 16 additions & 0 deletions nala/features/merge-pdf/merge-pdf.spec.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
FeatureName: 'Merge PDF',
features: [
{
tcid: '0',
name: '@merge-pdf',
path: '/drafts/nala/acrobat/online/test/merge-pdf',
data: {
verbTitle: 'Adobe Acrobat',
verbHeading: 'Merge PDF files',
verbCopy: 'Drag and drop PDFs to merge them into one file with our PDF combiner.',
},
tags: '@merge-pdf @smoke @regression @unity',
},
],
};
63 changes: 63 additions & 0 deletions nala/features/merge-pdf/merge-pdf.test.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import path from 'path';
import { expect, test } from '@playwright/test';
import { features } from './merge-pdf.spec.cjs';
import MergePdf from './merge-pdf.page.cjs';

const pdfFilePath1 = path.resolve(__dirname, '../../assets/1-PDF-merge-pdf-1.pdf');
const pdfFilePath2 = path.resolve(__dirname, '../../assets/1-PDF-merge-pdf-2.pdf');

let mergePdf;

const unityLibs = process.env.UNITY_LIBS || '';

test.describe('Unity Merge PDF test suite', () => {
test.beforeEach(async ({ page }) => {
mergePdf = new MergePdf(page);
});

// Test 0 : Merge PDF
test(`${features[0].name},${features[0].tags}`, async ({ page, baseURL }) => {
console.info(`[Test Page]: ${baseURL}${features[0].path}${unityLibs}`);
const { data } = features[0];

await test.step('step-1: Go to Merge PDF test page', async () => {
await page.goto(`${baseURL}${features[0].path}${unityLibs}`);
await page.waitForLoadState('domcontentloaded');
await expect(page).toHaveURL(`${baseURL}${features[0].path}${unityLibs}`);
});

await test.step('step-2: Verify Merge PDF widget content/specs', async () => {
await expect(await mergePdf.widget).toBeVisible();
await expect(await mergePdf.dropZone).toBeVisible();
await expect(await mergePdf.verbImage).toBeVisible();
await expect(await mergePdf.acrobatIcon).toBeVisible();
const actualText = await mergePdf.verbHeader.textContent();
expect(actualText.trim()).toBe(data.verbHeading);
await expect(await mergePdf.verbTitle).toContainText(data.verbTitle);
await expect(await mergePdf.verbCopy).toContainText(data.verbCopy);
});

await test.step('step-3: Upload a sample PDF files to be merged', async () => {
// upload and wait for some page change indicator (like a new element or URL change)
const fileInput = page.locator('input[type="file"]#file-upload');
await page.waitForTimeout(10000);
await fileInput.setInputFiles([pdfFilePath1, pdfFilePath2]);
await page.waitForTimeout(15000);

// Verify the URL parameters
const currentUrl = page.url();
console.log(`[Post-upload URL]: ${currentUrl}`);
const urlObj = new URL(currentUrl);
expect(urlObj.searchParams.get('x_api_client_id')).toBe('unity');
expect(urlObj.searchParams.get('x_api_client_location')).toBe('combine-pdf');
expect(urlObj.searchParams.get('user')).toBe('frictionless_new_user');
expect(urlObj.searchParams.get('attempts')).toBe('1st');
console.log({
x_api_client_id: urlObj.searchParams.get('x_api_client_id'),
x_api_client_location: urlObj.searchParams.get('x_api_client_location'),
user: urlObj.searchParams.get('user'),
attempts: urlObj.searchParams.get('attempts'),
});
});
});
});
14 changes: 14 additions & 0 deletions nala/features/photoshop/unitywidget1/unitywidget.page.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export default class psUnityWidget {
constructor(page) {
this.page = page;
this.unityWidgetContainer = page.locator('.upload.upload-block.con-block.unity-enabled');
this.unityVideo = this.unityWidgetContainer.locator('.video-container.video-holder').nth(0);
this.dropZone = this.unityWidgetContainer.locator('.drop-zone-container').nth(0);
this.dropZoneText = this.dropZone.locator('//div[@class="drop-zone-container"]/div[@class="drop-zone"]/p[1]').nth(2);
this.dropZoneFileText = this.dropZone.locator('//div[@class="drop-zone-container"]/div[@class="drop-zone"]/p[2]').nth(2);
this.fileUploadCta = this.unityWidgetContainer.locator('.con-button.blue.action-button.button-xl').nth(2);
this.legelTerms = this.unityWidgetContainer.locator('//a[@daa-ll="Terms of Use-11--"]');
this.privacyPolicy = this.unityWidgetContainer.locator('//a[@daa-ll="Privacy Policy-12--"]');
this.splashScreen = this.unityWidgetContainer.locator('//div[@class="fragment splash -loader show" and @style="display: none"]');
}
}
31 changes: 31 additions & 0 deletions nala/features/photoshop/unitywidget1/unitywidget.spec.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports = {
FeatureName: 'PS Unity Widget',
features: [
{
tcid: '0',
name: '@ps-unityUI',
path: '/drafts/nala/unity/remove-background?georouting=off',
data: {
CTATxt: 'Upload your photo',
fileFormatTxt: 'File must be JPEG, JPG or PNG and up to 40MB',
dropZoneTxt: 'Drag and drop an image to try it today.',
},
tags: '@ps-unity @smoke @regression @unity',
},

{
tcid: '1',
name: '@ps-unityFileUpload',
path: '/drafts/nala/unity/remove-background?georouting=off',
tags: '@ps-unity @smoke @regression @unity',
},

{
tcid: '2',
name: '@ps-unityPSProductpage',
path: '/drafts/nala/unity/remove-background?georouting=off',
url: 'stage.try.photoshop.adobe.com',
tags: '@ps-unity @smoke @regression @unity',
},
],
};
75 changes: 75 additions & 0 deletions nala/features/photoshop/unitywidget1/unitywidget.test.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import path from 'path';
import { expect, test } from '@playwright/test';
import { features } from './unitywidget.spec.cjs';
import UnityWidget from './unitywidget.page.cjs';

const imageFilePath = path.resolve(__dirname, '../../../assets/guddy.png');
console.log(__dirname);

let unityWidget;
const unityLibs = process.env.UNITY_LIBS || '';

test.describe('Unity Widget PS test suite', () => {
test.beforeEach(async ({ page }) => {
unityWidget = new UnityWidget(page);
await page.setViewportSize({ width: 1250, height: 850 });
await page.context().clearCookies();
});

// Test 0 : Unity Widget PS UI checks
test(`${features[0].name},${features[0].tags}`, async ({ page, baseURL }) => {
const ccBaseURL = baseURL.replace('--dc--', '--cc--');
console.info(`[Test Page]: ${ccBaseURL}${features[0].path}${unityLibs}`);

await test.step('step-1: Go to Unity Widget PS test page', async () => {
await page.goto(`${ccBaseURL}${features[0].path}${unityLibs}`);
await page.waitForLoadState('domcontentloaded');
await expect(page).toHaveURL(`${ccBaseURL}${features[0].path}${unityLibs}`);
});

await test.step('step-2: Verify Unity Widget PS verb user interface', async () => {
await page.waitForTimeout(3000);
await expect(await unityWidget.unityWidgetContainer).toBeTruthy();
await expect(await unityWidget.unityVideo).toBeTruthy();
await expect(await unityWidget.dropZone).toBeTruthy();
await expect(await unityWidget.dropZoneText).toBeTruthy();
});
});
// Test 1 : Unity Widget File Upload & splash screen display
test(`${features[1].name},${features[1].tags}`, async ({ page, baseURL }) => {
const ccBaseURL = baseURL.replace('--dc--', '--cc--');
console.info(`[Test Page]: ${ccBaseURL}${features[1].path}${unityLibs}`);

await test.step('check photoshop file upload', async () => {
await page.goto(`${ccBaseURL}${features[1].path}${unityLibs}`);
await page.waitForLoadState('domcontentloaded');
await expect(page).toHaveURL(`${ccBaseURL}${features[1].path}${unityLibs}`);
});
await test.step('png image file upload and splash screen display', async () => {
const fileInput = page.locator('//input[@type="file" and @id="file-upload"]').nth(0);
await page.waitForTimeout(10000);
await fileInput.setInputFiles(imageFilePath);
await page.waitForTimeout(3000);
await expect(unityWidget.splashScreen).toBeTruthy();
});
});
// Test 2 : Unity Widget user navigation to Photoshop Product Page
test(`${features[2].name},${features[2].tags}`, async ({ page, baseURL }) => {
const ccBaseURL = baseURL.replace('--dc--', '--cc--');
console.info(`[Test Page]: ${ccBaseURL}${features[2].path}${unityLibs}`);

await test.step('check user landing on PS product page post file upload', async () => {
await page.goto(`${ccBaseURL}${features[2].path}${unityLibs}`);
await page.waitForLoadState('domcontentloaded');
await expect(page).toHaveURL(`${ccBaseURL}${features[2].path}${unityLibs}`);
});
await test.step('png image file upload and user navigation to product page', async () => {
const fileInput = page.locator('//input[@type="file" and @id="file-upload"]').nth(0);
await page.waitForTimeout(10000);
await fileInput.setInputFiles(imageFilePath);
await page.waitForTimeout(10000);
const productPageUrl = await page.url();
expect(productPageUrl).toContain(features[2].url);
});
});
});
Loading
Loading