Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
liamcho committed Dec 6, 2024
1 parent 9ee75e1 commit bae8051
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions __visual_tests__/utils/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { expect, Page } from '@playwright/test';

import { getWidgetSessionCache } from './localStorageUtils';
import { deleteChannel, deleteUser } from './requestUtils';
import {AppId, BotId, TestUrl, WidgetComponentIds} from '../const';
import { AppId, BotId, TestUrl, WidgetComponentIds } from '../const';

export async function beforeEach(page: Page, url = TestUrl) {
await page.goto(url);

const widgetWindow = page.locator(WidgetComponentIds.WIDGET_BUTTON);
await widgetWindow.waitFor({ state: 'visible' });
}
Expand Down
15 changes: 7 additions & 8 deletions __visual_tests__/workflow-tests.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { test } from '@playwright/test';

import {TestUrl, WidgetComponentIds} from './const';
import { TestUrl, WidgetComponentIds } from './const';
import {
assertScreenshot,
beforeEach,
clickNthChip,
deleteTestResources,
loadWidget,
sendTextMessage
sendTextMessage,
} from './utils/testUtils';

test.afterEach(async ({ page }) => {
Expand Down Expand Up @@ -158,14 +158,14 @@ test('104', async ({ page, browserName }) => {
await loadWidget(page);
// 1
await sendTextMessage(page, 'give me a markdown message', 2000);

// Check if the fallback component is visible
const fallback = page.locator(WidgetComponentIds.MARKDOWN);
await fallback.first().waitFor({ state: 'visible' });
let options = page.locator(WidgetComponentIds.SUGGESTED_REPLIES_OPTIONS);
await options.nth(3).waitFor({ state: 'visible' });
await assertScreenshot(page, '104-1', browserName);

// 2
await options.nth(0).click();
options = page.locator(WidgetComponentIds.SUGGESTED_REPLIES_OPTIONS);
Expand All @@ -174,7 +174,7 @@ test('104', async ({ page, browserName }) => {
await options.nth(0).click(); // Go back
options = page.locator(WidgetComponentIds.SUGGESTED_REPLIES_OPTIONS);
await options.nth(3).waitFor({ state: 'visible' });

// 3
await options.nth(1).click();
options = page.locator(WidgetComponentIds.SUGGESTED_REPLIES_OPTIONS);
Expand All @@ -183,7 +183,7 @@ test('104', async ({ page, browserName }) => {
await options.nth(0).click(); // Go back
options = page.locator(WidgetComponentIds.SUGGESTED_REPLIES_OPTIONS);
await options.nth(3).waitFor({ state: 'visible' });

// 4
await options.nth(2).click();
options = page.locator(WidgetComponentIds.SUGGESTED_REPLIES_OPTIONS);
Expand All @@ -192,11 +192,10 @@ test('104', async ({ page, browserName }) => {
await options.nth(0).click(); // Go back
options = page.locator(WidgetComponentIds.SUGGESTED_REPLIES_OPTIONS);
await options.nth(3).waitFor({ state: 'visible' });

// 5
await options.nth(3).click();
options = page.locator(WidgetComponentIds.SUGGESTED_REPLIES_OPTIONS);
await options.nth(0).waitFor({ state: 'visible' }); // Wait for go back button to show
await assertScreenshot(page, '104-5', browserName);
});

6 changes: 4 additions & 2 deletions src/components/markdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
color: var(--sb-on-content-inverse-1);
}

.widget-markdown *:first-child { /* First child element should have no top margin */
.widget-markdown *:first-child {
/* First child element should have no top margin */
margin-top: 0;
}

.widget-markdown *:last-child { /* Last child element should have no bottom margin */
.widget-markdown *:last-child {
/* Last child element should have no bottom margin */
margin-bottom: 0;
}

Expand Down
4 changes: 2 additions & 2 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ const WidgetApp = () => {
botStudioEditProps={
isSuggestedRepliesHorizontal
? {
suggestedRepliesDirection: 'horizontal',
}
suggestedRepliesDirection: 'horizontal',
}
: undefined
}
enableMessageGrouping={!isSnapshot}
Expand Down

0 comments on commit bae8051

Please sign in to comment.