Skip to content

Commit

Permalink
Added Test Case for Document of Record generation
Browse files Browse the repository at this point in the history
Added Test Case for Document of Record generation

 Added Test Case for Document of Record generation

Added Test Case for Document of Record generation

Added Test Case for Document of Record generation

Use list form api to get form Id

Added Test Case for Document of Record generation

Added Test Case for Document of Record generation

Added Test Case for Document of Record generation

Added Test Case for Document of Record generation
  • Loading branch information
barshat7 committed Dec 7, 2023
1 parent 2ed4427 commit a117532
Show file tree
Hide file tree
Showing 14 changed files with 1,416 additions and 79 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
jcr:primaryType="sling:Folder"
lcFolder="{Long}0"
type="lcFolder">
<jcr:content
jcr:primaryType="nt:unstructured"
jcr:title="document-of-record"/>
</jcr:root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:dam="http://www.day.com/dam/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:xmp="http://ns.adobe.com/xap/1.0/" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:fd="http://www.adobe.com/aemfd/fd/1.0"
jcr:primaryType="dam:Asset">
<jcr:content
cq:conf="\0"
jcr:lastModified="{Date}2023-12-05T12:34:15.748+05:30"
jcr:primaryType="dam:AssetContent"
sling:resourceType="fd/fm/af/render"
guide="1"
type="guide">
<metadata
fd:version="2.1"
jcr:language="en"
jcr:primaryType="nt:unstructured"
xmp:CreatorTool="AEM Forms AF Wizard"
allowedRenderFormat="HTML"
author="admin"
availableInMobileApp="{Boolean}false"
dorTemplateChanged="Boolean"
dorTemplateRef="/content/dam/formsanddocuments/core-components-it/samples/document-of-record/dor-form/jcr:content/renditions/dorTemplate"
dorType="generate"
formmodel="none"
themeRef="/libs/fd/af/themes/canvas"
title="dor-form"/>
</jcr:content>
</jcr:root>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:oak="http://jackrabbit.apache.org/oak/ns/1.0"
jcr:primaryType="nt:file">
<jcr:content
jcr:lastModifiedBy="admin"
jcr:primaryType="oak:Resource"/>
</jcr:root>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:oak="http://jackrabbit.apache.org/oak/ns/1.0"
jcr:primaryType="nt:file">
<jcr:content
jcr:lastModifiedBy="admin"
jcr:primaryType="oak:Resource"/>
</jcr:root>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:oak="http://jackrabbit.apache.org/oak/ns/1.0"
jcr:primaryType="nt:file">
<jcr:content
jcr:lastModifiedBy="admin"
jcr:primaryType="oak:Resource"/>
</jcr:root>

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:fd="http://www.adobe.com/aemfd/fd/1.0"
fd:trusted="{Boolean}true"
jcr:mixinTypes="[fd:xdp]"
jcr:primaryType="nt:file">
<jcr:content
jcr:lastModifiedBy="fd-service"
jcr:mimeType="application/vnd.adobe.xdp+xml"
jcr:primaryType="nt:resource"/>
</jcr:root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
jcr:primaryType="sling:Folder"/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:fd="http://www.adobe.com/aemfd/fd/1.0"
jcr:primaryType="cq:Page">
<jcr:content
cq:deviceGroups="[/etc/mobile/groups/responsive]"
cq:lastModified="{Date}2023-12-05T12:34:14.739+05:30"
cq:lastModifiedBy="admin"
cq:template="/conf/core-components-examples/settings/wcm/templates/af-blank-v2"
jcr:language="en"
jcr:primaryType="cq:PageContent"
jcr:title="dor-form"
sling:configRef="/conf/forms/core-components-it/samples/document-of-record/dor-form/"
sling:resourceType="forms-components-examples/components/page">
<guideContainer
fd:version="2.1"
jcr:primaryType="nt:unstructured"
sling:resourceType="forms-components-examples/components/form/container"
dorTemplateRef="/content/dam/formsanddocuments/core-components-it/samples/document-of-record/dor-form/jcr:content/renditions/dorTemplate"
dorType="generate"
fieldType="form"
schemaType="none"
thankYouOption="page"
themeRef="/libs/fd/af/themes/canvas"
title="dor-form">
<textinput
jcr:created="{Date}2023-12-05T12:34:04.112+05:30"
jcr:createdBy="admin"
jcr:lastModified="{Date}2023-12-05T12:34:04.112+05:30"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
jcr:title="Text Input"
sling:resourceType="forms-components-examples/components/form/textinput"
fieldType="text-input"
name="textinput1701759844272"/>
<fd:view jcr:primaryType="nt:unstructured">
<print
jcr:created="{Date}2023-12-05T12:34:14.733+05:30"
jcr:lastModified="{Date}2023-12-05T12:34:14.733+05:30"
jcr:primaryType="nt:unstructured"
sling:resourceType="fd/af/authoring/components/dor/dorProperties"
metaTemplateRef="/libs/fd/af/dor/templates/defaultTemplate.xdp"/>
</fd:view>
</guideContainer>
</jcr:content>
</jcr:root>
158 changes: 79 additions & 79 deletions ui.tests/test-module/libs/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,15 @@ Cypress.Commands.add('clickDialogWithRetry', (selector = '.cq-dialog-cancel', re

function clickRetry() {
cy.get(selector)
.click({ multiple: true })
.should(($element) => {
if ($element.closest('.cq-dialog').is(':visible')) {
if (currentRetry < retryCount - 1) {
currentRetry++;
clickRetry();
}
.click({ multiple: true })
.should(($element) => {
if ($element.closest('.cq-dialog').is(':visible')) {
if (currentRetry < retryCount - 1) {
currentRetry++;
clickRetry();
}
});
}
});
}
clickRetry();
});
Expand Down Expand Up @@ -246,7 +246,7 @@ Cypress.Commands.add("openAuthoring", (pagePath) => {
// Cypress command to open authoring page
Cypress.Commands.add("openPage", (pagePath, options = {}) => {
if (!options.noLogin) {
// getting status 403 intermittently, just ignore it
// getting status 403 intermittently, just ignore it
const baseUrl = Cypress.env('crx.contextPath') ? Cypress.env('crx.contextPath') : "";
cy.visit(baseUrl, {'failOnStatusCode': false});
cy.login(baseUrl, () => {
Expand All @@ -268,30 +268,30 @@ Cypress.Commands.add("selectLayer", (layer) => {
// cypress command to open editable toolbar
Cypress.Commands.add("openEditableToolbar", (selector) => {
cy.get(selector) // adding assertion does implicit retry
.invoke('attr', 'data-path')
.then(($path) => {
const path = siteSelectors.editableToolbar.elementDom.replace("%s", $path);
cy.get("body").then($body => {
if ($body.find(path).length === 0) {
//evaluates as true if toolbar doesnt exists at all
//you get here only if toolbar is visible
cy.get(selector).click({force: true}); // end user does not face this but due to cypress checks, we need to add force true here
// sometimes the above line results in this error, `<div.cq-Overlay.cq-Overlay--component.cq-draggable.cq-droptarget.is-resizable>` is not visible because its parent `<div.cq-Overlay.cq-Overlay--component.cq-Overlay--container>` has CSS property: `display: none`
cy.get(path).should('be.visible');
} else {
cy.get(path).then($header => {
if (!$header.is(':visible')) {
cy.get(selector).first().click({force: true});
cy.get(path).should('be.visible');
} else {
cy.get(siteSelectors.overlays.self).scrollIntoView().click(0, 0); // dont click on body, always use overlay wrapper to click
cy.get(selector).click({force: true});
cy.get(path).should('be.visible');
}
});
}
});
})
.invoke('attr', 'data-path')
.then(($path) => {
const path = siteSelectors.editableToolbar.elementDom.replace("%s", $path);
cy.get("body").then($body => {
if ($body.find(path).length === 0) {
//evaluates as true if toolbar doesnt exists at all
//you get here only if toolbar is visible
cy.get(selector).click({force: true}); // end user does not face this but due to cypress checks, we need to add force true here
// sometimes the above line results in this error, `<div.cq-Overlay.cq-Overlay--component.cq-draggable.cq-droptarget.is-resizable>` is not visible because its parent `<div.cq-Overlay.cq-Overlay--component.cq-Overlay--container>` has CSS property: `display: none`
cy.get(path).should('be.visible');
} else {
cy.get(path).then($header => {
if (!$header.is(':visible')) {
cy.get(selector).first().click({force: true});
cy.get(path).should('be.visible');
} else {
cy.get(siteSelectors.overlays.self).scrollIntoView().click(0, 0); // dont click on body, always use overlay wrapper to click
cy.get(selector).click({force: true});
cy.get(path).should('be.visible');
}
});
}
});
})
});

// cypress command to invoke an editable action
Expand Down Expand Up @@ -339,18 +339,18 @@ const waitForFormInit = () => {
const promise = new Cypress.Promise((resolve, reject) => {
const listener1 = e => {
if(document.querySelector("[data-cmp-adaptiveform-container-loader='"+ $form[0].id + "']").classList.contains("cmp-adaptiveform-container--loading")){
const isReady = () => {
const container = document.querySelector("[data-cmp-adaptiveform-container-loader='"+ $form[0].id + "']");
if (container &&
e.detail._path === $form.data("cmp-path") &&
!container.classList.contains("cmp-adaptiveform-container--loading")) {

resolve(e.detail);
const isReady = () => {
const container = document.querySelector("[data-cmp-adaptiveform-container-loader='"+ $form[0].id + "']");
if (container &&
e.detail._path === $form.data("cmp-path") &&
!container.classList.contains("cmp-adaptiveform-container--loading")) {

resolve(e.detail);
}
setTimeout(isReady, 0)
}
setTimeout(isReady, 0)
isReady();
}
isReady();
}
}
document.addEventListener(INIT_EVENT, listener1);
})
Expand All @@ -367,41 +367,41 @@ const waitForFormInitMultipleContiners = () => {
const promise = new Cypress.Promise((resolve, reject) => {
const listener1 = e => {
if(document.querySelector("[data-cmp-adaptiveform-container-loader='"+ $form[0].id + "']").classList.contains("cmp-adaptiveform-container--loading")){
const isReady = () => {
const container = document.querySelector("[data-cmp-adaptiveform-container-loader='"+ $form[0].id + "']");
if (container &&
e.detail._path === $form.data("cmp-path") &&
!container.classList.contains("cmp-adaptiveform-container--loading")) {

resolve(e.detail);
const isReady = () => {
const container = document.querySelector("[data-cmp-adaptiveform-container-loader='"+ $form[0].id + "']");
if (container &&
e.detail._path === $form.data("cmp-path") &&
!container.classList.contains("cmp-adaptiveform-container--loading")) {

resolve(e.detail);
}
setTimeout(isReady, 0)
}
setTimeout(isReady, 0)
isReady();
}
isReady();
}
}
document.addEventListener(INIT_EVENT, listener1);
})

promiseArray.push(promise)
}).then(($lis) => {
return Promise.all(promiseArray)
return Promise.all(promiseArray)
});
})
}

const waitForChildViewAddition = () => {
return cy.get('[data-cmp-is="adaptiveFormContainer"]')
.then((el) => {
const ADD_EVENT = "AF_PanelInstanceAdded";
const promise = new Cypress.Promise((resolve, reject) => {
const listener1 = e => {
resolve(e.detail.formContainer);
};
el[0].addEventListener(ADD_EVENT, listener1);
})
return promise;
});
.then((el) => {
const ADD_EVENT = "AF_PanelInstanceAdded";
const promise = new Cypress.Promise((resolve, reject) => {
const listener1 = e => {
resolve(e.detail.formContainer);
};
el[0].addEventListener(ADD_EVENT, listener1);
})
return promise;
});
}

Cypress.Commands.add("getFormData", () => {
Expand Down Expand Up @@ -610,19 +610,19 @@ Cypress.Commands.add("toggleDescriptionTooltip", (bemBlock, fieldId, shortDescri
longDescriptionText = 'This is long description';
}
cy.get(`#${fieldId}`).find(`.${bemBlock}__shortdescription`).invoke('attr', 'data-cmp-visible=false')
.should('not.exist');
.should('not.exist');
cy.get(`#${fieldId}`).find(`.${bemBlock}__shortdescription`)
.should('contain.text', shortDescriptionText);
.should('contain.text', shortDescriptionText);
// click on ? mark
cy.get(`#${fieldId}`).find(`.${bemBlock}__questionmark`).click();
// long description should be shown
cy.get(`#${fieldId}`).find(`.${bemBlock}__longdescription`).invoke('attr', 'data-cmp-visible')
.should('not.exist');
.should('not.exist');
cy.get(`#${fieldId}`).find(`.${bemBlock}__longdescription`)
.should('contain.text', longDescriptionText);
.should('contain.text', longDescriptionText);
// short description should be hidden.
cy.get(`#${fieldId}`).find(`.${bemBlock}__shortdescription`).invoke('attr', 'data-cmp-visible')
.should('eq', 'false');
.should('eq', 'false');
});

Cypress.Commands.add("openSidePanelTab", (tab) => {
Expand All @@ -634,8 +634,8 @@ Cypress.Commands.add("openSidePanelTab", (tab) => {
});
var tabSelector = '[role="tablist"] [role="tab"][title="' + tab + '"]';
cy.get(tabSelector)
.should("be.visible")
.click();
.should("be.visible")
.click();
cy.get(tabSelector + ".is-selected").should("exist");
})

Expand All @@ -646,8 +646,8 @@ Cypress.Commands.add("openSidePanelTab", (tab) => {
*
* This is supposed to be called in the before hook of a test, like this:
* before(() => {
* cy.attachConsoleErrorSpy();
* });
* cy.attachConsoleErrorSpy();
* });
*/
Cypress.Commands.add("attachConsoleErrorSpy", () => {
Cypress.on('window:before:load', (win) => {
Expand All @@ -670,11 +670,11 @@ Cypress.Commands.add("expectNoConsoleErrors", () => {

Cypress.Commands.add("isElementInViewport", { prevSubject: true }, (subject) => {
const rect = subject[0].getBoundingClientRect();

return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= Cypress.config("viewportHeight") &&
rect.right <= Cypress.config("viewportWidth")
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= Cypress.config("viewportHeight") &&
rect.right <= Cypress.config("viewportWidth")
);
});
});
Loading

0 comments on commit a117532

Please sign in to comment.