@Test // (Test Cases for 1.8) test case 3 public void testDisableCaching() throws Exception { Utility.createProject(Messages.projCache); SWTBotShell propShell = Utility.selCacheUsingCnxtMenu(Messages.projCache, Messages.role1); // check wabot.checkBox().select(); /* * To avoid missing storage account error, * type some value. Requires typeText only. */ wabot.textWithLabel(Messages.keyLbl).typeText("a"); wabot.textWithLabel(Messages.nameLbl).typeText("a"); Utility.selEndPtPage(); Boolean endPtPresent = wabot .table() .cell(1, 0) .equals(String.format("%s%s", Messages.cachEndPtName, Messages.dfltCachName)) && wabot.table().cell(1, 1).equals(Messages.typeIntrnl) && wabot.table().cell(1, 3).equals("11211"); Utility.selLclStrPage(Messages.role1); Boolean LclStrPresent = wabot.table().cell(0, 0).equals(Messages.cachLclStr) && wabot.table().cell(0, 1).equals("20000"); Utility.selCachePage(Messages.role1); // un-check wabot.checkBox().click(); Boolean isDisabled = !wabot.checkBox().isChecked() && !wabot.label(Messages.cachScaleLbl).isEnabled() && !wabot.label(Messages.hostLbl).isEnabled() && !wabot.button(Messages.roleAddBtn).isEnabled() && !wabot.button(Messages.roleEditBtn).isEnabled() && !wabot.label(Messages.keyLbl).isEnabled() && !wabot.label(Messages.nameLbl).isEnabled() && !wabot.table().isEnabled() && !wabot.textWithLabel(Messages.cachScaleLbl).isEnabled() && !wabot.scale().isEnabled(); // Once caching disabled, no storage account warning Utility.selEndPtPage(); Boolean endPtRmv = !wabot .table() .containsItem(String.format("%s%s", Messages.cachEndPtName, Messages.dfltCachName)); propShell = Utility.selLclStrPage(Messages.role1); Boolean lclStrRmv = !wabot.table().containsItem(Messages.cachLclStr); assertTrue( "testDisableCaching", endPtPresent && LclStrPresent && isDisabled && endPtRmv && lclStrRmv); propShell.close(); }
@Test // (Test Cases for 1.8) test case 2 public void testEnableCaching() throws Exception { Utility.createProject(Messages.projCache); SWTBotShell propShell = Utility.selCacheUsingCnxtMenu(Messages.projCache, Messages.role1); wabot.checkBox().select(); Boolean isEnabled = wabot.checkBox().isChecked() && wabot.label(Messages.cachScaleLbl).isEnabled() && wabot.label(Messages.hostLbl).isEnabled() && wabot.button(Messages.roleAddBtn).isEnabled() && !wabot.button(Messages.roleEditBtn).isEnabled() && wabot.label(Messages.keyLbl).isEnabled() && wabot.label(Messages.nameLbl).isEnabled() && wabot.table().isEnabled(); Boolean cacheSizeVal = wabot.textWithLabel(Messages.cachScaleLbl).getText().equals(Messages.dfltSizeVal) && (wabot.scale().getValue() == 30); Boolean dfltCacheVal = wabot.table().containsItem(Messages.dfltCachName) && wabot.table().cell(0, 1).equals(Messages.cachBckNo) && wabot.table().cell(0, 2).equals(Messages.expPolAbs) && wabot.table().cell(0, 3).equals("10") && wabot.table().cell(0, 4).equals("11211"); Boolean hostNmVal = wabot .textWithLabel(Messages.hostLbl) .getText() .equals(String.format("%s%s", Messages.hostNm, Messages.role1.toLowerCase())); Boolean StorageVal = wabot.textWithLabel(Messages.keyLbl).getText().equals("") && wabot.textWithLabel(Messages.nameLbl).getText().equals(""); /* * To avoid missing storage account error, * set some value */ wabot.textWithLabel(Messages.keyLbl).setText("a"); wabot.textWithLabel(Messages.nameLbl).setText("a"); Utility.selEndPtPage(); Boolean endPtPresent = wabot .table() .cell(1, 0) .equals(String.format("%s%s", Messages.cachEndPtName, Messages.dfltCachName)) && wabot.table().cell(1, 1).equals(Messages.typeIntrnl) && wabot.table().cell(1, 3).equals("11211"); propShell = Utility.selLclStrPage(Messages.role1); Boolean LclStrPresent = wabot.table().cell(0, 0).equals(Messages.cachLclStr) && wabot.table().cell(0, 1).equals("20000"); assertTrue( "testEnableCaching", isEnabled && cacheSizeVal && dfltCacheVal && hostNmVal && StorageVal && endPtPresent && LclStrPresent); propShell.close(); }