Skip to content

Commit

Permalink
add xAppsOverlay tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kwinto committed Jul 8, 2024
1 parent 3c2a417 commit 77e3159
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 0 deletions.
47 changes: 47 additions & 0 deletions cypress/e2e/messages/xAppsOverlay.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
/// <reference path="../../support/index.d.ts" />

describe("xApps Overlay", () => {
beforeEach(() => {
cy
.visitWebchat()
.initMockWebchat()
.openWebchat()
.startConversation()
})

it("opens overlay automatically", () => {
cy.withMessageFixture('xApps-overlay-autoOpen', () => {
cy.get('.logoNameContainer').contains('XApp Title 1');
})
})

it("closes overlay on close-button click", () => {
cy.withMessageFixture('xApps-overlay-autoOpen', () => {
cy.get('.webchat-header-close-button').click();
})
})

it("changes title on switching apps", () => {
cy.withMessageFixture('xApps-overlay-autoOpen', () => {
cy.wait(1000);
cy.receiveMessage(null, {
"_cognigy": {
"_app": {
"overlaySettings": {
"screenTitle": "XApp Title 2",
},
"url": "https://example.com"
}
}
});
cy.get('.logoNameContainer').contains('XApp Title 2');
})
})

it("makes xApp fullscreen when no title and no close icon", () => {
cy.withMessageFixture('xApps-overlay-noClose', () => {
cy.get('.webchat-header-bar').should('not.exist');
})
})
})
21 changes: 21 additions & 0 deletions cypress/fixtures/messages/xApps-overlay-autoOpen.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"text": "",
"data": {
"_cognigy": {
"_app": {
"overlaySettings": {
"autoOpen": true,
"closeOnSubmit": false,
"feedbackMessage": "",
"screenTitle": "XApp Title 1",
"sendEventOnCloseIconClick": true,
"showCloseIcon": true
},
"url": "https://example.com"
}
}
},
"source": "bot",
"traceId": "endpoint-webchat3Client-55558b3d-e839-4fb1-8311-d418add68c11",
"disableSensitiveLogging": false
}
21 changes: 21 additions & 0 deletions cypress/fixtures/messages/xApps-overlay-noClose.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"text": "",
"data": {
"_cognigy": {
"_app": {
"overlaySettings": {
"autoOpen": true,
"closeOnSubmit": false,
"feedbackMessage": "",
"screenTitle": "",
"sendEventOnCloseIconClick": true,
"showCloseIcon": false
},
"url": "https://example.com"
}
}
},
"source": "bot",
"traceId": "endpoint-webchat3Client-55558b3d-e839-4fb1-8311-d418add68c11",
"disableSensitiveLogging": false
}

0 comments on commit 77e3159

Please sign in to comment.