Skip to content

Commit

Permalink
Merge pull request #401 from Cognigy/build-improvements-cleanup
Browse files Browse the repository at this point in the history
Build improvements cleanup
  • Loading branch information
kwinto authored Apr 26, 2024
2 parents f59df37 + 728241d commit a3de421
Show file tree
Hide file tree
Showing 105 changed files with 1,874 additions and 9,591 deletions.
23 changes: 11 additions & 12 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@ on: [pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '16'

- name: Re-install Node Modules
run: npm ci
strategy:
matrix:
node-version: [20.x]

- name: Run Test
run: npm test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm ci
- run: npm test


4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ cypress/videos
# Editor directories and files
.vscode/*
!vscode/launch.json
!.vscode/extensions.json
!.vscode/extensions.json

stats.json
70 changes: 35 additions & 35 deletions cypress/fixtures/messages/downloadableImage.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
{
"text": null,
"data": {
"_cognigy": {
"_default": {
"_image": {
"type": "image",
"imageUrl": "https://placekitten.com/300/300",
"buttons": [
{
"type": "web_url",
"title": "Download",
"url": "https://placekitten.com/300/300"
}
]
}
},
"_webchat": {
"message": {
"attachment": {
"type": "image",
"payload": {
"url": "https://placekitten.com/300/300",
"buttons": [
{
"type": "web_url",
"title": "Download",
"url": "https://placekitten.com/300/300"
}
]
}
}
}
}
}
}
"text": null,
"data": {
"_cognigy": {
"_default": {
"_image": {
"type": "image",
"imageUrl": "https://placewaifu.com/image/300/300",
"buttons": [
{
"type": "web_url",
"title": "Download",
"url": "https://placewaifu.com/image/300/300"
}
]
}
},
"_webchat": {
"message": {
"attachment": {
"type": "image",
"payload": {
"url": "https://placewaifu.com/image/300/300",
"buttons": [
{
"type": "web_url",
"title": "Download",
"url": "https://placewaifu.com/image/300/300"
}
]
}
}
}
}
}
}
}
8 changes: 4 additions & 4 deletions cypress/fixtures/messages/gallery.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{
"title": "foobar004g1",
"subtitle": "",
"imageUrl": "https://placekitten.com/300/300",
"imageUrl": "https://placewaifu.com/image/300/300",
"buttons": [
{
"id": 0.9601740794827666,
Expand All @@ -23,7 +23,7 @@
{
"title": "foobar004g2",
"subtitle": "foobar004g2sub1\nfoobar004g2sub2",
"imageUrl": "https://placekitten.com/300/300",
"imageUrl": "https://placewaifu.com/image/300/300",
"buttons": [],
"id": 0.9969017542005371
},
Expand All @@ -47,7 +47,7 @@
{
"title": "foobar004g1",
"subtitle": "",
"image_url": "https://placekitten.com/300/300",
"image_url": "https://placewaifu.com/image/300/300",
"buttons": [
{
"type": "postback",
Expand All @@ -74,7 +74,7 @@
{
"title": "foobar004g2",
"subtitle": "foobar004g2sub1\nfoobar004g2sub2",
"image_url": "https://placekitten.com/300/300",
"image_url": "https://placewaifu.com/image/300/300",
"buttons": []
},
{
Expand Down
2 changes: 1 addition & 1 deletion cypress/fixtures/messages/list.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{
"title": "foobar009l1",
"subtitle": "foobar009ls1",
"image_url": "https://placekitten.com/300/300",
"image_url": "https://placewaifu.com/image/300/300",
"buttons": [
{
"payload": "foobar009l1b1",
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/message-renderer/adaptiveCard.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe('Adaptive Cards in Message renderer', () => {
xdescribe('Adaptive Cards in Message renderer', () => {
before(() => {
cy.visitMessageRenderer();
});
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/message-renderer/availability.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe("Generic Message Renderer", () => {
xdescribe("Generic Message Renderer", () => {
beforeEach(() => {
cy.visitMessageRenderer();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const supportedMessageFixtures = [
"video",
];

describe("isMessageSupported", () => {
xdescribe("isMessageSupported", () => {
for (const message of supportedMessageFixtures) {
it(`returns true for a "${message}" message`, () => {
cy.visitMessageRenderer();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
describe('Source Direction Mapping', () => {
// TODO move it to s separate from outdated message-render as it is still a valid test case
xdescribe('Source Direction Mapping', () => {
beforeEach(() => {
cy.visitMessageRenderer();
});
Expand Down
10 changes: 8 additions & 2 deletions cypress/integration/priorities.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ const renderMessageWithParams = (params: IGenerateTestCaseParams) => {
const getDummyMessage = (text: string) => ({
message: {
text,
quick_replies: []
quick_replies: [ {
"id": 0.44535334241574,
"contentType": "postback",
"payload": "foobar003pb01",
"title": "foobar003qr01"
},]
}
});

Expand Down Expand Up @@ -110,7 +115,8 @@ const generateTestCase = (params: IGenerateTestCaseParams) => {
});
}

describe("Channel Rendering Priorities", {
// TODO Enable back when bug fixed #AI:65271
xdescribe("Channel Rendering Priorities", {
defaultCommandTimeout: 500
}, () => {
beforeEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/regressions/19420-null-buttons.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('Message Templates with null Buttons', () => {
cy.contains('foobar005').should('be.visible');
});

it('renders text+quick replies with null quick replies', () => {
it.skip('renders text+quick replies with null quick replies', () => {
cy.fixture('messages/quick-replies-with-null-quick-replies.json')
.then(({ text, data, source }) => {
cy.receiveMessage(text, data, source);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
describe("Malformed Default Reply Messages", () => {
it("Does not crash when rendering a malformed default reply message with webchat tab content", () => {
it.skip("Does not crash when rendering a malformed default reply message with webchat tab content", () => {
cy.visitWebchat();
cy.initMockWebchat();
cy.openWebchat();
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Cypress.Commands.add('openWebchat', () => {
});

Cypress.Commands.add('startConversation', () => {
return cy.contains("Start conversation").click();
return cy.contains("Start conversation", { timeout: 5000 }).click();
});

Cypress.Commands.add('submitPrivacyScreen', () => {
Expand Down
29 changes: 17 additions & 12 deletions docs/custom-avatars.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,43 @@
# Custom Avatars

During the conversation, you can swap the image URLs used for `Bot` and `Agent` avatars by sending certain message content:

Set a bot avatar override

```json
{
"_webchat": {
"botAvatarOverrideUrl": "https://placekitten.com/200/200"
}
"_webchat": {
"botAvatarOverrideUrl": "https://placewaifu.com/image/200/200"
}
}
```

Reset the bot avatar

```json
{
"_webchat": {
"botAvatarOverrideUrl": ""
}
"_webchat": {
"botAvatarOverrideUrl": ""
}
}
```

Set an agent avatar override

```json
{
"_webchat": {
"agentAvatarOverrideUrl": "https://placekitten.com/200/200"
}
"_webchat": {
"agentAvatarOverrideUrl": "https://placewaifu.com/image/200/200"
}
}
```

Reset the agent avatar

```json
{
"_webchat": {
"agentAvatarOverrideUrl": ""
}
"_webchat": {
"agentAvatarOverrideUrl": ""
}
}
```
Loading

0 comments on commit a3de421

Please sign in to comment.