-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Hebrew to list of languages * Minor styling adjustments to playground * Update Basic Web Chat to function component * move prettier-readmes into lint-staged * Add getRTLList.js to fetch RTL languages * update package.jsono * Determine direction based off language if dir='auto' * Support manually setting direction in playground * Add margins to both side of components, ex spinner, for RTL * Deprecate spinnerAnimationPaddingRight in favor of spinnerAnimationPadding * Fix CHANGELOG rebase error * Refactor useDirection * Suggested actions RTL * Fix SpinnerAnimation styling for rtl and ltr * tranform SendIcon and TypingAnimation based on dir * Update LOCALIZATION file * Update playground App.js with ar-JO * Add ar-JO to localization with rtl support * Add rtl languages to embed locale * Add rtl support for Carousel * Add rtl support for bubble nub * Add rtl support to Scroll to end button * Fix carousel film strip timestamp in rtl * Add useDirection documentation to HOOKS.md * md file cleanup * Refactor fixes * RTL support for icons * Refactor RTL support in Bubble.js * Refactor RTL support in carousel * Refactor RTL for stacked and error * Refactor other components for RTL * Add unofficial Adaptive Card RTL support * Add RTL to FileContent component * File cleanup * Restore change-locale sample & create change-locale-direction * Carousel padding fix & readme cleanup * Linting fixes * Update CHANGELOG & documentation * Fix linting errors * New RTL tests * Add retaken screenshots * Remove echos from tableflip command * Add more rtl tests * Fix #2903 * Fix #2902 * Apply suggestions from code review Co-Authored-By: William Wong <[email protected]> * Comment cleanup * Update packages/component/src/Styles/StyleSet/SpinnerAnimation.js Co-Authored-By: William Wong <[email protected]> Co-authored-by: William Wong <[email protected]>
- Loading branch information
Showing
75 changed files
with
1,623 additions
and
463 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+43.6 KB
...er/rtl-js-rtl-ui-carousel-should-scroll-to-the-left-instead-of-right-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+52.7 KB
...th-avatar-initials-should-display-user-and-bot-in-reversed-positions-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.63 KB
...hrome-docker/rtl-js-rtl-ui-should-show-suggested-actions-with-images-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.81 KB
...d-show-unable-to-connect-ui-in-arabic-when-credentials-are-incorrect-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13.2 KB
...ker/rtl-js-rtl-ui-unknown-command-with-nubs-should-display-correctly-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+35.4 KB
...ocker/rtl-js-rtl-ui-with-adaptive-card-should-be-displayed-correctly-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+18 KB
...e-docker/rtl-js-rtl-ui-with-audio-card-should-be-displayed-correctly-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-3.8 KB
(93%)
...licking-new-messages-button-should-scroll-to-end-and-stick-to-bottom-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1 Byte
(100%)
...licking-new-messages-button-should-scroll-to-end-and-stick-to-bottom-2-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1 Byte
(100%)
...licking-new-messages-button-should-scroll-to-end-and-stick-to-bottom-3-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-3.8 KB
(93%)
...cker/use-scroll-to-end-js-calling-scroll-to-end-should-scroll-to-end-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1 Byte
(100%)
...cker/use-scroll-to-end-js-calling-scroll-to-end-should-scroll-to-end-2-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-3.8 KB
(93%)
...__/chrome-docker/use-text-box-js-calling-submit-should-scroll-to-end-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+3 Bytes
(100%)
...__/chrome-docker/use-text-box-js-calling-submit-should-scroll-to-end-2-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
import { By } from 'selenium-webdriver'; | ||
|
||
import { imageSnapshotOptions, timeouts } from './constants.json'; | ||
|
||
import allImagesLoaded from './setup/conditions/allImagesLoaded'; | ||
import minNumActivitiesShown from './setup/conditions/minNumActivitiesShown'; | ||
import suggestedActionsShown from './setup/conditions/suggestedActionsShown'; | ||
import uiConnected from './setup/conditions/uiConnected'; | ||
|
||
// selenium-webdriver API doc: | ||
// https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_WebDriver.html | ||
|
||
jest.setTimeout(timeouts.test); | ||
|
||
async function sendMessageAndMatchSnapshot(driver, pageObjects, message) { | ||
await driver.wait(uiConnected(), timeouts.directLine); | ||
await pageObjects.sendMessageViaSendBox(message); | ||
|
||
await driver.wait(minNumActivitiesShown(2), timeouts.directLine); | ||
await driver.wait(allImagesLoaded(), timeouts.fetchImage); | ||
|
||
const base64PNG = await driver.takeScreenshot(); | ||
|
||
expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions); | ||
} | ||
|
||
describe('rtl UI', () => { | ||
let props; | ||
|
||
beforeEach(() => { | ||
props = { | ||
locale: 'ar-EG' | ||
}; | ||
}); | ||
|
||
test('should show "unable to connect" UI in Arabic when credentials are incorrect', async () => { | ||
const { driver } = await setupWebDriver({ | ||
props: { | ||
...props | ||
}, | ||
createDirectLine: () => { | ||
return window.WebChat.createDirectLine({ token: 'INVALID-TOKEN' }); | ||
}, | ||
pingBotOnLoad: false, | ||
setup: () => | ||
new Promise(resolve => { | ||
const scriptElement = document.createElement('script'); | ||
|
||
scriptElement.onload = resolve; | ||
scriptElement.setAttribute('src', 'https://unpkg.com/[email protected]/client/core.min.js'); | ||
|
||
document.head.appendChild(scriptElement); | ||
}) | ||
}); | ||
|
||
await driver.wait(async driver => { | ||
return await driver.executeScript( | ||
() => !!~window.WebChatTest.actions.findIndex(({ type }) => type === 'DIRECT_LINE/CONNECT_REJECTED') | ||
); | ||
}, timeouts.directLine); | ||
|
||
const base64PNG = await driver.takeScreenshot(); | ||
|
||
expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions); | ||
}); | ||
|
||
test('unknown command with nubs should display correctly', async () => { | ||
const { driver, pageObjects } = await setupWebDriver({ | ||
props: { | ||
...props, | ||
styleOptions: { | ||
bubbleNubOffset: 0, | ||
bubbleNubSize: 10, | ||
bubbleFromUserNubOffset: 0, | ||
bubbleFromUserNubSize: 10 | ||
} | ||
} | ||
}); | ||
|
||
await sendMessageAndMatchSnapshot(driver, pageObjects, 'صباح الخير'); | ||
}); | ||
|
||
test('carousel with avatar initials should display user and bot in reversed positions', async () => { | ||
const { driver, pageObjects } = await setupWebDriver({ | ||
props: { | ||
...props, | ||
styleOptions: { | ||
botAvatarInitials: 'WC', | ||
userAvatarInitials: 'WW' | ||
} | ||
} | ||
}); | ||
|
||
await sendMessageAndMatchSnapshot(driver, pageObjects, 'arabic carousel'); | ||
}); | ||
|
||
test('carousel should scroll to the left instead of right', async () => { | ||
const { driver, pageObjects } = await setupWebDriver({ | ||
props: { | ||
...props | ||
} | ||
}); | ||
|
||
await driver.wait(uiConnected(), timeouts.directLine); | ||
await pageObjects.sendMessageViaSendBox('arabic carousel', { waitForSend: true }); | ||
|
||
await driver.wait(minNumActivitiesShown(2), timeouts.directLine); | ||
await driver.wait(allImagesLoaded(), timeouts.fetchImage); | ||
|
||
const leftFlipper = await driver.findElement(By.css('button[aria-label="يسار"]')); | ||
|
||
await leftFlipper.click(); | ||
await leftFlipper.click(); | ||
await leftFlipper.click(); | ||
await leftFlipper.click(); | ||
|
||
// Wait for carousel animation to finish | ||
await driver.sleep(timeouts.ui); | ||
|
||
expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions); | ||
}); | ||
|
||
test('with Adaptive Card should be displayed correctly', async () => { | ||
const { driver, pageObjects } = await setupWebDriver({ | ||
props: { | ||
...props | ||
} | ||
}); | ||
|
||
await sendMessageAndMatchSnapshot(driver, pageObjects, 'card arabicgreeting'); | ||
}); | ||
|
||
test('with Audio Card should be displayed correctly', async () => { | ||
const { driver, pageObjects } = await setupWebDriver({ | ||
props: { | ||
...props | ||
} | ||
}); | ||
|
||
await sendMessageAndMatchSnapshot(driver, pageObjects, 'audiocard'); | ||
}); | ||
|
||
test('should show suggested actions with images', async () => { | ||
const { driver, pageObjects } = await setupWebDriver({ | ||
props: { ...props } | ||
}); | ||
|
||
await driver.wait(uiConnected(), timeouts.directLine); | ||
await pageObjects.sendMessageViaSendBox('emptycard', { waitForSend: true }); | ||
|
||
await driver.wait(suggestedActionsShown(), timeouts.directLine); | ||
await driver.wait(allImagesLoaded(), timeouts.fetchImage); | ||
|
||
const base64PNG = await driver.takeScreenshot(); | ||
|
||
expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.