-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WRQ-25856: Add missing ui/ss tests for Arc --> MediaPlayer (#796)
* ui and ss tests * changed names * fixed review issues --------- Co-authored-by: dongsu.won <[email protected]>
- Loading branch information
1 parent
a4f380f
commit 47e9790
Showing
10 changed files
with
258 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,20 @@ | ||
import ArcPicker from '../../../../ArcPicker'; | ||
|
||
import {withConfig} from './utils'; | ||
|
||
const ArcPickerTests = [ | ||
<ArcPicker>{[1, 2, 3, 4]}</ArcPicker>, | ||
<ArcPicker endAngle={300} startAngle={10}>{[1, 2, 3, 4]}</ArcPicker> | ||
<ArcPicker endAngle={300} startAngle={10}>{[1, 2, 3, 4]}</ArcPicker>, | ||
<ArcPicker value={3}>{[1, 2, 3, 4]}</ArcPicker>, | ||
<ArcPicker value={3} selectionType="cumulative">{[1, 2, 3, 4]}</ArcPicker>, | ||
<ArcPicker disabled>{[1, 2, 3, 4]}</ArcPicker>, | ||
|
||
// Focus | ||
...withConfig({focus: true}, [ | ||
<ArcPicker value={3}>{[1, 2, 3, 4, 5]}</ArcPicker>, | ||
<ArcPicker value={3} selectionType="cumulative">{[1, 2, 3, 4, 5]}</ArcPicker>, | ||
<ArcPicker disabled>{[1, 2, 3, 4, 5]}</ArcPicker> | ||
]) | ||
]; | ||
|
||
export default ArcPickerTests; |
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
40 changes: 22 additions & 18 deletions
40
tests/screenshot/apps/components/ContextualPopupDecorator.js
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 |
---|---|---|
@@ -1,28 +1,32 @@ | ||
import Button from '../../../../Button'; | ||
import ContextualPopupDecorator from '../../../../ContextualPopupDecorator'; | ||
|
||
import {withConfig} from './utils'; | ||
|
||
const ContextualButton = ContextualPopupDecorator(Button); | ||
const Popup = () => <div>hello</div>; | ||
|
||
const wrapper = { | ||
padded: '240px' | ||
}; | ||
|
||
const ContextualPopupDecoratorTests = [ | ||
{ | ||
component: <ContextualButton open popupComponent={Popup}>Button</ContextualButton>, | ||
wrapper: { | ||
padded: true | ||
} | ||
}, | ||
{ | ||
component: <ContextualButton open direction="right middle" popupComponent={Popup}>Button</ContextualButton>, | ||
wrapper: { | ||
padded: true | ||
} | ||
}, | ||
{ | ||
component: <ContextualButton open popupComponent={Popup} showCloseButton>Button</ContextualButton>, | ||
wrapper: { | ||
padded: true | ||
} | ||
} | ||
...withConfig({wrapper}, [ | ||
<ContextualButton open popupComponent={Popup}>Button</ContextualButton>, | ||
<ContextualButton open direction="above center" popupComponent={Popup}>Button</ContextualButton>, | ||
<ContextualButton open direction="above left" popupComponent={Popup}>Button</ContextualButton>, | ||
<ContextualButton open direction="above right" popupComponent={Popup}>Button</ContextualButton>, | ||
<ContextualButton open direction="below center" popupComponent={Popup}>Button</ContextualButton>, | ||
<ContextualButton open direction="below left" popupComponent={Popup}>Button</ContextualButton>, | ||
<ContextualButton open direction="below right" popupComponent={Popup}>Button</ContextualButton>, | ||
<ContextualButton open direction="left middle" popupComponent={Popup}>Button</ContextualButton>, | ||
<ContextualButton open direction="left top" popupComponent={Popup}>Button</ContextualButton>, | ||
<ContextualButton open direction="left bottom" popupComponent={Popup}>Button</ContextualButton>, | ||
<ContextualButton open direction="right middle" popupComponent={Popup}>Button</ContextualButton>, | ||
<ContextualButton open direction="right top" popupComponent={Popup}>Button</ContextualButton>, | ||
<ContextualButton open direction="right bottom" popupComponent={Popup}>Button</ContextualButton>, | ||
<ContextualButton open popupComponent={Popup} showCloseButton>Button</ContextualButton> | ||
]) | ||
]; | ||
|
||
export default ContextualPopupDecoratorTests; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import Checkbox from '../../../../Checkbox'; | ||
import ThemeDecorator from '../../../../ThemeDecorator'; | ||
import spotlight from '@enact/spotlight'; | ||
|
||
// NOTE: Forcing pointer mode off so we can be sure that regardless of webOS pointer mode the app | ||
// runs the same way | ||
spotlight.setPointerMode(false); | ||
|
||
const app = (props) => <div {...props}> | ||
<div style={{padding: '20px'}}> | ||
<Checkbox | ||
id="defaultCheckbox" | ||
/> | ||
</div> | ||
<div style={{padding: '20px'}}> | ||
<Checkbox | ||
id="selectedCheckbox" | ||
defaultSelected | ||
/> | ||
</div> | ||
<div style={{padding: '20px'}}> | ||
<Checkbox | ||
id="indeterminateCheckbox" | ||
indeterminate | ||
/> | ||
</div> | ||
<div style={{padding: '20px'}}> | ||
<Checkbox | ||
id="disabledCheckbox" | ||
disabled | ||
/> | ||
</div> | ||
</div>; | ||
|
||
export default ThemeDecorator(app); |
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,114 @@ | ||
const Page = require('./CheckboxPage'); | ||
|
||
describe('Checkbox', function () { | ||
|
||
beforeEach(async function () { | ||
await Page.open(); | ||
}); | ||
|
||
const { | ||
defaultCheckbox, | ||
selectedCheckbox, | ||
indeterminateCheckbox, | ||
disabledCheckbox | ||
} = Page.components; | ||
|
||
describe('default', function () { | ||
it('should focus on load', async function () { | ||
expect(await defaultCheckbox.self.isFocused()).toBe(true); | ||
}); | ||
|
||
it('should not be checked', async function () { | ||
expect(await defaultCheckbox.isChecked).toBe(false); | ||
}); | ||
|
||
it('should be checked', async function () { | ||
expect(await selectedCheckbox.isChecked).toBe(true); | ||
}); | ||
}); | ||
|
||
describe('5-way', function () { | ||
it('should focus', async function () { | ||
await Page.spotlightDown(); | ||
|
||
expect(await selectedCheckbox.self.isFocused()).toBe(true); | ||
|
||
await Page.spotlightDown(); | ||
|
||
expect(await indeterminateCheckbox.self.isFocused()).toBe(true); | ||
|
||
await Page.spotlightDown(); | ||
|
||
expect(await disabledCheckbox.self.isFocused()).toBe(true); | ||
}); | ||
|
||
it('should get checked', async function () { | ||
await Page.spotlightSelect(); | ||
|
||
expect(await defaultCheckbox.isChecked).toBe(true); | ||
}); | ||
|
||
it('should get checked \'indeterminate\'', async function () { | ||
await Page.spotlightDown(); | ||
await Page.spotlightDown(); | ||
await Page.spotlightSelect(); | ||
|
||
expect(await indeterminateCheckbox.isChecked).toBe(true); | ||
}); | ||
|
||
it('should re-uncheck the item when selected twice', async function () { | ||
await Page.spotlightSelect(); | ||
await Page.spotlightSelect(); | ||
expect(await defaultCheckbox.isChecked).toBe(false); | ||
}); | ||
|
||
it('should not get checked', async function () { | ||
await Page.spotlightDown(); | ||
await Page.spotlightDown(); | ||
await Page.spotlightDown(); | ||
await Page.spotlightSelect(); | ||
|
||
expect(await disabledCheckbox.isChecked).toBe(false); | ||
}); | ||
|
||
it('should get unchecked', async function () { | ||
await Page.spotlightDown(); | ||
await Page.spotlightSelect(); | ||
|
||
expect(await selectedCheckbox.isChecked).toBe(false); | ||
}); | ||
}); | ||
|
||
describe('pointer', function () { | ||
it('should get checked', async function () { | ||
await defaultCheckbox.self.click(); | ||
|
||
expect(await defaultCheckbox.isChecked).toBe(true); | ||
}); | ||
|
||
it('should get checked \'indeterminate\'', async function () { | ||
await indeterminateCheckbox.self.click(); | ||
|
||
expect(await indeterminateCheckbox.isChecked).toBe(true); | ||
}); | ||
|
||
it('should re-uncheck the item when selected twice', async function () { | ||
await defaultCheckbox.self.click(); | ||
await defaultCheckbox.self.click(); | ||
|
||
expect(await defaultCheckbox.isChecked).toBe(false); | ||
}); | ||
|
||
it('should not get checked', async function () { | ||
await disabledCheckbox.self.click(); | ||
|
||
expect(await disabledCheckbox.isChecked).toBe(false); | ||
}); | ||
|
||
it('should get unchecked', async function () { | ||
await selectedCheckbox.self.click(); | ||
|
||
expect(await selectedCheckbox.isChecked).toBe(false); | ||
}); | ||
}); | ||
}); |
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,40 @@ | ||
'use strict'; | ||
const {Page} = require('@enact/ui-test-utils/utils'); | ||
|
||
class CheckboxInterface { | ||
constructor (id) { | ||
this.id = `${id}`; | ||
} | ||
|
||
get self () { | ||
return $(`#${this.id}`); | ||
} | ||
|
||
get isChecked () { | ||
return $(`#${this.id}.Checkbox_Checkbox_selected`).isExisting(); | ||
} | ||
} | ||
|
||
class CheckboxPage extends Page { | ||
constructor () { | ||
super(); | ||
this.title = 'Checkbox Test'; | ||
const defaultCheckbox = new CheckboxInterface('defaultCheckbox'); | ||
const selectedCheckbox = new CheckboxInterface('selectedCheckbox'); | ||
const indeterminateCheckbox = new CheckboxInterface('indeterminateCheckbox'); | ||
const disabledCheckbox = new CheckboxInterface('disabledCheckbox'); | ||
|
||
this.components = { | ||
defaultCheckbox, | ||
selectedCheckbox, | ||
indeterminateCheckbox, | ||
disabledCheckbox | ||
}; | ||
} | ||
|
||
async open (urlExtra) { | ||
await super.open('Checkbox-View', urlExtra); | ||
} | ||
} | ||
|
||
module.exports = new CheckboxPage(); |