From 48718b687d61cb84cea39c855311b31de10273bd Mon Sep 17 00:00:00 2001 From: Henning Hall Date: Tue, 31 Mar 2020 23:01:39 +0200 Subject: [PATCH] Add tests for display texts in date mode --- examples/detox/e2e/tests/displayText.spec.js | 43 +++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/examples/detox/e2e/tests/displayText.spec.js b/examples/detox/e2e/tests/displayText.spec.js index 5123f61..056d783 100644 --- a/examples/detox/e2e/tests/displayText.spec.js +++ b/examples/detox/e2e/tests/displayText.spec.js @@ -1,4 +1,11 @@ -const { setLocale, expectDateString, scrollWheel } = require('../utils') +const { + setMode, + setLocale, + expectDateString, + scrollWheel, + setMinimumDate, + setMaximumDate, +} = require('../utils') describe('Display text', () => { before(async () => { @@ -32,6 +39,40 @@ describe('Display text', () => { }) }) + describe('date', () => { + before(async () => { + await device.reloadReactNative() + await element(by.text('Advanced')).tap() + await setMinimumDate(undefined) + await setMaximumDate(undefined) + await setMode('date') + }) + + it('en-US', async () => { + await expectLocaleDateString('en-US', 'February' + '1' + '2000') + }) + + it('pt-BR', async () => { + await expectLocaleDateString('pt-BR', '2janeiro' + '2000') + }) + + it('sv-SE', async () => { + await expectLocaleDateString('sv-SE', '2' + 'januari' + '2000') + }) + + it('ko', async () => { + await expectLocaleDateString('ko', '2001년' + '1월' + '1일') + }) + + it('ja', async () => { + await expectLocaleDateString('ja', '2001年' + '1月' + '1日') + }) + + it('zh-CH', async () => { + await expectLocaleDateString('zh-CH', '2001年' + '1月' + '1日') + }) + }) + const expectLocaleDateString = async (locale, dateString) => { await setLocale(locale) await scrollWheel(0, 1)