Skip to content

Commit

Permalink
Merge branch 'stage' into mwpw-135907-sign-pdf-rotate-pdf-to-l2-test
Browse files Browse the repository at this point in the history
  • Loading branch information
TsayAdobe authored Oct 2, 2023
2 parents 4efc527 + bd45cac commit 50de23b
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 1 deletion.
32 changes: 32 additions & 0 deletions test/e2e/frictionless/features/regression/caas.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Feature: CaaS Block

Background:
Given I have a new browser context

@MWPW-132351 @regression-caas
Scenario Outline: CaaS block on frictionless
Given I go to the <Verb> page
Then I should see the CaaS block
Then I should see the 'More resources' header
Then I should see the CaaS block cards
Then I click the "Read now" button inside the CaaS card
Then I switch to the new page after clicking "Read now" button in the CaaS
Then I should not see the address bar contains "<Verb>"
Examples:
| Verb |
| add-pages-to-pdf |
| compress-pdf |
| convert-pdf |
| delete-pdf-pages |
| excel-to-pdf |
| extract-pdf-pages |
| merge-pdf |
| password-protect-pdf |
| pdf-editor |
| pdf-to-excel |
| pdf-to-jpg |
| request-signature |
| rotate-pdf |
| sign-pdf |
| split-pdf |
| word-to-pdf |
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ Feature: Frictionless Event Wrapper Block

Examples:
| Verb | File |
| pdf-to-jpg | test-files/test.pdf |
| pdf-to-jpg | test-files/test.pdf |
27 changes: 27 additions & 0 deletions test/e2e/frictionless/page-objects/caas.page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { classes } from "polytype";
import { DcGnavPage } from "./dcgnav.page";
import { PdfWidgetSection } from "./pdfwidget.section";

export class CaaSPage extends classes(DcGnavPage, PdfWidgetSection) {
constructor(contentPath) {
let locContentPath = contentPath;
// if locale is specified, add to the path
if (global.config.profile.locale) {
locContentPath = locContentPath.replace(/^\/*|\/*$/g, '');
if (global.config.profile.locale === 'us') {
locContentPath = `/${locContentPath}`;
} else {
locContentPath = `/${global.config.profile.locale}/${locContentPath}`;
}
}
super({
super: DcGnavPage,
arguments: [locContentPath],
});
this.buildProps({
caas: '#caas',
caasFragment: '.fragment[data-path*="caas"]>>nth=0',
caasButton: 'a[data-testid="consonant-BtnInfobit"]'
});
}
}
7 changes: 7 additions & 0 deletions test/e2e/frictionless/page-objects/passwordprotectpdf.page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { FrictionlessPage } from './frictionless.page';

export class PasswordProtectPdfPage extends FrictionlessPage {
constructor() {
super("/acrobat/online/password-protect-pdf");
}
}
34 changes: 34 additions & 0 deletions test/e2e/frictionless/step-definitions/dc.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import { PdfEditorPage } from "../page-objects/pdfeditor.page";
import { MergePdfPage } from "../page-objects/mergepdf.page";
import { CompressPdfPage } from "../page-objects/compresspdf.page";
import { FrictionlessPage } from "../page-objects/frictionless.page";
import { PasswordProtectPdfPage } from "../page-objects/passwordprotectpdf.page";
import { CaaSPage } from "../page-objects/caas.page";
import { cardinal } from "../support/cardinal";
import { expect } from "@playwright/test";
const os = require("os");
Expand Down Expand Up @@ -94,6 +96,7 @@ Then(/^I go to the ([^\"]*) page$/, async function (verb) {
"pdf-editor": PdfEditorPage,
"merge-pdf": MergePdfPage,
"compress-pdf": CompressPdfPage,
"password-protect-pdf": PasswordProtectPdfPage,
}[verb];
this.page = new pageClass();

Expand Down Expand Up @@ -444,3 +447,34 @@ Then(/^I read expected analytics data with replacements "([^"]*)"$/, async funct

this.page.wikiAnalyticsData = events;
});

Then(/^I should see the CaaS block$/, async function () {
this.context(CaaSPage);
await expect(this.page.caasFragment).toBeVisible({timeout: 30000});
await this.page.native.evaluate(() => window.scrollTo(0, document.body.scrollHeight));
await expect(this.page.caas).toBeVisible({timeout: 30000});
});

Then(/^I should see the 'More resources' header$/, async function () {
const headerContent = await this.page.caasFragment.locator('h2').first().textContent();
await expect(headerContent).toEqual('More resources');
});

Then(/^I should see the CaaS block cards$/, async function () {
await expect(this.page.caas.locator('.consonant-Card').first()).toBeVisible({timeout: 30000});
const cardCount = await this.page.caas.locator('.consonant-Card').count();
expect(cardCount).toBeGreaterThan(1);
});

Then(/^I click the "Read now" button inside the CaaS card$/, async function () {
await this.page.caasButton.nth(0).click();
});

Then(/^I switch to the new page after clicking "Read now" button in the CaaS$/, async function () {
const [newPage] = await Promise.all([
PW.context.waitForEvent('page'),
this.page.caasButton.nth(0).click()
]);
await newPage.waitForLoadState();
this.page.native = newPage;
});

0 comments on commit 50de23b

Please sign in to comment.