-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'stage' into MWPW-158083
- Loading branch information
Showing
10 changed files
with
227 additions
and
26 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Feature: Frictionless Converter Block | ||
|
||
Background: | ||
Given I have a new browser context | ||
|
||
@smoke @unity @sign-pdf @choosefile | ||
Scenario Outline: L1 Verb - Upload and sign-in | ||
Given I go to the <Verb> page | ||
Then I choose the file "<File>" to upload | ||
Then I wait for 5 seconds | ||
Then I should see the address bar contains "acrobat.adobe.com" | ||
|
||
Examples: | ||
| Verb | File | | ||
| sign-pdf | test-files/test.pdf | | ||
|
||
@smoke @unity @sign-pdf @dragndrop | ||
Scenario Outline: L1 Verb - Upload and sign-in | ||
Given I go to the <Verb> page | ||
Then I drag-and-drop the file "<File>" to upload | ||
Then I wait for 5 seconds | ||
Then I should see the address bar contains "acrobat.adobe.com" | ||
|
||
Examples: | ||
| Verb | File | | ||
| sign-pdf | test-files/test.pdf | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { classes } from "polytype"; | ||
import { DcGnavPage } from "./dcgnav.page"; | ||
import { CaaSSection } from "./caas.section"; | ||
import { VerbWidgetSection } from "./verbwidget.section"; | ||
|
||
export class UnityPage extends classes(DcGnavPage, VerbWidgetSection, CaaSSection) { | ||
constructor(contentPath) { | ||
super({ | ||
super: DcGnavPage, | ||
arguments: [contentPath], | ||
}); | ||
this.buildProps({ | ||
howToDefault: 'div[data-path*="how-to/default"]', | ||
howTo2ndConversion: '[data-tag="2nd conversion"] div[data-path*="how-to/2nd-conversion"]', | ||
verbSubfooter: '.verb-subfooter', | ||
reviewComponent: '.review', | ||
reviewStats: '.hlx-ReviewStats', | ||
reviewSubmitResponse: '.hlx-submitResponse', | ||
reviewDisabled: '.hlx-Review-ratingFields[disabled]', | ||
reviewCommentField: '.hlx-Review-commentFields textarea', | ||
reviewCommentSubmit: '.hlx-Review-commentFields input[type="submit"]', | ||
reviewInputField: 'fieldset.hlx-Review-ratingFields input', | ||
signUp: '[href*="https://auth.services.adobe.com"][href*="signup"]', | ||
extensionModal: '#chromeext, #edgeext', | ||
closeExtensionModal: '#chromeext .dialog-close, #edgeext .dialog-close', | ||
eventwrapperOnload: '.eventwrapper.onload', | ||
previewDescription: 'div[class*="previewDescription"]', | ||
}); | ||
} | ||
|
||
reviewStartInput(rating) { | ||
return this.native.locator(`.hlx-Review-ratingFields input[value="${rating}"]`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import { Section } from '@amwp/platform-ui-automation/lib/common/page-objects/section'; | ||
|
||
export class VerbWidgetSection extends Section { | ||
constructor() { | ||
super(); | ||
this.buildProps({ | ||
selectButton: '.verb-cta', | ||
fileUploadInput: '#file-upload', | ||
dropZone: '#drop-zone', | ||
}) | ||
} | ||
|
||
async chooseFiles(filePaths) { | ||
const fileChooserPromise = this.native.waitForEvent('filechooser'); | ||
this.selectButton.click(); | ||
const fileChooser = await fileChooserPromise; | ||
await fileChooser.setFiles(filePaths); | ||
} | ||
|
||
async dragndropFiles(filePaths) { | ||
const filePath = filePaths[0]; | ||
const buffer = fs.readFileSync(filePath).toString('base64'); | ||
const basename = path.basename(filePath); | ||
|
||
const dataTransfer = await this.dropZone.evaluateHandle(async({bufferData, basename}) => { | ||
const dt = new DataTransfer(); | ||
const blobData = await fetch(bufferData).then((res) => res.blob()); | ||
const file = new File([blobData], basename, { type: 'application/pdf' }); | ||
dt.items.add(file); | ||
return dt; | ||
}, { | ||
bufferData: `data:application/octet-stream;base64,${buffer}`, | ||
basename | ||
}); | ||
|
||
await this.dropZone.dispatchEvent('drop', { dataTransfer }); | ||
} | ||
} | ||
|
||
async function dragAndDropFile( | ||
page, | ||
selector, | ||
filePath, | ||
fileName, | ||
fileType = '' | ||
) { | ||
const buffer = readFileSync(filePath).toString('base64'); | ||
|
||
const dataTransfer = await page.evaluateHandle( | ||
async ({ bufferData, localFileName, localFileType }) => { | ||
const dt = new DataTransfer(); | ||
|
||
const blobData = await fetch(bufferData).then((res) => res.blob()); | ||
|
||
const file = new File([blobData], localFileName, { type: localFileType }); | ||
dt.items.add(file); | ||
return dt; | ||
}, | ||
{ | ||
bufferData: `data:application/octet-stream;base64,${buffer}`, | ||
localFileName: fileName, | ||
localFileType: fileType, | ||
} | ||
); | ||
|
||
await page.dispatchEvent(selector, 'drop', { dataTransfer }); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters