Shiratesã使ã£ã¦ã¿ãã - ç»é¢ããã¯ãã¼ã -ï¼ãã®ï¼ï¼
Shiratesã®ç»é¢ããã¯ãã¼ã ãç´¹ä»ãã¾ãã
ãã¡ãã®è¨äºã®ç¿»è¨³ã§ãã
ãµã³ãã«ã³ã¼ãã®å ¥æ
æ¬è¨äºã§èª¬æãããµã³ãã«ã³ã¼ãã®å®æçã¯ãã¡ãããå ¥æãã¦ãã ããã https://github.com/wave1008/shirates-samples-nicknames
Example 2: Androidã®è¨å®ã¢ããª
ãã®ãµã³ãã«ã§ã¯Androidã®è¨å®ã¢ããªã®4ã¤ã®ç»é¢ã使ç¨ãã¦ç»é¢ããã¯ãã¼ã ã®ä½¿ãæ¹ã説æãã¾ãã
è¨å®ç»é¢
ã·ã¹ãã ç»é¢/è¨èªã¨å ¥åç»é¢/è¨èªç»é¢
[Androidè¨å®ãããç»é¢].json
{ "key": "[Androidè¨å®ãããç»é¢]", "identity": "#recycler_view", "satellites": ["ããããªã¼", "ã¦ã¼ã¶ã¼è£å©", "ãã¹ã¯ã¼ãã¨ã¢ã«ã¦ã³ã", "ãã³ãã¨ãµãã¼ã"], "selectors": { "[ã¢ã«ã¦ã³ãã¢ãã¿ã¼]": "#account_avatar", "[è¨å®]": "#homepage_title", "[æ¤ç´¢ãã¿ã³]": "<#search_action_bar>:inner(1)", "[è¨å®ãæ¤ç´¢]": "#search_action_bar_title", "[ãããã¯ã¼ã¯ã¨ã¤ã³ã¿ã¼ããã]": "", "{ãããã¯ã¼ã¯ã¨ã¤ã³ã¿ã¼ããã}": "[ãããã¯ã¼ã¯ã¨ã¤ã³ã¿ã¼ããã]:label", "[ãããã¯ã¼ã¯ã¨ã¤ã³ã¿ã¼ãããã¢ã¤ã³ã³]": "[ãããã¯ã¼ã¯ã¨ã¤ã³ã¿ã¼ããã]:leftImage", "[æ¥ç¶æ¸ã¿ã®ããã¤ã¹]": "", "{æ¥ç¶æ¸ã¿ã®ããã¤ã¹}": "[æ¥ç¶æ¸ã¿ã®ããã¤ã¹]:label", "[æ¥ç¶æ¸ã¿ã®ããã¤ã¹ã¢ã¤ã³ã³]": "[æ¥ç¶æ¸ã¿ã®ããã¤ã¹]:leftImage", "[ã¢ããª]": "", "{ã¢ããª}": "[ã¢ããª]:label", "[ã¢ããªã¢ã¤ã³ã³]": "[ã¢ããª]:leftImage", "[éç¥]": "", "{éç¥}": "[éç¥]:label", "[éç¥ã¢ã¤ã³ã³]": "[éç¥]:leftImage", "[ããããªã¼]": "", "{ããããªã¼}": "[ããããªã¼]:label", "[ããããªã¼ã¢ã¤ã³ã³]": "[ããããªã¼]:leftImage", "[ã¹ãã¬ã¼ã¸]": "", "{ã¹ãã¬ã¼ã¸}": "[ã¹ãã¬ã¼ã¸]:label", "[ã¹ãã¬ã¼ã¸ã¢ã¤ã³ã³]": "[ã¹ãã¬ã¼ã¸]:leftImage", "[çä¿¡é³ã¨ãã¤ãã¬ã¼ã·ã§ã³]": "", "{çä¿¡é³ã¨ãã¤ãã¬ã¼ã·ã§ã³}": "[çä¿¡é³ã¨ãã¤ãã¬ã¼ã·ã§ã³]:label", "[çä¿¡é³ã¨ãã¤ãã¬ã¼ã·ã§ã³ã¢ã¤ã³ã³]": "[çä¿¡é³ã¨ãã¤ãã¬ã¼ã·ã§ã³]:leftImage", "[ãã£ã¹ãã¬ã¤]": "", "{ãã£ã¹ãã¬ã¤}": "[ãã£ã¹ãã¬ã¤]:label", "[ãã£ã¹ãã¬ã¤ã¢ã¤ã³ã³]": "[ãã£ã¹ãã¬ã¤]:leftImage", "[å£ç´ã¨ã¹ã¿ã¤ã«]": "", "{å£ç´ã¨ã¹ã¿ã¤ã«}": "[å£ç´ã¨ã¹ã¿ã¤ã«]:label", "[å£ç´ã¨ã¹ã¿ã¤ã«ã¢ã¤ã³ã³]": "[å£ç´ã¨ã¹ã¿ã¤ã«]:leftImage", "[ã¦ã¼ã¶ã¼è£å©]": "", "{ã¦ã¼ã¶ã¼è£å©}": "[ã¦ã¼ã¶ã¼è£å©]:label", "[ã¦ã¼ã¶ã¼è£å©ã¢ã¤ã³ã³]": "[ã¦ã¼ã¶ã¼è£å©]:leftImage", "[ã»ãã¥ãªãã£]": "", "{ã»ãã¥ãªãã£}": "[ã»ãã¥ãªãã£]:label", "[ã»ãã¥ãªãã£ã¢ã¤ã³ã³]": "[ã»ãã¥ãªãã£]:leftImage", "[ãã©ã¤ãã·ã¼]": "", "{ãã©ã¤ãã·ã¼}": "[ãã©ã¤ãã·ã¼]:label", "[ãã©ã¤ãã·ã¼ã¢ã¤ã³ã³]": "[ãã©ã¤ãã·ã¼]:leftImage", "[ä½ç½®æ å ±]": "", "{ä½ç½®æ å ±}": "[ä½ç½®æ å ±]:label", "[ä½ç½®æ å ±ã¢ã¤ã³ã³]": "[ä½ç½®æ å ±]:leftImage", "[ç·æ¥æ å ±ã¨ç·æ¥éå ±]": "", "{ç·æ¥æ å ±ã¨ç·æ¥éå ±}": "[ç·æ¥æ å ±ã¨ç·æ¥éå ±]:label", "[ç·æ¥æ å ±ã¨ç·æ¥éå ±ã¢ã¤ã³ã³]": "[ç·æ¥æ å ±ã¨ç·æ¥éå ±]:leftImage", "[ãã¹ã¯ã¼ãã¨ã¢ã«ã¦ã³ã]": "", "{ãã¹ã¯ã¼ãã¨ã¢ã«ã¦ã³ã}": "[ãã¹ã¯ã¼ãã¨ã¢ã«ã¦ã³ã]:label", "[ãã¹ã¯ã¼ãã¨ã¢ã«ã¦ã³ãã¢ã¤ã³ã³]": "[ãã¹ã¯ã¼ãã¨ã¢ã«ã¦ã³ã]:leftImage", "[Google]": "", "{Google}": "[Google]:label", "[Google Icon]": "[Google]:leftImage", "[ã·ã¹ãã ]": "", "{ã·ã¹ãã }": "[ã·ã¹ãã ]:label", "[ã·ã¹ãã ã¢ã¤ã³ã³]": "[ã·ã¹ãã ]:leftImage", "[ã¨ãã¥ã¬ã¼ããããããã¤ã¹ã«ã¤ãã¦]": "", "{ã¨ãã¥ã¬ã¼ããããããã¤ã¹ã«ã¤ãã¦}": "[ã¨ãã¥ã¬ã¼ããããããã¤ã¹ã«ã¤ãã¦]:label", "[ã¨ãã¥ã¬ã¼ããããããã¤ã¹ã«ã¤ãã¦ã¢ã¤ã³ã³]": "[ã¨ãã¥ã¬ã¼ããããããã¤ã¹ã«ã¤ãã¦]:leftImage", "[ããã¤ã¹æ å ±]": "", "{ããã¤ã¹æ å ±}": "[ããã¤ã¹æ å ±]:label", "[ããã¤ã¹æ å ±ã¢ã¤ã³ã³]": "[ããã¤ã¹æ å ±]:leftImage", "[ãã³ãã¨ãµãã¼ã]": "", "{ãã³ãã¨ãµãã¼ã}": "[ãã³ãã¨ãµãã¼ã]:label", "[ãã³ãã¨ãµãã¼ãã¢ã¤ã³ã³]": "[ãã³ãã¨ãµãã¼ã]:leftImage" }, "scroll": { "start-elements": "", "end-elements": "{ãã³ãã¨ãµãã¼ã}", "overlay-elements": "[æ¤ç´¢ãã¿ã³][è¨å®ãæ¤ç´¢]" } }
satellitesä»ãidentity
Androidã®è¨å®ã¢ããªã¯ã¹ã¯ãã¼ã«å¯è½ãªãã¥ã¼ã§ããã常ã«è¡¨ç¤ºãããåºå®ãããèå¥åãæã¡ã¾ããããã®ãããªå ´åãsatellites
ä»ãã®identity
ã使ç¨ãã¦è¡¨ç¤ºãããç»é¢ãèå¥ãããã¨ãã§ãã¾ãã
"identity": "#recycler_view", "satellites": ["ããããªã¼", "ã¦ã¼ã¶ã¼è£å©", "ãã¹ã¯ã¼ãã¨ã¢ã«ã¦ã³ã", "ãã³ãã¨ãµãã¼ã"],
ä¸è¨ã®ä¾ã§ã¯"identity": "#recycler_view"
ã¯å¸¸ã«è¡¨ç¤ºããã¾ãããåç¬ã§ã¦ãã¼ã¯ã§ã¯ããã¾ããã"satellites"ã¯Androidè¨å®ç»é¢ã«ããã¦ããã®ã¡ã³ãã¼ã®ããããã表示ããããªã¹ãã§ãã"identity"+"satellites"
ã¯ç»é¢ã®ã¦ãã¼ã¯èå¥åã¨ãã¦èªèããã¾ãã
ç¸å¯¾ã»ã¬ã¯ã¿ã¼
Appiumã¯å ¨ã¦ã®è¦ç´ ãã¦ãã¼ã¯ãªå±æ§ãæã¤ããããå®è£ ããããã¨ãåæã¨ãã¦ããããã§ãããããå®éã«ã¯ãç¹ã«ã¹ã¯ãã¼ã«å¯è½ãªç»é¢ã«ããã¦ã¯ãã¦ãã¼ã¯ãªèå¥åãæããªãè¦ç´ ã¯ããããããã¾ãã
Shiratesã§ã¯ç¸å¯¾ã»ã¬ã¯ã¿ã¼ãå°å ¥ãã¦ãã®åé¡ã解決ãã¾ããUIè¦ç´ ã®ã°ã«ã¼ãã®ãã¡å°ãªãã¨ã1ã¤ã®ã¡ã³ãã¼ãã¦ãã¼ã¯èå¥åãæã¤å ´åããã®å¨è¾ºã®è¦ç´ ã¯ç¸å¯¾çã«åå¾ãããã¨ãã§ãã¾ãã
以ä¸ã®ç»åãã¿ã¦ãã ããã
"ããããªã¼"
ã¯éçãªã³ã³ãã³ãã§ããããã¤ã¦ãã¼ã¯ã§ãã"100%"
ã¯åçãªã³ã³ãã³ãã§ãããã¦ãã¼ã¯èå¥åã¯æã¡ã¾ããã- ããããªã¼ã®ã¢ã¤ã³ã³ã¯ã¦ãã¼ã¯èå¥åã¯æã¡ã¾ããã
ãã®ãããªå ´åãã»ã¬ã¯ã¿ã¼ããã¯ãã¼ã ã以ä¸ã®ããã«å®ç¾©ã§ãã¾ãã
"[ããããªã¼]": "", "{ããããªã¼}": "[ããããªã¼]:label", "[ããããªã¼ã¢ã¤ã³ã³]": "[ããããªã¼]:leftImage",
:label
ã¯ã¦ã£ã¸ã§ããããã¼ã«ããã次ã®è¦ç´ ãåå¾ããç¸å¯¾ã»ã¬ã¯ã¿ã¼ã§ããRelative selector(Widget flow based)
:leftImage
ã¯å·¦ã«åå¨ããç»åãé¸æããç¸å¯¾ã»ã¬ã¯ã¿ã¼ã§ããRelative selector(Direction based).
[ã·ã¹ãã ç»é¢].json
{ "key": "[ã·ã¹ãã ç»é¢]", "include": [ ], "identity": "[â][ã·ã¹ãã ]", "selectors": { "[â]": "@ä¸ã¸ç§»å", "[ã·ã¹ãã ]": "@ã·ã¹ãã ", "[è¨èªã¨å ¥å]": "", "{è¨èªã¨å ¥å}": "[è¨èªã¨å ¥å]:belowLabel", "[ã¸ã§ã¹ãã£ã¼]": "", "[æ¥ä»ã¨æå»]": "", "{æ¥ä»ã¨æå»}": "[æ¥ä»ã¨æå»]:belowLabel", "[ããã¯ã¢ãã]": "", "[ã·ã¹ãã ã¢ãããã¼ã]": "", "{ã·ã¹ãã ã¢ãããã¼ã}": "[ã·ã¹ãã ã¢ãããã¼ã]:belowLabel", "[ã«ã¼ã«]": "", "{ã«ã¼ã«}": "[ã«ã¼ã«]:belowLabel", "[è¤æ°ã¦ã¼ã¶ã¼]": "", "{è¤æ°ã¦ã¼ã¶ã¼}": "[è¤æ°ã¦ã¼ã¶ã¼]:belowLabel", "[éçºè åããªãã·ã§ã³]": "", "{éçºè åããªãã·ã§ã³}": "[éçºè åããªãã·ã§ã³]:belowLabel", "[ãªã»ãã ãªãã·ã§ã³]": "" } }
[è¨èªã¨å ¥åç»é¢].json
{ "key": "[è¨èªã¨å ¥åç»é¢]", "include": [ ], "identity": "[â][è¨èªã¨å ¥å]", "selectors": { "[â]": "@ä¸ã¸ç§»å", "[è¨èªã¨å ¥å]": "@è¨èªã¨å ¥å", "[è¨èª]": "", "{è¨èª}": "[è¨èª]:belowLabel", "[è¨èªã¢ã¤ã³ã³]": "[è¨èª]:leftImage", "[ãã¼ãã¼ã]": "", "[ç»é¢ãã¼ãã¼ã]": "", "{ç»é¢ãã¼ãã¼ã}": "[ç»é¢ãã¼ãã¼ã]:belowLabel", "[ç©çãã¼ãã¼ã]": "", "{ç©çãã¼ãã¼ã}": "[ç©çãã¼ãã¼ã]:belowLabel", "[ãã¼ã«]": "", "[ã¹ãã«ãã§ãã¯]": "", "{ã¹ãã«ãã§ãã¯}": "[ã¹ãã«ãã§ãã¯]:belowLabel", "[åèªãªã¹ã]": "", "{åèªãªã¹ã}": "[åèªãªã¹ã]:belowLabel", "[ãã¤ã³ã¿ã®é度]": "", "[ããã¹ãèªã¿ä¸ãã®è¨å®]": "" } }
[è¨èªç»é¢].json
{ "key": "[è¨èªç»é¢]", "include": [ ], "identity": "[â][è¨èª]", "selectors": { "[â]": "@ä¸ã¸ç§»å", "[è¨èª]": "@è¨èª", "[è¨èªã追å ]": "" } }
AndroidSettingsTest
以ä¸ã¯ç»é¢ããã¯ãã¼ã ãã¡ã¤ã«ãªãã®å ´åã¨ãç»é¢ããã¯ãã¼ã ãã¡ã¤ã«ããã®å ´åã®Androidã®è¨å®ç»é¢ã®ãã¹ãã³ã¼ãã§ããç»é¢ããã¯ãã¼ã ãã¡ã¤ã«ãªãã®å ´åã®å ´åã¯content-descã®ãããªä½ã¬ãã«ã®èå¥åã使ç¨ããå¿ è¦ãããã¾ããä¸æ¹ãç»é¢ããã¯ãã¼ã ãã¡ã¤ã«ããã®å ´åã¯ãæ½è±¡åº¦ã®é«ãç»é¢ããã¯ãã¼ã /ã»ã¬ã¯ã¿ã¼ããã¯ãã¼ã ã使ç¨ãããã¨ãã§ãã¾ãã
package androidSettings import org.junit.jupiter.api.Order import org.junit.jupiter.api.Test import shirates.core.driver.commandextension.* import shirates.core.testcode.UITest class AndroidSettingsTest : UITest() { @Test @Order(10) fun withoutNickname() { scenario { case(1) { condition { it.tapAppIcon("è¨å®") .existWithScrollDown("ããããªã¼||ã¦ã¼ã¶ã¼è£å©||ãã¹ã¯ã¼ãã¨ã¢ã«ã¦ã³ã||ãã³ãã¨ãµãã¼ã") }.action { it.tapWithScrollDown("ã·ã¹ãã ") }.expectation { it.exist("@ä¸ã¸ç§»å") .exist("@ã·ã¹ãã ") } } case(2) { action { it.tap("è¨èªã¨å ¥å") }.expectation { it.exist("@ä¸ã¸ç§»å") .exist("@è¨èªã¨å ¥å") } } case(3) { action { it.tap("[è¨èª]") }.expectation { it.exist("@ä¸ã¸ç§»å") .exist("@è¨èª") } } } } @Test @Order(20) fun withNickname() { scenario { case(1) { condition { it.tapAppIcon("è¨å®") .screenIs("[Androidè¨å®ãããç»é¢]") }.action { it.tapWithScrollDown("[ã·ã¹ãã ]") }.expectation { it.screenIs("[ã·ã¹ãã ç»é¢]") .exist("[â]") .exist("[ã·ã¹ãã ]") } } case(2) { action { it.tap("[è¨èªã¨å ¥å]") }.expectation { it.screenIs("[è¨èªã¨å ¥åç»é¢]") .exist("[è¨èª]") } } case(3) { action { it.tap("[è¨èª]") }.expectation { it.screenIs("[è¨èªç»é¢]") } } } } }
ãã¹ãçµæ
ç»é¢ããã¯ãã¼ã ãªãã¨ç»é¢ããã¯ãã¼ã ããã®ãã¹ãçµæã確èªãã¦æ¯è¼ãã¦ã¿ã¦ãã ãããç»é¢ããã¯ãã¼ã ããã®æ¹ãç解ãããããã¨ããããã¨æãã¾ãã
_Report(simple).html
[email protected]
ã¾ã¨ã
Shiratesã§ã¯ç»é¢ããã¯ãã¼ã ãJSONãã¡ã¤ã«ã§å®ç¾©ãããã¨ãã§ãã¾ããç»é¢ããã¯ãã¼ã ã¯ãã¹ãã³ã¼ããèªã¿ãããçç£æ§ãé«ããã®ã«ãã¾ãã