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/lightroom.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion nala/features/firefly/firefly.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ test.describe('Firefly test suite', () => {

await test.step('step-2: Verify Firefly Image verb content/specs', async () => {
await expect(fireflyPage.unityWrapper).toBeVisible();
await expect(fireflyPage.imageVerbButton).toBeVisible();
await expect(fireflyPage.promptInput).toBeVisible();
await expect(fireflyPage.generateImageButton).toBeVisible();
const actualText = await fireflyPage.promptInput.getAttribute('placeholder');
Expand Down
14 changes: 14 additions & 0 deletions nala/features/lightroom/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/lightroom/unitywidget.spec.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports = {
FeatureName: 'Lr Unity Widget',
features: [
{
tcid: '0',
name: '@lr-unityUI',
path: '/drafts/nala/unity/lightroom',
data: {
CTATxt: 'Upload your photo',
fileFormatTxt: 'File must be JPEG or JPG and up to 40MB',
dropZoneTxt: 'Drag and drop an image to try it today.',
},
tags: '@lr-unity @smoke @regression @unity',
},

{
tcid: '1',
name: '@lr-unityFileUpload',
path: '/drafts/nala/unity/lightroom',
tags: '@lr-unity @smoke @regression @unity',
},

{
tcid: '2',
name: '@lr-unityLrProductpage',
path: '/drafts/nala/unity/lightroom',
url: 'f0.lightroom.adobe.com',
tags: '@lr-unity @smoke @regression @unity',
},
],
};
76 changes: 76 additions & 0 deletions nala/features/lightroom/unitywidget.test.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
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/lightroom.jpg');
console.log(__dirname);

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

test.describe('Unity Widget Lr 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 Lr 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 Lr 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 lightroom 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('jpg image file upload and splash screen display', async () => {
const fileInput = page.locator('//input[@type="file" and @id="file-upload"]').nth(0);
console.log('fileinput', fileInput);
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 Lr 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('jpg 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);
});
});
});
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'),
});
});
});
});
2 changes: 1 addition & 1 deletion nala/features/word-pdf/word-to-pdf.spec.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
data: {
verbTitle: 'Adobe Acrobat',
verbHeading: 'Word to PDF converter',
verbCopy: 'Drag and drop a Microsoft Word document (DOCX or DOC) to convert to PDF.',
verbCopy: 'Drag and drop a Microsoft Word (DOCX or DOC), RTF, or TXT file to convert to PDF.',
},
tags: '@word-to-pdf @smoke @regression @unity',
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from '@esm-bundle/chai';
import sinon from 'sinon';
import { readFile } from '@web/test-runner-commands';
import { setUnityLibs } from '../../../unitylibs/scripts/utils.js';
import { setUnityLibs } from '../../../../unitylibs/scripts/utils.js';

setUnityLibs('/unitylibs');

Expand All @@ -14,8 +14,8 @@ window.lana = { log: sinon.stub() };

window.sendAnalyticsEvent = sinon.stub();

const { default: init } = await import('../../../unitylibs/blocks/unity/unity.js');
document.body.innerHTML = await readFile({ path: './mocks/upload-body.html' });
const { default: init } = await import('../../../../unitylibs/blocks/unity/unity.js');
document.body.innerHTML = await readFile({ path: '../mocks/upload-body.html' });

function delay(ms) {
return new Promise((resolve) => {
Expand Down Expand Up @@ -87,7 +87,7 @@ describe('Unity Upload Block', () => {
await init(unityEl);
await delay(100);

const module = await import('../../../unitylibs/core/workflow/workflow-upload/action-binder.js');
const module = await import('../../../../unitylibs/core/workflow/workflow-upload/action-binder.js');
ActionBinder = module.default;

workflowCfg = {
Expand Down Expand Up @@ -115,7 +115,7 @@ describe('Unity Upload Block', () => {
});

beforeEach(async () => {
document.body.innerHTML = await readFile({ path: './mocks/upload-body.html' });
document.body.innerHTML = await readFile({ path: '../mocks/upload-body.html' });
unityEl = document.querySelector('.unity.workflow-upload');
await delay(50);
});
Expand Down Expand Up @@ -540,7 +540,7 @@ describe('Unity Upload Block', () => {
actionBinder.continueInApp = async () => {};

const file = new File(['test'], 'test.jpg', { type: 'image/jpeg' });
await actionBinder.photoshopActionMaps('upload', [file]);
await actionBinder.executeActionMaps('upload', [file]);

window.fetch = originalFetch;
actionBinder.checkImageDimensions = originalCheckImageDimensions;
Expand All @@ -556,7 +556,7 @@ describe('Unity Upload Block', () => {
};

try {
await actionBinder.photoshopActionMaps('interrupt');
await actionBinder.executeActionMaps('interrupt');
expect.fail('Should have thrown an error');
} catch (error) {
expect(error).to.be.instanceOf(Error);
Expand All @@ -566,7 +566,7 @@ describe('Unity Upload Block', () => {
it('should handle photoshop action maps for unknown action', async () => {
const actionBinder = new ActionBinder(unityEl, workflowCfg, unityEl, [unityEl]);

await actionBinder.photoshopActionMaps('unknown', []);
await actionBinder.executeActionMaps('unknown', []);
});

it('should initialize action listeners', async () => {
Expand Down Expand Up @@ -1457,7 +1457,7 @@ describe('Unity Upload Block', () => {
this.showErrorToast(errorCallbackOptions, err, this.lanaOptions);
throw err;
}
}
},
};

const originalFetch = window.fetch;
Expand Down Expand Up @@ -1500,7 +1500,7 @@ describe('Unity Upload Block', () => {
this.showErrorToast(errorCallbackOptions, err, this.lanaOptions);
throw err;
}
}
},
};

const originalFetch = window.fetch;
Expand Down Expand Up @@ -1843,17 +1843,17 @@ describe('Unity Upload Block', () => {
dataTransfer,
});

// Mock the photoshopActionMaps method
const originalPhotoshopActionMaps = actionBinder.photoshopActionMaps;
actionBinder.photoshopActionMaps = async (action, files) => {
// Mock the executeActionMaps method
const originalExecuteActionMaps = actionBinder.executeActionMaps;
actionBinder.executeActionMaps = async (action, files) => {
expect(action).to.equal('upload');
expect(files).to.have.length(1);
expect(files[0]).to.equal(mockFile);
};

testDiv.dispatchEvent(dropEvent);

actionBinder.photoshopActionMaps = originalPhotoshopActionMaps;
actionBinder.executeActionMaps = originalExecuteActionMaps;
});

it('should handle click event on DIV element', async () => {
Expand Down
Loading
Loading