Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MWPW-135907 - sign pdf and rotate pdf to l2 test #393

Merged
merged 4 commits into from
Oct 2, 2023
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
37 changes: 36 additions & 1 deletion test/e2e/frictionless/features/regression/converter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,39 @@ Feature: Frictionless Converter Block

Examples:
| Verb | File |
| sign-pdf | test-files/test.pdf |
| sign-pdf | test-files/test.pdf |

@MWPW-137180 @regression @converter
Scenario Outline: L2 Verbs - Upload, rotate and download
Given I go to the <Verb> page
Then I upload the files "<Files>"
Then I rotate right the uploaded files
Then I rotate left first uploaded file
Then I wait for 2 seconds
Then I save rotated files
Then I download the converted file

Examples:
| Verb | Files |
| rotate-pdf | test-files/test.pdf,test-files/test2.pdf |

@MWPW-137251 @regression @converter
Scenario Outline: L2 Verbs - Upload and sign in
Given I go to the <Verb> page
Then I upload the file "<File>"
Then I click "Add signature"
Then I fill up signature input
Then I click "Add initials"
Then I fill up signature input
Then I click "Add signature"
Then I sign up the document
Then I should see signature
Then I click "Add initials"
Then I sign up the document
Then I should see initials
Then I wait for 2 seconds
Then I click "Sign in to download"

Examples:
| Verb | File |
| sign-pdf | test-files/test.pdf |
5 changes: 5 additions & 0 deletions test/e2e/frictionless/page-objects/pdfwidget.section.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ export class PdfWidgetSection extends Section {
dcWebDocumentsTab: '//div[@role="tab"]//span[text()="Documents"]/..',
dcWebCheckAllFiles: '//div[contains(@class, "Files")]//input[@title="Select All"]',
dcWebDelete: '//button[@data-test-id="delete-action-button"]',
rotateRightButton: 'button[id="rotate-right"]',
addSignature: 'div[data-testid*="add-signature"]',
addInitials: 'div[data-testid*="add-initials"]',
applyButton: 'button[data-test-id="apply-btn"]',
signInButton: 'button[data-test-id="sign-in-btn"]',
});
}

Expand Down
66 changes: 55 additions & 11 deletions test/e2e/frictionless/step-definitions/dc.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async function enableNetworkLogging(page) {
networklogs.push(route.request());
route.continue();
});
}
}
}
}

Expand Down Expand Up @@ -164,6 +164,50 @@ Then(/^I merge the uploaded files$/, async function () {
await this.page.mergeButton.click({ timeout: 120000 });
});

Then(/^I save rotated files$/, async function () {
this.context(FrictionlessPage);
await this.page.mergeButton.click({ timeout: 120000 });
});

Then(/^I rotate right the uploaded files$/, async function () {
this.context(FrictionlessPage);
await this.page.rotateRightButton.click({ timeout: 120000 });
});

Then(/^I rotate left first uploaded file$/, async function () {
let file = "//div[@data-test-id='grid-item-wrapper-0']";
let fileLeftRotateBtn = `${file}//button[@data-test-id='rotate-left-button']`;
await this.page.native.locator(file).click({timeout: 2000});
await this.page.native.locator(fileLeftRotateBtn).click({timeout: 2000});
});

Then(/^I click "Add (signature|initials)"$/, async function (sign) {
this.context(FrictionlessPage);
const elementToClick = sign === 'signature' ? this.page.addSignature : this.page.addInitials;
await elementToClick.click({ timeout: 120000 });
});

Then(/^I fill up signature input$/, async function () {
let signature = "//input[@data-test-id='type-sign-canvas']";
await this.page.native.locator(signature).fill('Test signature');
await this.page.applyButton.click({timeout: 2000});
});

Then(/^I sign up the document$/, async function () {
let document = '#pageview-current-page';
await this.page.native.locator(document).click({timeout: 2000});
});

Then(/^I should see (signature|initials)$/, async function (sign) {
const element = sign === 'signature' ? "//div[@data-testid='fns-field-0']" : "//div[@data-testid='fns-field-1']";
await expect(this.page.native.locator(element)).toBeVisible();
});

Then(/^I click "Sign in to download"$/, async function () {
this.context(FrictionlessPage);
await this.page.signInButton.click({ timeout: 120000 });
});

Then(/^I should not see any browser console errors$/, async function () {
if (this.page.consoleMessages) {
const errors = this.page.consoleMessages.filter(
Expand Down Expand Up @@ -207,17 +251,17 @@ Then(/^I submit review feedback$/, async function () {
await this.page.reviewStartInput(3).click({timeout: 5000});
await this.page.reviewCommentField.fill("Test");
await this.page.reviewStartInput(5).click();
await this.page.reviewCommentSubmit.click();
await this.page.reviewCommentSubmit.click();
});

Then(/^I should see the review stats$/, async function () {
this.context(FrictionlessPage);
await expect(this.page.reviewStats).toBeVisible({timeout: 5000});
await expect(this.page.reviewStats).toBeVisible({timeout: 5000});
});

Then(/^I should see the review submit response$/, async function () {
this.context(FrictionlessPage);
await expect(this.page.reviewSubmitResponse).toBeVisible({timeout: 5000});
await expect(this.page.reviewSubmitResponse).toBeVisible({timeout: 5000});
});

Then(/^I download the pdf from DC web$/, async function () {
Expand Down Expand Up @@ -288,7 +332,7 @@ Then(/^I (screenshot|should be able to open) the submenu of the (.*) menu item(?

let menuItems = items.replace(/ and /g, ",").split(",");
menuItems = menuItems.map((x) => x.trim()).filter((x) => x.length > 0);
for (let item of menuItems) {
for (let item of menuItems) {
const index = cardinal(item);
await this.page.openSubMenu(index);
await expect(this.page.fedsPopup).toBeVisible();
Expand All @@ -305,12 +349,12 @@ Then(/^I (screenshot|should be able to open) the submenu of the (.*) menu item(?

/***
* This step is used to compare the current screenshots with the baseline
* screenshots.
*
* screenshots.
*
* Baseline Folder: features/${feature-name}/${platform}/${browser}
* Current Folder: ${report-dir}/screenshots/${feature-name}/${platform}/${browser}
* Current Folder: ${report-dir}/screenshots/${feature-name}/${platform}/${browser}
* Diff Image: ${report-dir}/${platform}_${browser}_${image-name}.png
*
*
* Command line options:
* --baseBrowser: Use a different browser to compare with the current browser
*/
Expand Down Expand Up @@ -349,7 +393,7 @@ Then(/^I should be able to use the "([^\"]*)" submenu$/, async function (menu) {
});

Then(/^I select the last item of the submenu of the ([^\"]*) menu item$/, async function (menu) {
this.context(FrictionlessPage);
this.context(FrictionlessPage);
await this.page.openSubMenu(cardinal(menu));
await this.page.selectFedsPopupItem(-1);
});
Expand All @@ -366,7 +410,7 @@ Then(/^I switch to the new page after clicking "Buy now" button in the header$/,
this.page.buyNow.click()
]);
await newPage.waitForLoadState();
this.page.native = newPage;
this.page.native = newPage;
});

Then(/^I read expected analytics data with replacements "([^"]*)"$/, async function (replacements) {
Expand Down
Loading