Shiratesã使ã£ã¦ã¿ãã - ç»é¢ããã¯ãã¼ã -
Shiratesã®ç»é¢ããã¯ãã¼ã ãç´¹ä»ãã¾ãã
ãã¡ãã®è¨äºã®ç¿»è¨³ã§ãã dev.to
ç»é¢ããã¯ãã¼ã (Screen Nickname)
Shiratesã§ã¯ç»é¢ããã¯ãã¼ã ãJSONãã¡ã¤ã«ã§å®ç¾©ãããã¨ãã§ãã¾ããç»é¢ããã¯ãã¼ã ã¯ãã¹ãã³ã¼ããèªã¿ãããçç£æ§ãé«ããã®ã«ãã¾ãã
ç»é¢ããã¯ãã¼ã ã®æ©è½
- ç¾å¨è¡¨ç¤ºããã¦ããç»é¢ãèå¥ãã¾ã
- ç»é¢ã§ä½¿ç¨ã§ããã»ã¬ã¯ã¿ã¼ããã¯ãã¼ã ãå®ç¾©ãã¾ã
ãµã³ãã«ã³ã¼ãã®å ¥æ
æ¬è¨äºã§èª¬æãããµã³ãã«ã³ã¼ãã®å®æçã¯ãã¡ãããå ¥æãã¦ãã ããã https://github.com/wave1008/shirates-samples-nicknames
Example 1: é»å
- Androidã¨ãã¥ã¬ã¼ã¿ã¼ãèµ·åãã¾ã
- é»åã¢ããªãèµ·åãã¾ã
- Appium Inspectorãèµ·åãã¾ã
- Calculatorã¢ããªããã£ããã£ãã¾ã
[é»åã¡ã¤ã³ç»é¢].json
ãtestConfig/screens/calculator
ãã£ã¬ã¯ããªã®ä¸ã«ä½æãã¾ã
- Appium Inspectorã使ç¨ãã¦ç»é¢ã®è¦ç´ ã調æ»ããç»é¢ããã¯ãã¼ã ãã¡ã¤ã«ã以ä¸ã®ããã«ç·¨éãã¾ã
[é»åã¡ã¤ã³ç»é¢].json
{ "key": "[é»åã¡ã¤ã³ç»é¢]", "identity": "[AC][()]", "selectors": { "[è¨ç®å¼]": "#formula", "[è¨ç®çµæ]": "#result_final", "[è¨ç®çµæãã¬ãã¥ã¼]": "#result_preview", "[â]": "#op_sqrt", "[Ï]": "#const_pi", "[^]": "#op_pow", "[!]": "#op_fact", "[AC]": "#clr", "[()]": "#parens", "[%]": "#op_pct", "[÷]": "#op_div", "[Ã]": "#op_mul", "[-]": "#op_sub", "[+]": "#op_add", "[=]": "#eq", "[â«]": "#del", "[0]": "#digit_0", "[1]": "#digit_1", "[2]": "#digit_2", "[3]": "#digit_3", "[4]": "#digit_4", "[5]": "#digit_5", "[6]": "#digit_6", "[7]": "#digit_7", "[8]": "#digit_8", "[9]": "#digit_9", "[.]": "#dec_point" } }
ãã¹ãå®è¡æã«"[AC][()]"
ã®èå¥åã«ãã£ã¦[é»åã¡ã¤ã³ç»é¢]
ãèå¥ã§ããããã«æãã¾ãã
ä¾ãã°ãç¾å¨è¡¨ç¤ºä¸ã®ç»é¢ã[é»åã¡ã¤ã³ç»é¢]
ã§ãããã¨ã以ä¸ã®ããã«æ¤è¨¼ãããã¨ãã§ãã¾ãã
it.screenIs("[é»åã¡ã¤ã³ç»é¢]")
CalculatorTest
以ä¸ã¯ç»é¢ããã¯ãã¼ã ãªãã®å ´åã¨ããã®å ´åã®é»åã®ãã¹ãã³ã¼ãã§ããç»é¢ããã¯ãã¼ã ãªãã®å ´åãresource-idã®ãããªä½ã¬ãã«ã®èå¥åã使ç¨ããå¿ è¦ãããã¾ããä¸æ¹ãç»é¢ããã¯ãã¼ã ããã®å ´åãæ½è±¡åãããç»é¢ããã¯ãã¼ã ãã»ã¬ã¯ã¿ã¼ããã¯ãã¼ã ã使ç¨ãããã¨ãã§ãã¾ãã
package calculator import org.junit.jupiter.api.Order import org.junit.jupiter.api.Test import shirates.core.driver.commandextension.* import shirates.core.testcode.UITest class CalculatorTest : UITest() { @Test @Order(10) fun withoutNickname() { scenario { case(1) { condition { it.tapAppIcon("é»å") }.expectation { it.exist("#clr") it.exist("#parens") } } case(2) { action { it.tap("#clr") }.expectation { it.select("#formula") .textIsEmpty() it.select("#result_preview") .textIsEmpty() } } case(3) { action { it.tap("#digit_1") }.expectation { it.select("#formula") .textIs("1") it.select("#result_preview") .textIsEmpty() } } case(4) { action { it.tap("#op_add") }.expectation { it.select("#formula") .textIs("1+") it.select("#result_preview") .textIsEmpty() } } case(5) { action { it.tap("#digit_2") }.expectation { it.select("#formula") .textIs("1+2") it.select("#result_preview") .textIs("3") } } case(6) { action { it.tap("#eq") }.expectation { it.select("#result_final") .textIs("3") } } } } @Test @Order(20) fun withNickname() { scenario { case(1) { condition { it.tapAppIcon("é»å") }.expectation { it.screenIs("[é»åã¡ã¤ã³ç»é¢]") } } case(2) { action { it.tap("[AC]") }.expectation { it.select("[è¨ç®å¼]") .textIsEmpty() it.select("[è¨ç®çµæãã¬ãã¥ã¼]") .textIsEmpty() } } case(3) { action { it.tap("[1]") }.expectation { it.select("[è¨ç®å¼]") .textIs("1") it.select("[è¨ç®çµæãã¬ãã¥ã¼]") .textIsEmpty() } } case(4) { action { it.tap("[+]") }.expectation { it.select("[è¨ç®å¼]") .textIs("1+") it.select("[è¨ç®çµæãã¬ãã¥ã¼]") .textIsEmpty() } } case(5) { action { it.tap("[2]") }.expectation { it.select("[è¨ç®å¼]") .textIs("1+2") it.select("[è¨ç®çµæãã¬ãã¥ã¼]") .textIs("3") } } case(6) { action { it.tap("[=]") }.expectation { it.select("[è¨ç®çµæ]") .textIs("3") } } } } }
ãã¹ãçµæ
ç»é¢ããã¯ãã¼ã ãªãã¨ç»é¢ããã¯ãã¼ã ããã®ãã¹ãçµæã確èªãã¦æ¯è¼ãã¦ã¿ã¦ãã ãããç»é¢ããã¯ãã¼ã ããã®æ¹ãç解ãããããã¨ããããã¨æãã¾ãã
_Report(simple).html
[email protected]
ã¾ã¨ã
Shiratesã§ã¯ç»é¢ããã¯ãã¼ã ãJSONãã¡ã¤ã«ã§å®ç¾©ãããã¨ãã§ãã¾ããç»é¢ããã¯ãã¼ã ã¯ãã¹ãã³ã¼ããèªã¿ãããçç£æ§ãé«ããã®ã«ãã¾ãã