committed by
GitHub
60 changed files with 2835 additions and 212 deletions
@ -0,0 +1,177 @@ |
|||
/** |
|||
* Copyright © 2016-2022 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.msa.ui.pages; |
|||
|
|||
import org.openqa.selenium.WebDriver; |
|||
import org.openqa.selenium.WebElement; |
|||
|
|||
import java.util.List; |
|||
|
|||
public class ProfilesPageElements extends OtherPageElementsHelper { |
|||
public ProfilesPageElements(WebDriver driver) { |
|||
super(driver); |
|||
} |
|||
|
|||
private static final String CREATE_DEVICE_PROFILE_BTN = "//span[text()='Create new device profile']"; |
|||
private static final String CREATE_ASSET_PROFILE_BTN = "//span[text()='Create new asset profile']"; |
|||
private static final String IMPORT_DEVICE_PROFILE_BTN = "//span[text()='Import device profile']"; |
|||
private static final String IMPORT_ASSET_PROFILE_BTN = "//span[text()='Import asset profile']"; |
|||
private static final String ADD_DEVICE_PROFILE_VIEW = "//tb-add-device-profile-dialog"; |
|||
private static final String ADD_ASSET_PROFILE_VIEW = "//tb-add-entity-dialog"; |
|||
private static final String DEVICE_PROFILE_VIEW = "//tb-entity-details-panel"; |
|||
private static final String NAME_FIELD = "//input[@formcontrolname='name']"; |
|||
private static final String RULE_CHAIN_FIELD = "//input[@formcontrolname='ruleChainId']"; |
|||
private static final String DASHBOARD_FIELD = "//input[@formcontrolname='dashboard']"; |
|||
private static final String QUEUE_FIELD = "//input[@formcontrolname='queueName']"; |
|||
private static final String DESCRIPTION_FIELD = "//textarea[@formcontrolname='description']"; |
|||
private static final String ADD_DEVICE_PROFILE_ADD_BTN = "//span[text()='Add']"; |
|||
private static final String ADD_ASSET_PROFILE_ADD_BTN = "//button[@type='submit']"; |
|||
private static final String DEVICE_PROFILE_VIEW_DELETE_BTN = "//tb-device-profile//span[contains(text(),'Delete')]"; |
|||
private static final String ASSET_PROFILE_VIEW_DELETE_BTN = "//tb-entity-details-panel//span[contains(text(),'Delete')]"; |
|||
private static final String PROFILE_NAMES = "//tbody/mat-row/mat-cell[contains(@class,'name')]"; |
|||
private static final String MAKE_DEFAULT_BTN = ENTITY + "/../..//mat-icon[contains(text(),' flag')]/../.."; |
|||
private static final String DEFAULT = ENTITY + "/../..//mat-icon[text() = 'check_box']"; |
|||
private static final String DEVICE_PROFILE_VIEW_MAKE_DEFAULT_BTN = "//span[text() = ' Make device profile default ']/.."; |
|||
private static final String ASSET_PROFILE_VIEW_MAKE_DEFAULT_BTN = "//span[text() = ' Make asset profile default ']/.."; |
|||
|
|||
protected String getDeviseProfileViewDeleteBtn() { |
|||
return DEVICE_PROFILE_VIEW_DELETE_BTN; |
|||
} |
|||
|
|||
protected String getAssetProfileViewDeleteBtn() { |
|||
return ASSET_PROFILE_VIEW_DELETE_BTN; |
|||
} |
|||
|
|||
public WebElement createNewDeviceProfileBtn() { |
|||
return waitUntilElementToBeClickable(CREATE_DEVICE_PROFILE_BTN); |
|||
} |
|||
|
|||
public WebElement createNewAssetProfileBtn() { |
|||
return waitUntilElementToBeClickable(CREATE_ASSET_PROFILE_BTN); |
|||
} |
|||
|
|||
public WebElement importDeviceProfileBtn() { |
|||
return waitUntilElementToBeClickable(IMPORT_DEVICE_PROFILE_BTN); |
|||
} |
|||
|
|||
public WebElement importAssetProfileBtn() { |
|||
return waitUntilElementToBeClickable(IMPORT_ASSET_PROFILE_BTN); |
|||
} |
|||
|
|||
public WebElement addDeviceProfileView() { |
|||
return waitUntilElementToBeClickable(ADD_DEVICE_PROFILE_VIEW); |
|||
} |
|||
|
|||
public WebElement addAssetProfileView() { |
|||
return waitUntilElementToBeClickable(ADD_ASSET_PROFILE_VIEW); |
|||
} |
|||
|
|||
public WebElement addDeviceProfileNameField() { |
|||
return waitUntilElementToBeClickable(ADD_DEVICE_PROFILE_VIEW + NAME_FIELD); |
|||
} |
|||
|
|||
public WebElement addAssetProfileNameField() { |
|||
return waitUntilElementToBeClickable(ADD_ASSET_PROFILE_VIEW + NAME_FIELD); |
|||
} |
|||
|
|||
public WebElement profileViewNameField() { |
|||
return waitUntilVisibilityOfElementLocated(DEVICE_PROFILE_VIEW + NAME_FIELD); |
|||
} |
|||
|
|||
public WebElement addDeviceProfileRuleChainField() { |
|||
return waitUntilElementToBeClickable(ADD_DEVICE_PROFILE_VIEW + RULE_CHAIN_FIELD); |
|||
} |
|||
|
|||
public WebElement addAssetProfileRuleChainField() { |
|||
return waitUntilElementToBeClickable(ADD_ASSET_PROFILE_VIEW + RULE_CHAIN_FIELD); |
|||
} |
|||
|
|||
public WebElement profileViewRuleChainField() { |
|||
return waitUntilVisibilityOfElementLocated(DEVICE_PROFILE_VIEW + RULE_CHAIN_FIELD); |
|||
} |
|||
|
|||
public WebElement addDeviceProfileMobileDashboardField() { |
|||
return waitUntilElementToBeClickable(ADD_DEVICE_PROFILE_VIEW + DASHBOARD_FIELD); |
|||
} |
|||
|
|||
public WebElement addAssetProfileMobileDashboardField() { |
|||
return waitUntilElementToBeClickable(ADD_ASSET_PROFILE_VIEW + DASHBOARD_FIELD); |
|||
} |
|||
|
|||
public WebElement profileViewMobileDashboardField() { |
|||
return waitUntilVisibilityOfElementLocated(DEVICE_PROFILE_VIEW + DASHBOARD_FIELD); |
|||
} |
|||
|
|||
public WebElement addDeviceProfileQueueField() { |
|||
return waitUntilElementToBeClickable(ADD_DEVICE_PROFILE_VIEW + QUEUE_FIELD); |
|||
} |
|||
|
|||
public WebElement addAssetProfileQueueField() { |
|||
return waitUntilElementToBeClickable(ADD_ASSET_PROFILE_VIEW + QUEUE_FIELD); |
|||
} |
|||
|
|||
public WebElement profileViewQueueField() { |
|||
return waitUntilVisibilityOfElementLocated(DEVICE_PROFILE_VIEW + QUEUE_FIELD); |
|||
} |
|||
|
|||
public WebElement addDeviceDescriptionField() { |
|||
return waitUntilElementToBeClickable(ADD_DEVICE_PROFILE_VIEW + DESCRIPTION_FIELD); |
|||
} |
|||
|
|||
public WebElement addAssetDescriptionField() { |
|||
return waitUntilElementToBeClickable(ADD_ASSET_PROFILE_VIEW + DESCRIPTION_FIELD); |
|||
} |
|||
|
|||
public WebElement profileViewDescriptionField() { |
|||
return waitUntilVisibilityOfElementLocated(DEVICE_PROFILE_VIEW + DESCRIPTION_FIELD); |
|||
} |
|||
|
|||
public WebElement addDeviceProfileAddBtn() { |
|||
return waitUntilElementToBeClickable(ADD_DEVICE_PROFILE_ADD_BTN); |
|||
} |
|||
|
|||
public WebElement addAssetProfileAddBtn() { |
|||
return waitUntilElementToBeClickable(ADD_ASSET_PROFILE_ADD_BTN); |
|||
} |
|||
|
|||
public WebElement deviceProfileViewDeleteBtn() { |
|||
return waitUntilElementToBeClickable(DEVICE_PROFILE_VIEW_DELETE_BTN); |
|||
} |
|||
|
|||
public WebElement assetProfileViewDeleteBtn() { |
|||
return waitUntilElementToBeClickable(ASSET_PROFILE_VIEW_DELETE_BTN); |
|||
} |
|||
|
|||
public List<WebElement> profileNames() { |
|||
return waitUntilElementsToBeClickable(PROFILE_NAMES); |
|||
} |
|||
|
|||
public WebElement makeProfileDefaultBtn(String profileName) { |
|||
return waitUntilElementToBeClickable(String.format(MAKE_DEFAULT_BTN, profileName)); |
|||
} |
|||
|
|||
public WebElement defaultCheckbox(String profileName) { |
|||
return waitUntilElementToBeClickable(String.format(DEFAULT, profileName)); |
|||
} |
|||
|
|||
public WebElement deviceProfileViewMakeDefaultBtn() { |
|||
return waitUntilElementToBeClickable(DEVICE_PROFILE_VIEW_MAKE_DEFAULT_BTN); |
|||
} |
|||
|
|||
public WebElement assetProfileViewMakeDefaultBtn() { |
|||
return waitUntilElementToBeClickable(ASSET_PROFILE_VIEW_MAKE_DEFAULT_BTN); |
|||
} |
|||
} |
|||
@ -0,0 +1,181 @@ |
|||
/** |
|||
* Copyright © 2016-2022 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.msa.ui.pages; |
|||
|
|||
import org.openqa.selenium.By; |
|||
import org.openqa.selenium.WebDriver; |
|||
import org.openqa.selenium.support.ui.ExpectedConditions; |
|||
|
|||
public class ProfilesPageHelper extends ProfilesPageElements { |
|||
public ProfilesPageHelper(WebDriver driver) { |
|||
super(driver); |
|||
} |
|||
|
|||
private String name; |
|||
private String ruleChain; |
|||
private String mobileDashboard; |
|||
private String queue; |
|||
private String description; |
|||
private String profile; |
|||
|
|||
public void setName() { |
|||
this.name = profileViewNameField().getAttribute("value"); |
|||
} |
|||
|
|||
public void setRuleChain() { |
|||
this.ruleChain = profileViewRuleChainField().getAttribute("value"); |
|||
} |
|||
|
|||
public void setMobileDashboard() { |
|||
this.mobileDashboard = profileViewMobileDashboardField().getAttribute("value"); |
|||
} |
|||
|
|||
public void setQueue() { |
|||
this.queue = profileViewQueueField().getAttribute("value"); |
|||
} |
|||
|
|||
public void setDescription() { |
|||
scrollToElement(profileViewDescriptionField()); |
|||
this.description = profileViewDescriptionField().getAttribute("value"); |
|||
} |
|||
|
|||
public void setProfileName() { |
|||
this.profile = profileNames().get(0).getText(); |
|||
} |
|||
|
|||
public void setProfileName(int number) { |
|||
this.profile = profileNames().get(number).getText(); |
|||
} |
|||
|
|||
public String getName() { |
|||
return this.name; |
|||
} |
|||
|
|||
public String getRuleChain() { |
|||
return this.ruleChain; |
|||
} |
|||
|
|||
public String getMobileDashboard() { |
|||
return this.mobileDashboard; |
|||
} |
|||
|
|||
public String getQueue() { |
|||
return this.queue; |
|||
} |
|||
|
|||
public String getDescription() { |
|||
return this.description; |
|||
} |
|||
|
|||
public String getProfileName() { |
|||
return this.profile; |
|||
} |
|||
|
|||
public void createDeviceProfileEnterName(CharSequence keysToEnter) { |
|||
enterText(addDeviceProfileNameField(), keysToEnter); |
|||
} |
|||
|
|||
public void addDeviceProfileViewChooseRuleChain(String ruleChain) { |
|||
addDeviceProfileRuleChainField().click(); |
|||
entityFromList(ruleChain).click(); |
|||
} |
|||
|
|||
public void addAssetProfileViewChooseRuleChain(String ruleChain) { |
|||
addAssetProfileRuleChainField().click(); |
|||
entityFromList(ruleChain).click(); |
|||
} |
|||
|
|||
public void addDeviceProfileViewChooseMobileDashboard(String mobileDashboard) { |
|||
addDeviceProfileMobileDashboardField().click(); |
|||
entityFromList(mobileDashboard).click(); |
|||
} |
|||
|
|||
public void addAssetProfileViewChooseMobileDashboard(String mobileDashboard) { |
|||
addAssetProfileMobileDashboardField().click(); |
|||
entityFromList(mobileDashboard).click(); |
|||
} |
|||
|
|||
public void addDeviceProfileViewChooseQueue(String queue) { |
|||
addDeviceProfileQueueField().click(); |
|||
entityFromList(queue).click(); |
|||
waitUntilAttributeContains(addDeviceProfileQueueField(), "aria-expanded", "false"); |
|||
} |
|||
|
|||
public void addAssetsProfileViewChooseQueue(String queue) { |
|||
addAssetProfileQueueField().click(); |
|||
entityFromList(queue).click(); |
|||
waitUntilAttributeContains(addAssetProfileQueueField(), "aria-expanded", "false"); |
|||
} |
|||
|
|||
public void addDeviceProfileViewEnterDescription(String description) { |
|||
addDeviceDescriptionField().sendKeys(description); |
|||
} |
|||
|
|||
public void addAssetProfileViewEnterDescription(String description) { |
|||
addAssetDescriptionField().sendKeys(description); |
|||
} |
|||
|
|||
public void openCreateDeviceProfileView() { |
|||
plusBtn().click(); |
|||
createNewDeviceProfileBtn().click(); |
|||
} |
|||
|
|||
public void openCreateAssetProfileView() { |
|||
plusBtn().click(); |
|||
createNewAssetProfileBtn().click(); |
|||
} |
|||
|
|||
public void addAssetProfileViewEnterName(String name) { |
|||
addAssetProfileNameField().click(); |
|||
addAssetProfileNameField().sendKeys(name); |
|||
} |
|||
|
|||
public void openImportDeviceProfileView() { |
|||
plusBtn().click(); |
|||
importDeviceProfileBtn().click(); |
|||
} |
|||
|
|||
public void openImportAssetProfileView() { |
|||
plusBtn().click(); |
|||
importAssetProfileBtn().click(); |
|||
} |
|||
|
|||
public boolean deleteDeviceProfileFromViewBtnIsNotDisplayed() { |
|||
return wait.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath(getDeviseProfileViewDeleteBtn()))); |
|||
} |
|||
|
|||
public boolean deleteAssetProfileFromViewBtnIsNotDisplayed() { |
|||
return wait.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath(getAssetProfileViewDeleteBtn()))); |
|||
} |
|||
|
|||
public void goToProfileHelpPage() { |
|||
jsClick(helpBtn()); |
|||
goToNextTab(2); |
|||
} |
|||
|
|||
public void sortByNameDown() { |
|||
doubleClick(sortByNameBtn()); |
|||
} |
|||
|
|||
public boolean profileIsNotPresent(String name) { |
|||
return elementsIsNotPresent(getEntity(name)); |
|||
} |
|||
|
|||
public boolean checkBoxIsDisplayed(String name) { |
|||
return waitUntilPresenceOfElementLocated(getCheckbox(name)).isDisplayed(); |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,34 @@ |
|||
/** |
|||
* Copyright © 2016-2022 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.msa.ui.pages; |
|||
|
|||
import org.openqa.selenium.WebDriver; |
|||
|
|||
public class SideBarMenuViewHelper extends SideBarMenuViewElements { |
|||
public SideBarMenuViewHelper(WebDriver driver) { |
|||
super(driver); |
|||
} |
|||
|
|||
public void openDeviceProfiles() { |
|||
profilesBtn().click(); |
|||
deviceProfileBtn().click(); |
|||
} |
|||
|
|||
public void openAssetProfiles() { |
|||
profilesBtn().click(); |
|||
assetProfileBtn().click(); |
|||
} |
|||
} |
|||
@ -0,0 +1,129 @@ |
|||
/** |
|||
* Copyright © 2016-2022 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.msa.ui.tests.assetProfileSmoke; |
|||
|
|||
import io.qameta.allure.Description; |
|||
import org.openqa.selenium.Keys; |
|||
import org.testng.Assert; |
|||
import org.testng.annotations.AfterMethod; |
|||
import org.testng.annotations.BeforeMethod; |
|||
import org.testng.annotations.Test; |
|||
import org.thingsboard.server.msa.ui.base.AbstractDriverBaseTest; |
|||
import org.thingsboard.server.msa.ui.pages.LoginPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.ProfilesPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewHelper; |
|||
import org.thingsboard.server.msa.ui.utils.DataProviderCredential; |
|||
import org.thingsboard.server.msa.ui.utils.EntityPrototypes; |
|||
|
|||
import static org.thingsboard.server.msa.ui.base.AbstractBasePage.getRandomNumber; |
|||
import static org.thingsboard.server.msa.ui.base.AbstractBasePage.random; |
|||
import static org.thingsboard.server.msa.ui.utils.Const.EMPTY_ASSET_PROFILE_MESSAGE; |
|||
import static org.thingsboard.server.msa.ui.utils.Const.ENTITY_NAME; |
|||
|
|||
public class AssetProfileEditMenuTest extends AbstractDriverBaseTest { |
|||
|
|||
private SideBarMenuViewHelper sideBarMenuView; |
|||
private ProfilesPageHelper profilesPage; |
|||
private String name; |
|||
|
|||
@BeforeMethod |
|||
public void login() { |
|||
new LoginPageHelper(driver).authorizationTenant(); |
|||
sideBarMenuView = new SideBarMenuViewHelper(driver); |
|||
profilesPage = new ProfilesPageHelper(driver); |
|||
} |
|||
|
|||
@AfterMethod |
|||
public void delete() { |
|||
if (name != null) { |
|||
testRestClient.deleteAssetProfile(getAssetProfileByName(name).getId()); |
|||
name = null; |
|||
} |
|||
} |
|||
|
|||
@Test(priority = 10, groups = "smoke") |
|||
@Description |
|||
public void changeName() { |
|||
String name = ENTITY_NAME + random(); |
|||
String newName = "Changed" + getRandomNumber(); |
|||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name)); |
|||
this.name = name; |
|||
|
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.entity(name).click(); |
|||
profilesPage.setHeaderName(); |
|||
String nameBefore = profilesPage.getHeaderName(); |
|||
jsClick(profilesPage.editPencilBtn()); |
|||
profilesPage.changeNameEditMenu(newName); |
|||
profilesPage.doneBtnEditView().click(); |
|||
this.name = newName; |
|||
profilesPage.setHeaderName(); |
|||
String nameAfter = profilesPage.getHeaderName(); |
|||
|
|||
Assert.assertNotEquals(nameBefore, nameAfter); |
|||
Assert.assertEquals(nameAfter, newName); |
|||
} |
|||
|
|||
@Test(priority = 10, groups = "smoke") |
|||
@Description |
|||
public void deleteName() { |
|||
String name = ENTITY_NAME + random(); |
|||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name)); |
|||
this.name = name; |
|||
|
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.entity(name).click(); |
|||
jsClick(profilesPage.editPencilBtn()); |
|||
profilesPage.changeNameEditMenu(""); |
|||
|
|||
Assert.assertFalse(profilesPage.doneBtnEditViewVisible().isEnabled()); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void saveWithOnlySpaceInName() { |
|||
String name = ENTITY_NAME + random(); |
|||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name)); |
|||
this.name = name; |
|||
|
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.entity(name).click(); |
|||
jsClick(profilesPage.editPencilBtn()); |
|||
profilesPage.changeNameEditMenu(Keys.SPACE); |
|||
profilesPage.doneBtnEditView().click(); |
|||
|
|||
Assert.assertNotNull(profilesPage.warningMessage()); |
|||
Assert.assertTrue(profilesPage.warningMessage().isDisplayed()); |
|||
Assert.assertEquals(profilesPage.warningMessage().getText(), EMPTY_ASSET_PROFILE_MESSAGE); |
|||
} |
|||
|
|||
@Test(priority = 30, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "editMenuDescription") |
|||
@Description |
|||
public void editDescription(String description, String newDescription, String finalDescription) { |
|||
String name = ENTITY_NAME + random(); |
|||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name, description)); |
|||
this.name = name; |
|||
|
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.entity(name).click(); |
|||
jsClick(profilesPage.editPencilBtn()); |
|||
profilesPage.profileViewDescriptionField().sendKeys(newDescription); |
|||
profilesPage.doneBtnEditView().click(); |
|||
profilesPage.setDescription(); |
|||
|
|||
Assert.assertEquals(profilesPage.getDescription(), finalDescription); |
|||
} |
|||
} |
|||
@ -0,0 +1,126 @@ |
|||
/** |
|||
* Copyright © 2016-2022 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.msa.ui.tests.assetProfileSmoke; |
|||
|
|||
import io.qameta.allure.Description; |
|||
import org.testng.Assert; |
|||
import org.testng.annotations.AfterMethod; |
|||
import org.testng.annotations.BeforeMethod; |
|||
import org.testng.annotations.Test; |
|||
import org.thingsboard.server.msa.ui.base.AbstractDriverBaseTest; |
|||
import org.thingsboard.server.msa.ui.pages.LoginPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.ProfilesPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewHelper; |
|||
import org.thingsboard.server.msa.ui.utils.EntityPrototypes; |
|||
|
|||
import static org.thingsboard.server.msa.ui.utils.Const.EMPTY_IMPORT_MESSAGE; |
|||
import static org.thingsboard.server.msa.ui.utils.Const.IMPORT_ASSET_PROFILE_FILE_NAME; |
|||
import static org.thingsboard.server.msa.ui.utils.Const.IMPORT_ASSET_PROFILE_NAME; |
|||
import static org.thingsboard.server.msa.ui.utils.Const.IMPORT_TXT_FILE_NAME; |
|||
import static org.thingsboard.server.msa.ui.utils.Const.SAME_NAME_WARNING_ASSET_PROFILE_MESSAGE; |
|||
|
|||
public class CreateAssetProfileImportTest extends AbstractDriverBaseTest { |
|||
|
|||
private SideBarMenuViewHelper sideBarMenuView; |
|||
private ProfilesPageHelper profilesPage; |
|||
private final String absolutePathToFileImportAssetProfile = getClass().getClassLoader().getResource(IMPORT_ASSET_PROFILE_FILE_NAME).getPath(); |
|||
private final String absolutePathToFileImportTxt = getClass().getClassLoader().getResource(IMPORT_TXT_FILE_NAME).getPath(); |
|||
private String name; |
|||
|
|||
@BeforeMethod |
|||
public void login() { |
|||
new LoginPageHelper(driver).authorizationTenant(); |
|||
sideBarMenuView = new SideBarMenuViewHelper(driver); |
|||
profilesPage = new ProfilesPageHelper(driver); |
|||
} |
|||
|
|||
@AfterMethod |
|||
public void delete() { |
|||
if (name != null) { |
|||
testRestClient.deleteAssetProfile(getAssetProfileByName(name).getId()); |
|||
name = null; |
|||
} |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void importAssetProfile() { |
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.openImportAssetProfileView(); |
|||
profilesPage.browseFile().sendKeys(absolutePathToFileImportAssetProfile); |
|||
profilesPage.importBrowseFileBtn().click(); |
|||
name = IMPORT_ASSET_PROFILE_NAME; |
|||
profilesPage.refreshBtn().click(); |
|||
|
|||
Assert.assertNotNull(profilesPage.entity(IMPORT_ASSET_PROFILE_NAME)); |
|||
Assert.assertTrue(profilesPage.entity(IMPORT_ASSET_PROFILE_NAME).isDisplayed()); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void importTxtFile() { |
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.openImportDeviceProfileView(); |
|||
profilesPage.browseFile().sendKeys(absolutePathToFileImportTxt); |
|||
|
|||
Assert.assertNotNull(profilesPage.importingFile(EMPTY_IMPORT_MESSAGE)); |
|||
Assert.assertTrue(profilesPage.importingFile(EMPTY_IMPORT_MESSAGE).isDisplayed()); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void addFileToImportAndRemove() { |
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.openImportAssetProfileView(); |
|||
profilesPage.browseFile().sendKeys(absolutePathToFileImportAssetProfile); |
|||
profilesPage.clearImportFileBtn().click(); |
|||
|
|||
Assert.assertNotNull(profilesPage.importingFile(EMPTY_IMPORT_MESSAGE)); |
|||
Assert.assertTrue(profilesPage.importingFile(EMPTY_IMPORT_MESSAGE).isDisplayed()); |
|||
Assert.assertTrue(profilesPage.entityIsNotPresent(IMPORT_ASSET_PROFILE_NAME)); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void importAssetProfileWithSameName() { |
|||
String name = IMPORT_ASSET_PROFILE_NAME; |
|||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name)); |
|||
this.name = name; |
|||
|
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.openImportAssetProfileView(); |
|||
profilesPage.browseFile().sendKeys(absolutePathToFileImportAssetProfile); |
|||
profilesPage.importBrowseFileBtn().click(); |
|||
profilesPage.refreshBtn().click(); |
|||
|
|||
Assert.assertNotNull(profilesPage.warningMessage()); |
|||
Assert.assertTrue(profilesPage.warningMessage().isDisplayed()); |
|||
Assert.assertEquals(profilesPage.warningMessage().getText(), SAME_NAME_WARNING_ASSET_PROFILE_MESSAGE); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void importAssetProfileWithoutRefresh() { |
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.openImportAssetProfileView(); |
|||
profilesPage.browseFile().sendKeys(absolutePathToFileImportAssetProfile); |
|||
profilesPage.importBrowseFileBtn().click(); |
|||
name = IMPORT_ASSET_PROFILE_NAME; |
|||
|
|||
Assert.assertNotNull(profilesPage.entity(IMPORT_ASSET_PROFILE_NAME)); |
|||
Assert.assertTrue(profilesPage.entity(IMPORT_ASSET_PROFILE_NAME).isDisplayed()); |
|||
} |
|||
} |
|||
@ -0,0 +1,175 @@ |
|||
/** |
|||
* Copyright © 2016-2022 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.msa.ui.tests.assetProfileSmoke; |
|||
|
|||
import io.qameta.allure.Description; |
|||
import org.testng.Assert; |
|||
import org.testng.annotations.AfterMethod; |
|||
import org.testng.annotations.BeforeMethod; |
|||
import org.testng.annotations.Test; |
|||
import org.thingsboard.server.msa.ui.base.AbstractDriverBaseTest; |
|||
import org.thingsboard.server.msa.ui.pages.LoginPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.ProfilesPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewHelper; |
|||
import org.thingsboard.server.msa.ui.utils.EntityPrototypes; |
|||
|
|||
import static org.thingsboard.server.msa.ui.base.AbstractBasePage.random; |
|||
import static org.thingsboard.server.msa.ui.utils.Const.EMPTY_ASSET_PROFILE_MESSAGE; |
|||
import static org.thingsboard.server.msa.ui.utils.Const.ENTITY_NAME; |
|||
import static org.thingsboard.server.msa.ui.utils.Const.SAME_NAME_WARNING_ASSET_PROFILE_MESSAGE; |
|||
|
|||
public class CreateAssetProfileTest extends AbstractDriverBaseTest { |
|||
|
|||
private SideBarMenuViewHelper sideBarMenuView; |
|||
private ProfilesPageHelper profilesPage; |
|||
private String name; |
|||
|
|||
@BeforeMethod |
|||
public void login() { |
|||
new LoginPageHelper(driver).authorizationTenant(); |
|||
sideBarMenuView = new SideBarMenuViewHelper(driver); |
|||
profilesPage = new ProfilesPageHelper(driver); |
|||
} |
|||
|
|||
@AfterMethod |
|||
public void delete() { |
|||
if (name != null) { |
|||
testRestClient.deleteAssetProfile(getAssetProfileByName(name).getId()); |
|||
name = null; |
|||
} |
|||
} |
|||
|
|||
@Test(priority = 10, groups = "smoke") |
|||
@Description |
|||
public void createAssetProfile() { |
|||
String name = ENTITY_NAME + random(); |
|||
|
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.openCreateAssetProfileView(); |
|||
profilesPage.addAssetProfileViewEnterName(name); |
|||
profilesPage.addAssetProfileAddBtn().click(); |
|||
this.name = name; |
|||
profilesPage.refreshBtn().click(); |
|||
|
|||
Assert.assertNotNull(profilesPage.entity(name)); |
|||
Assert.assertTrue(profilesPage.entity(name).isDisplayed()); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void createAssetProfileWithDetails() { |
|||
String name = ENTITY_NAME + random(); |
|||
String ruleChain = "Root Rule Chain"; |
|||
String mobileDashboard = "Firmware"; |
|||
String queue = "Main"; |
|||
String description = "Description"; |
|||
|
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.openCreateAssetProfileView(); |
|||
profilesPage.addAssetProfileViewEnterName(name); |
|||
profilesPage.addAssetProfileViewChooseRuleChain(ruleChain); |
|||
profilesPage.addAssetProfileViewChooseMobileDashboard(mobileDashboard); |
|||
profilesPage.addAssetsProfileViewChooseQueue(queue); |
|||
profilesPage.addAssetProfileViewEnterDescription(description); |
|||
profilesPage.addAssetProfileAddBtn().click(); |
|||
this.name = name; |
|||
profilesPage.refreshBtn().click(); |
|||
profilesPage.entity(name).click(); |
|||
profilesPage.setName(); |
|||
profilesPage.setRuleChain(); |
|||
profilesPage.setMobileDashboard(); |
|||
profilesPage.setQueue(); |
|||
profilesPage.setDescription(); |
|||
|
|||
Assert.assertNotNull(profilesPage.entity(name)); |
|||
Assert.assertTrue(profilesPage.entity(name).isDisplayed()); |
|||
Assert.assertEquals(name, profilesPage.getName()); |
|||
Assert.assertEquals(ruleChain, profilesPage.getRuleChain()); |
|||
Assert.assertEquals(mobileDashboard, profilesPage.getMobileDashboard()); |
|||
Assert.assertEquals(queue, profilesPage.getQueue()); |
|||
Assert.assertEquals(description, profilesPage.getDescription()); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void createAssetProfileWithSameName() { |
|||
String name = ENTITY_NAME + random(); |
|||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name)); |
|||
this.name = name; |
|||
|
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.openCreateAssetProfileView(); |
|||
profilesPage.addAssetProfileViewEnterName(name); |
|||
profilesPage.addAssetProfileAddBtn().click(); |
|||
|
|||
Assert.assertNotNull(profilesPage.warningMessage()); |
|||
Assert.assertTrue(profilesPage.warningMessage().isDisplayed()); |
|||
Assert.assertEquals(profilesPage.warningMessage().getText(), SAME_NAME_WARNING_ASSET_PROFILE_MESSAGE); |
|||
Assert.assertNotNull(profilesPage.addAssetProfileView()); |
|||
Assert.assertTrue(profilesPage.addAssetProfileView().isDisplayed()); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void createAssetProfileWithoutName() { |
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.openCreateAssetProfileView(); |
|||
|
|||
Assert.assertFalse(profilesPage.addBtnV().isEnabled()); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void createAssetProfileWithOnlySpaceInName() { |
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.openCreateAssetProfileView(); |
|||
profilesPage.addAssetProfileViewEnterName(" "); |
|||
profilesPage.addAssetProfileAddBtn().click(); |
|||
|
|||
Assert.assertNotNull(profilesPage.warningMessage()); |
|||
Assert.assertTrue(profilesPage.warningMessage().isDisplayed()); |
|||
Assert.assertEquals(profilesPage.warningMessage().getText(), EMPTY_ASSET_PROFILE_MESSAGE); |
|||
Assert.assertNotNull(profilesPage.addAssetProfileView()); |
|||
Assert.assertTrue(profilesPage.addAssetProfileView().isDisplayed()); |
|||
} |
|||
|
|||
@Test(priority = 30, groups = "smoke") |
|||
@Description |
|||
public void createAssetProfileWithoutRefresh() { |
|||
String name = ENTITY_NAME + random(); |
|||
|
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.openCreateAssetProfileView(); |
|||
profilesPage.addAssetProfileViewEnterName(name); |
|||
profilesPage.addAssetProfileAddBtn().click(); |
|||
this.name = name; |
|||
|
|||
Assert.assertNotNull(profilesPage.entity(name)); |
|||
Assert.assertTrue(profilesPage.entity(name).isDisplayed()); |
|||
} |
|||
|
|||
@Test(priority = 40, groups = "smoke") |
|||
@Description |
|||
public void documentation() { |
|||
String urlPath = "docs/user-guide/asset-profiles/"; |
|||
|
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.allEntity().get(0).click(); |
|||
profilesPage.goToProfileHelpPage(); |
|||
|
|||
Assert.assertTrue(urlContains(urlPath)); |
|||
} |
|||
} |
|||
@ -0,0 +1,125 @@ |
|||
/** |
|||
* Copyright © 2016-2022 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.msa.ui.tests.assetProfileSmoke; |
|||
|
|||
import io.qameta.allure.Description; |
|||
import org.testng.Assert; |
|||
import org.testng.annotations.BeforeMethod; |
|||
import org.testng.annotations.Test; |
|||
import org.thingsboard.server.msa.ui.base.AbstractDriverBaseTest; |
|||
import org.thingsboard.server.msa.ui.pages.LoginPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.ProfilesPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewHelper; |
|||
import org.thingsboard.server.msa.ui.utils.EntityPrototypes; |
|||
|
|||
import static org.thingsboard.server.msa.ui.base.AbstractBasePage.random; |
|||
import static org.thingsboard.server.msa.ui.utils.Const.ENTITY_NAME; |
|||
|
|||
public class DeleteAssetProfileTest extends AbstractDriverBaseTest { |
|||
|
|||
private SideBarMenuViewHelper sideBarMenuView; |
|||
private ProfilesPageHelper profilesPage; |
|||
|
|||
@BeforeMethod |
|||
public void login() { |
|||
new LoginPageHelper(driver).authorizationTenant(); |
|||
sideBarMenuView = new SideBarMenuViewHelper(driver); |
|||
profilesPage = new ProfilesPageHelper(driver); |
|||
} |
|||
|
|||
@Test(priority = 10, groups = "smoke") |
|||
@Description |
|||
public void removeAssetProfile() { |
|||
String name = ENTITY_NAME + random(); |
|||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name)); |
|||
|
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.deleteBtn(name).click(); |
|||
profilesPage.warningPopUpYesBtn().click(); |
|||
profilesPage.refreshBtn(); |
|||
|
|||
Assert.assertTrue(profilesPage.entityIsNotPresent(name)); |
|||
} |
|||
|
|||
@Test(priority = 10, groups = "smoke") |
|||
@Description |
|||
public void removeAssetProfileFromView() { |
|||
String name = ENTITY_NAME + random(); |
|||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name)); |
|||
|
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.entity(name).click(); |
|||
profilesPage.assetProfileViewDeleteBtn().click(); |
|||
profilesPage.warningPopUpYesBtn().click(); |
|||
profilesPage.refreshBtn(); |
|||
|
|||
Assert.assertTrue(profilesPage.entityIsNotPresent(name)); |
|||
} |
|||
|
|||
@Test(priority = 10, groups = "smoke") |
|||
@Description |
|||
public void removeSelectedAssetProfile() { |
|||
String name = ENTITY_NAME + random(); |
|||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name)); |
|||
|
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.checkBox(name).click(); |
|||
profilesPage.deleteSelectedBtn().click(); |
|||
profilesPage.warningPopUpYesBtn().click(); |
|||
profilesPage.refreshBtn(); |
|||
|
|||
Assert.assertTrue(profilesPage.entityIsNotPresent(name)); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void removeDefaultAssetProfile() { |
|||
sideBarMenuView.openAssetProfiles(); |
|||
|
|||
Assert.assertFalse(profilesPage.deleteBtn("default").isEnabled()); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void removeDefaultAssetProfileFromView() { |
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.entity("default").click(); |
|||
|
|||
Assert.assertTrue(profilesPage.deleteAssetProfileFromViewBtnIsNotDisplayed()); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void removeSelectedDefaultAssetProfile() { |
|||
sideBarMenuView.openAssetProfiles(); |
|||
|
|||
Assert.assertNotNull(profilesPage.presentCheckBox("default")); |
|||
Assert.assertFalse(profilesPage.presentCheckBox("default").isDisplayed()); |
|||
} |
|||
|
|||
@Test(priority = 30, groups = "smoke") |
|||
@Description |
|||
public void removeAssetProfileWithoutRefresh() { |
|||
String name = ENTITY_NAME + random(); |
|||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name)); |
|||
|
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.deleteBtn(name).click(); |
|||
profilesPage.warningPopUpYesBtn().click(); |
|||
|
|||
Assert.assertTrue(profilesPage.entityIsNotPresent(name)); |
|||
} |
|||
} |
|||
@ -0,0 +1,104 @@ |
|||
/** |
|||
* Copyright © 2016-2022 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.msa.ui.tests.assetProfileSmoke; |
|||
|
|||
import io.qameta.allure.Description; |
|||
import org.testng.Assert; |
|||
import org.testng.annotations.BeforeMethod; |
|||
import org.testng.annotations.Test; |
|||
import org.thingsboard.server.msa.ui.base.AbstractDriverBaseTest; |
|||
import org.thingsboard.server.msa.ui.pages.LoginPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.ProfilesPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewHelper; |
|||
import org.thingsboard.server.msa.ui.utils.EntityPrototypes; |
|||
|
|||
import static org.thingsboard.server.msa.ui.base.AbstractBasePage.random; |
|||
import static org.thingsboard.server.msa.ui.utils.Const.ENTITY_NAME; |
|||
|
|||
public class DeleteSeveralAssetProfilesTest extends AbstractDriverBaseTest { |
|||
private SideBarMenuViewHelper sideBarMenuView; |
|||
private ProfilesPageHelper profilesPage; |
|||
|
|||
@BeforeMethod |
|||
public void login() { |
|||
new LoginPageHelper(driver).authorizationTenant(); |
|||
sideBarMenuView = new SideBarMenuViewHelper(driver); |
|||
profilesPage = new ProfilesPageHelper(driver); |
|||
} |
|||
|
|||
@Test(priority = 10, groups = "smoke") |
|||
@Description |
|||
public void canDeleteSeveralAssetProfilesByTopBtn() { |
|||
String name1 = ENTITY_NAME + random() + "1"; |
|||
String name2 = ENTITY_NAME + random() + "2"; |
|||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name1)); |
|||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name2)); |
|||
|
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.clickOnCheckBoxes(2); |
|||
profilesPage.deleteSelectedBtn().click(); |
|||
profilesPage.warningPopUpYesBtn().click(); |
|||
profilesPage.refreshBtn().click(); |
|||
|
|||
Assert.assertTrue(profilesPage.profileIsNotPresent(name1)); |
|||
Assert.assertTrue(profilesPage.profileIsNotPresent(name2)); |
|||
} |
|||
|
|||
@Test(priority = 10, groups = "smoke") |
|||
@Description |
|||
public void selectAllDAssetProfiles() { |
|||
String name1 = ENTITY_NAME + random() + "1"; |
|||
String name2 = ENTITY_NAME + random() +"2"; |
|||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name1)); |
|||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name2)); |
|||
|
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.selectAllCheckBox().click(); |
|||
profilesPage.deleteSelectedBtn().click(); |
|||
profilesPage.warningPopUpYesBtn().click(); |
|||
profilesPage.refreshBtn().click(); |
|||
|
|||
Assert.assertTrue(profilesPage.profileIsNotPresent(name1)); |
|||
Assert.assertTrue(profilesPage.profileIsNotPresent(name2)); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void removeDefaultAssetProfile() { |
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.selectAllCheckBox().click(); |
|||
|
|||
Assert.assertFalse(profilesPage.checkBoxIsDisplayed("default")); |
|||
Assert.assertFalse(profilesPage.deleteBtn("default").isEnabled()); |
|||
} |
|||
|
|||
@Test(priority = 30, groups = "smoke") |
|||
@Description |
|||
public void deleteSeveralAssetProfilesByTopBtnWithoutRefresh() { |
|||
String name1 = ENTITY_NAME + random() + "1"; |
|||
String name2 = ENTITY_NAME + random() + "2"; |
|||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name1)); |
|||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name2)); |
|||
|
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.clickOnCheckBoxes(2); |
|||
profilesPage.deleteSelectedBtn().click(); |
|||
profilesPage.warningPopUpYesBtn().click(); |
|||
|
|||
Assert.assertTrue(profilesPage.profileIsNotPresent(name1)); |
|||
Assert.assertTrue(profilesPage.profileIsNotPresent(name2)); |
|||
} |
|||
} |
|||
@ -0,0 +1,79 @@ |
|||
/** |
|||
* Copyright © 2016-2022 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.msa.ui.tests.assetProfileSmoke; |
|||
|
|||
import io.qameta.allure.Description; |
|||
import org.testng.Assert; |
|||
import org.testng.annotations.AfterMethod; |
|||
import org.testng.annotations.BeforeMethod; |
|||
import org.testng.annotations.Test; |
|||
import org.thingsboard.server.msa.ui.base.AbstractDriverBaseTest; |
|||
import org.thingsboard.server.msa.ui.pages.LoginPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.ProfilesPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewHelper; |
|||
import org.thingsboard.server.msa.ui.utils.EntityPrototypes; |
|||
|
|||
import static org.thingsboard.server.msa.ui.base.AbstractBasePage.random; |
|||
import static org.thingsboard.server.msa.ui.utils.Const.ENTITY_NAME; |
|||
|
|||
public class MakeAssetProfileDefaultTest extends AbstractDriverBaseTest { |
|||
private SideBarMenuViewHelper sideBarMenuView; |
|||
private ProfilesPageHelper profilesPage; |
|||
private String name; |
|||
|
|||
@BeforeMethod |
|||
public void login() { |
|||
new LoginPageHelper(driver).authorizationTenant(); |
|||
sideBarMenuView = new SideBarMenuViewHelper(driver); |
|||
profilesPage = new ProfilesPageHelper(driver); |
|||
} |
|||
|
|||
@AfterMethod |
|||
public void makeProfileDefault() { |
|||
testRestClient.setDefaultAssetProfile(getAssetProfileByName("default").getId()); |
|||
testRestClient.deleteAssetProfile(getAssetProfileByName(name).getId()); |
|||
} |
|||
|
|||
@Test(priority = 10, groups = "smoke") |
|||
@Description |
|||
public void makeDeviceProfileDefaultByRightCornerBtn() { |
|||
String name = ENTITY_NAME + random(); |
|||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name)); |
|||
this.name = name; |
|||
|
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.makeProfileDefaultBtn(name).click(); |
|||
profilesPage.warningPopUpYesBtn().click(); |
|||
|
|||
Assert.assertTrue(profilesPage.defaultCheckbox(name).isDisplayed()); |
|||
} |
|||
|
|||
@Test(priority = 10, groups = "smoke") |
|||
@Description |
|||
public void makeDeviceProfileDefaultFromView() { |
|||
String name = ENTITY_NAME + random(); |
|||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name)); |
|||
this.name = name; |
|||
|
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.entity(name).click(); |
|||
profilesPage.assetProfileViewMakeDefaultBtn().click(); |
|||
profilesPage.warningPopUpYesBtn().click(); |
|||
profilesPage.closeEntityViewBtn().click(); |
|||
|
|||
Assert.assertTrue(profilesPage.defaultCheckbox(name).isDisplayed()); |
|||
} |
|||
} |
|||
@ -0,0 +1,62 @@ |
|||
/** |
|||
* Copyright © 2016-2022 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.msa.ui.tests.assetProfileSmoke; |
|||
|
|||
import io.qameta.allure.Description; |
|||
import org.testng.Assert; |
|||
import org.testng.annotations.AfterMethod; |
|||
import org.testng.annotations.BeforeMethod; |
|||
import org.testng.annotations.Test; |
|||
import org.thingsboard.server.msa.ui.base.AbstractDriverBaseTest; |
|||
import org.thingsboard.server.msa.ui.pages.LoginPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.ProfilesPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewHelper; |
|||
import org.thingsboard.server.msa.ui.utils.DataProviderCredential; |
|||
import org.thingsboard.server.msa.ui.utils.EntityPrototypes; |
|||
|
|||
public class SearchAssetProfileTest extends AbstractDriverBaseTest { |
|||
|
|||
private SideBarMenuViewHelper sideBarMenuView; |
|||
private ProfilesPageHelper profilesPage; |
|||
private String name; |
|||
|
|||
@BeforeMethod |
|||
public void login() { |
|||
new LoginPageHelper(driver).authorizationTenant(); |
|||
sideBarMenuView = new SideBarMenuViewHelper(driver); |
|||
profilesPage = new ProfilesPageHelper(driver); |
|||
} |
|||
|
|||
@AfterMethod |
|||
public void delete() { |
|||
if (name != null) { |
|||
testRestClient.deleteAssetProfile(getAssetProfileByName(name).getId()); |
|||
name = null; |
|||
} |
|||
} |
|||
|
|||
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "assetProfileSearch") |
|||
@Description |
|||
public void searchFirstWord(String name, String namePath) { |
|||
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name)); |
|||
this.name = name; |
|||
|
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.searchEntity(namePath); |
|||
|
|||
profilesPage.allEntity().forEach(x -> Assert.assertTrue(x.getText().contains(namePath))); |
|||
} |
|||
} |
|||
@ -0,0 +1,127 @@ |
|||
/** |
|||
* Copyright © 2016-2022 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.msa.ui.tests.assetProfileSmoke; |
|||
|
|||
import io.qameta.allure.Description; |
|||
import org.testng.Assert; |
|||
import org.testng.annotations.AfterMethod; |
|||
import org.testng.annotations.BeforeMethod; |
|||
import org.testng.annotations.Test; |
|||
import org.thingsboard.server.msa.ui.base.AbstractDriverBaseTest; |
|||
import org.thingsboard.server.msa.ui.pages.LoginPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.ProfilesPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewHelper; |
|||
import org.thingsboard.server.msa.ui.utils.DataProviderCredential; |
|||
|
|||
import static org.thingsboard.server.msa.ui.utils.EntityPrototypes.defaultAssetProfile; |
|||
|
|||
public class SortByNameTest extends AbstractDriverBaseTest { |
|||
private SideBarMenuViewHelper sideBarMenuView; |
|||
private ProfilesPageHelper profilesPage; |
|||
private String name; |
|||
|
|||
@BeforeMethod |
|||
public void login() { |
|||
new LoginPageHelper(driver).authorizationTenant(); |
|||
sideBarMenuView = new SideBarMenuViewHelper(driver); |
|||
profilesPage = new ProfilesPageHelper(driver); |
|||
} |
|||
|
|||
@AfterMethod |
|||
public void delete() { |
|||
if (name != null) { |
|||
testRestClient.deleteAssetProfile(getAssetProfileByName(name).getId()); |
|||
name = null; |
|||
} |
|||
} |
|||
|
|||
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSort") |
|||
@Description |
|||
public void specialCharacterUp(String name) { |
|||
testRestClient.postAssetProfile(defaultAssetProfile(name)); |
|||
this.name = name; |
|||
|
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.sortByNameBtn().click(); |
|||
profilesPage.setProfileName(); |
|||
|
|||
Assert.assertEquals(profilesPage.getProfileName(), name); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForAllSort") |
|||
@Description |
|||
public void allSortUp(String assetProfile, String assetProfileSymbol, String assetProfileNumber) { |
|||
testRestClient.postAssetProfile(defaultAssetProfile(assetProfileSymbol)); |
|||
testRestClient.postAssetProfile(defaultAssetProfile(assetProfile)); |
|||
testRestClient.postAssetProfile(defaultAssetProfile(assetProfileNumber)); |
|||
|
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.sortByNameBtn().click(); |
|||
profilesPage.setProfileName(0); |
|||
String firstAssetProfile = profilesPage.getProfileName(); |
|||
profilesPage.setProfileName(1); |
|||
String secondAssetProfile = profilesPage.getProfileName(); |
|||
profilesPage.setProfileName(2); |
|||
String thirdAssetProfile = profilesPage.getProfileName(); |
|||
|
|||
testRestClient.deleteAssetProfile(getAssetProfileByName(assetProfile).getId()); |
|||
testRestClient.deleteAssetProfile(getAssetProfileByName(assetProfileNumber).getId()); |
|||
testRestClient.deleteAssetProfile(getAssetProfileByName(assetProfileSymbol).getId()); |
|||
|
|||
Assert.assertEquals(firstAssetProfile, assetProfileSymbol); |
|||
Assert.assertEquals(secondAssetProfile, assetProfileNumber); |
|||
Assert.assertEquals(thirdAssetProfile, assetProfile); |
|||
} |
|||
|
|||
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSort") |
|||
@Description |
|||
public void specialCharacterDown(String name) { |
|||
testRestClient.postAssetProfile(defaultAssetProfile(name)); |
|||
this.name = name; |
|||
|
|||
sideBarMenuView.openAssetProfiles(); |
|||
profilesPage.sortByNameDown(); |
|||
profilesPage.setProfileName(profilesPage.allEntity().size() - 1); |
|||
|
|||
Assert.assertEquals(profilesPage.getProfileName(), name); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForAllSort") |
|||
@Description |
|||
public void allSortDown(String assetProfile, String assetProfileSymbol, String assetProfileNumber) { |
|||
testRestClient.postAssetProfile(defaultAssetProfile(assetProfileSymbol)); |
|||
testRestClient.postAssetProfile(defaultAssetProfile(assetProfile)); |
|||
testRestClient.postAssetProfile(defaultAssetProfile(assetProfileNumber)); |
|||
|
|||
sideBarMenuView.openAssetProfiles(); |
|||
int lastIndex = profilesPage.allEntity().size() - 1; |
|||
profilesPage.sortByNameDown(); |
|||
profilesPage.setProfileName(lastIndex); |
|||
String firstAssetProfile = profilesPage.getProfileName(); |
|||
profilesPage.setProfileName(lastIndex - 1); |
|||
String secondAssetProfile = profilesPage.getProfileName(); |
|||
profilesPage.setProfileName(lastIndex - 2); |
|||
String thirdAssetProfile = profilesPage.getProfileName(); |
|||
|
|||
testRestClient.deleteAssetProfile(getAssetProfileByName(assetProfile).getId()); |
|||
testRestClient.deleteAssetProfile(getAssetProfileByName(assetProfileNumber).getId()); |
|||
testRestClient.deleteAssetProfile(getAssetProfileByName(assetProfileSymbol).getId()); |
|||
|
|||
Assert.assertEquals(firstAssetProfile, assetProfileSymbol); |
|||
Assert.assertEquals(secondAssetProfile, assetProfileNumber); |
|||
Assert.assertEquals(thirdAssetProfile, assetProfile); |
|||
} |
|||
} |
|||
@ -0,0 +1,126 @@ |
|||
/** |
|||
* Copyright © 2016-2022 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke; |
|||
|
|||
import io.qameta.allure.Description; |
|||
import org.testng.Assert; |
|||
import org.testng.annotations.AfterMethod; |
|||
import org.testng.annotations.BeforeMethod; |
|||
import org.testng.annotations.Test; |
|||
import org.thingsboard.server.msa.ui.base.AbstractDriverBaseTest; |
|||
import org.thingsboard.server.msa.ui.pages.LoginPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.ProfilesPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewHelper; |
|||
import org.thingsboard.server.msa.ui.utils.EntityPrototypes; |
|||
|
|||
import static org.thingsboard.server.msa.ui.utils.Const.EMPTY_IMPORT_MESSAGE; |
|||
import static org.thingsboard.server.msa.ui.utils.Const.IMPORT_DEVICE_PROFILE_FILE_NAME; |
|||
import static org.thingsboard.server.msa.ui.utils.Const.IMPORT_DEVICE_PROFILE_NAME; |
|||
import static org.thingsboard.server.msa.ui.utils.Const.IMPORT_TXT_FILE_NAME; |
|||
import static org.thingsboard.server.msa.ui.utils.Const.SAME_NAME_WARNING_DEVICE_PROFILE_MESSAGE; |
|||
|
|||
public class CreateDeviceProfileImportTest extends AbstractDriverBaseTest { |
|||
|
|||
private SideBarMenuViewHelper sideBarMenuView; |
|||
private ProfilesPageHelper profilesPage; |
|||
private final String absolutePathToFileImportDeviceProfile = getClass().getClassLoader().getResource(IMPORT_DEVICE_PROFILE_FILE_NAME).getPath(); |
|||
private final String absolutePathToFileImportTxt = getClass().getClassLoader().getResource(IMPORT_TXT_FILE_NAME).getPath(); |
|||
private String name; |
|||
|
|||
@BeforeMethod |
|||
public void login() { |
|||
new LoginPageHelper(driver).authorizationTenant(); |
|||
sideBarMenuView = new SideBarMenuViewHelper(driver); |
|||
profilesPage = new ProfilesPageHelper(driver); |
|||
} |
|||
|
|||
@AfterMethod |
|||
public void delete() { |
|||
if (name != null) { |
|||
testRestClient.deleteDeviseProfile(getDeviceProfileByName(name).getId()); |
|||
name = null; |
|||
} |
|||
} |
|||
|
|||
@Test(priority = 10, groups = "smoke") |
|||
@Description |
|||
public void importDeviceProfile() { |
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.openImportDeviceProfileView(); |
|||
profilesPage.browseFile().sendKeys(absolutePathToFileImportDeviceProfile); |
|||
profilesPage.importBrowseFileBtn().click(); |
|||
name = IMPORT_DEVICE_PROFILE_NAME; |
|||
profilesPage.refreshBtn().click(); |
|||
|
|||
Assert.assertNotNull(profilesPage.entity(IMPORT_DEVICE_PROFILE_NAME)); |
|||
Assert.assertTrue(profilesPage.entity(IMPORT_DEVICE_PROFILE_NAME).isDisplayed()); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void importTxtFile() { |
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.openImportDeviceProfileView(); |
|||
profilesPage.browseFile().sendKeys(absolutePathToFileImportTxt); |
|||
|
|||
Assert.assertNotNull(profilesPage.importingFile(EMPTY_IMPORT_MESSAGE)); |
|||
Assert.assertTrue(profilesPage.importingFile(EMPTY_IMPORT_MESSAGE).isDisplayed()); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void addFileTiImportAndRemove() { |
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.openImportDeviceProfileView(); |
|||
profilesPage.browseFile().sendKeys(absolutePathToFileImportDeviceProfile); |
|||
profilesPage.clearImportFileBtn().click(); |
|||
|
|||
Assert.assertNotNull(profilesPage.importingFile(EMPTY_IMPORT_MESSAGE)); |
|||
Assert.assertTrue(profilesPage.importingFile(EMPTY_IMPORT_MESSAGE).isDisplayed()); |
|||
Assert.assertTrue(profilesPage.entityIsNotPresent(IMPORT_DEVICE_PROFILE_NAME)); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void importDeviceProfileWithSameName() { |
|||
String name = IMPORT_DEVICE_PROFILE_NAME; |
|||
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name)); |
|||
this.name = name; |
|||
|
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.openImportDeviceProfileView(); |
|||
profilesPage.browseFile().sendKeys(absolutePathToFileImportDeviceProfile); |
|||
profilesPage.importBrowseFileBtn().click(); |
|||
profilesPage.refreshBtn().click(); |
|||
|
|||
Assert.assertNotNull(profilesPage.warningMessage()); |
|||
Assert.assertTrue(profilesPage.warningMessage().isDisplayed()); |
|||
Assert.assertEquals(profilesPage.warningMessage().getText(), SAME_NAME_WARNING_DEVICE_PROFILE_MESSAGE); |
|||
} |
|||
|
|||
@Test(priority = 30, groups = "smoke") |
|||
@Description |
|||
public void importDeviceProfileWithoutRefresh() { |
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.openImportDeviceProfileView(); |
|||
profilesPage.browseFile().sendKeys(absolutePathToFileImportDeviceProfile); |
|||
profilesPage.importBrowseFileBtn().click(); |
|||
name = IMPORT_DEVICE_PROFILE_NAME; |
|||
|
|||
Assert.assertNotNull(profilesPage.entity(IMPORT_DEVICE_PROFILE_NAME)); |
|||
Assert.assertTrue(profilesPage.entity(IMPORT_DEVICE_PROFILE_NAME).isDisplayed()); |
|||
} |
|||
} |
|||
@ -0,0 +1,182 @@ |
|||
/** |
|||
* Copyright © 2016-2022 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke; |
|||
|
|||
import io.qameta.allure.Description; |
|||
import org.openqa.selenium.Keys; |
|||
import org.testng.Assert; |
|||
import org.testng.annotations.AfterMethod; |
|||
import org.testng.annotations.BeforeMethod; |
|||
import org.testng.annotations.Test; |
|||
import org.thingsboard.server.msa.ui.base.AbstractDriverBaseTest; |
|||
import org.thingsboard.server.msa.ui.pages.LoginPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.ProfilesPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewHelper; |
|||
import org.thingsboard.server.msa.ui.utils.EntityPrototypes; |
|||
|
|||
import static org.thingsboard.server.msa.ui.base.AbstractBasePage.random; |
|||
import static org.thingsboard.server.msa.ui.utils.Const.EMPTY_DEVICE_PROFILE_MESSAGE; |
|||
import static org.thingsboard.server.msa.ui.utils.Const.ENTITY_NAME; |
|||
import static org.thingsboard.server.msa.ui.utils.Const.NAME_IS_REQUIRED_MESSAGE; |
|||
import static org.thingsboard.server.msa.ui.utils.Const.SAME_NAME_WARNING_DEVICE_PROFILE_MESSAGE; |
|||
|
|||
public class CreateDeviceProfileTest extends AbstractDriverBaseTest { |
|||
|
|||
private SideBarMenuViewHelper sideBarMenuView; |
|||
private ProfilesPageHelper profilesPage; |
|||
private String name; |
|||
|
|||
@BeforeMethod |
|||
public void login() { |
|||
new LoginPageHelper(driver).authorizationTenant(); |
|||
sideBarMenuView = new SideBarMenuViewHelper(driver); |
|||
profilesPage = new ProfilesPageHelper(driver); |
|||
} |
|||
|
|||
@AfterMethod |
|||
public void delete() { |
|||
if (name != null) { |
|||
testRestClient.deleteDeviseProfile(getDeviceProfileByName(name).getId()); |
|||
name = null; |
|||
} |
|||
} |
|||
|
|||
@Test(priority = 10, groups = "smoke") |
|||
@Description |
|||
public void createDeviceProfile() { |
|||
String name = ENTITY_NAME + random(); |
|||
|
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.openCreateDeviceProfileView(); |
|||
profilesPage.createDeviceProfileEnterName(name); |
|||
profilesPage.addDeviceProfileAddBtn().click(); |
|||
profilesPage.refreshBtn().click(); |
|||
this.name = name; |
|||
|
|||
Assert.assertNotNull(profilesPage.entity(name)); |
|||
Assert.assertTrue(profilesPage.entity(name).isDisplayed()); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void createDeviceProfileWithDetails() { |
|||
String name = ENTITY_NAME + random(); |
|||
String ruleChain = "Root Rule Chain"; |
|||
String mobileDashboard = "Firmware"; |
|||
String queue = "Main"; |
|||
String description = "Description"; |
|||
|
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.openCreateDeviceProfileView(); |
|||
profilesPage.createDeviceProfileEnterName(name); |
|||
profilesPage.addDeviceProfileViewChooseRuleChain(ruleChain); |
|||
profilesPage.addDeviceProfileViewChooseMobileDashboard(mobileDashboard); |
|||
profilesPage.addDeviceProfileViewChooseQueue(queue); |
|||
profilesPage.addDeviceProfileViewEnterDescription(description); |
|||
profilesPage.addDeviceProfileAddBtn().click(); |
|||
profilesPage.refreshBtn().click(); |
|||
this.name = name; |
|||
profilesPage.entity(name).click(); |
|||
profilesPage.setName(); |
|||
profilesPage.setRuleChain(); |
|||
profilesPage.setMobileDashboard(); |
|||
profilesPage.setQueue(); |
|||
profilesPage.setDescription(); |
|||
|
|||
Assert.assertNotNull(profilesPage.entity(name)); |
|||
Assert.assertTrue(profilesPage.entity(name).isDisplayed()); |
|||
Assert.assertEquals(name, profilesPage.getName()); |
|||
Assert.assertEquals(ruleChain, profilesPage.getRuleChain()); |
|||
Assert.assertEquals(mobileDashboard, profilesPage.getMobileDashboard()); |
|||
Assert.assertEquals(queue, profilesPage.getQueue()); |
|||
Assert.assertEquals(description, profilesPage.getDescription()); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void createDeviseProfileWithSameName() { |
|||
String name = ENTITY_NAME + random(); |
|||
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name)); |
|||
this.name = name; |
|||
|
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.openCreateDeviceProfileView(); |
|||
profilesPage.createDeviceProfileEnterName(name); |
|||
profilesPage.addDeviceProfileAddBtn().click(); |
|||
|
|||
Assert.assertNotNull(profilesPage.warningMessage()); |
|||
Assert.assertTrue(profilesPage.warningMessage().isDisplayed()); |
|||
Assert.assertEquals(profilesPage.warningMessage().getText(), SAME_NAME_WARNING_DEVICE_PROFILE_MESSAGE); |
|||
Assert.assertNotNull(profilesPage.addDeviceProfileView()); |
|||
Assert.assertTrue(profilesPage.addDeviceProfileView().isDisplayed()); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void createDeviceProfileWithoutName() { |
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.openCreateDeviceProfileView(); |
|||
profilesPage.addDeviceProfileAddBtn().click(); |
|||
|
|||
Assert.assertNotNull(profilesPage.addDeviceProfileView()); |
|||
Assert.assertTrue(profilesPage.addDeviceProfileView().isDisplayed()); |
|||
Assert.assertNotNull(profilesPage.errorMessage()); |
|||
Assert.assertEquals(profilesPage.errorMessage().getText(), NAME_IS_REQUIRED_MESSAGE); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void createDeviseProfileWithOnlySpaceInName() { |
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.openCreateDeviceProfileView(); |
|||
profilesPage.createDeviceProfileEnterName(Keys.SPACE); |
|||
profilesPage.addDeviceProfileAddBtn().click(); |
|||
|
|||
Assert.assertNotNull(profilesPage.warningMessage()); |
|||
Assert.assertTrue(profilesPage.warningMessage().isDisplayed()); |
|||
Assert.assertEquals(profilesPage.warningMessage().getText(), EMPTY_DEVICE_PROFILE_MESSAGE); |
|||
Assert.assertNotNull(profilesPage.addDeviceProfileView()); |
|||
Assert.assertTrue(profilesPage.addDeviceProfileView().isDisplayed()); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void createDeviceProfileWithoutRefresh() { |
|||
String name = ENTITY_NAME + random(); |
|||
|
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.openCreateDeviceProfileView(); |
|||
profilesPage.createDeviceProfileEnterName(name); |
|||
profilesPage.addDeviceProfileAddBtn().click(); |
|||
this.name = name; |
|||
|
|||
Assert.assertNotNull(profilesPage.entity(name)); |
|||
Assert.assertTrue(profilesPage.entity(name).isDisplayed()); |
|||
} |
|||
|
|||
@Test(priority = 30, groups = "smoke") |
|||
@Description |
|||
public void documentation() { |
|||
String urlPath = "docs/user-guide/device-profiles/"; |
|||
|
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.allEntity().get(0).click(); |
|||
profilesPage.goToProfileHelpPage(); |
|||
|
|||
Assert.assertTrue(urlContains(urlPath)); |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,125 @@ |
|||
/** |
|||
* Copyright © 2016-2022 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke; |
|||
|
|||
import io.qameta.allure.Description; |
|||
import org.testng.Assert; |
|||
import org.testng.annotations.BeforeMethod; |
|||
import org.testng.annotations.Test; |
|||
import org.thingsboard.server.msa.ui.base.AbstractDriverBaseTest; |
|||
import org.thingsboard.server.msa.ui.pages.LoginPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.ProfilesPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewHelper; |
|||
import org.thingsboard.server.msa.ui.utils.EntityPrototypes; |
|||
|
|||
import static org.thingsboard.server.msa.ui.base.AbstractBasePage.random; |
|||
import static org.thingsboard.server.msa.ui.utils.Const.ENTITY_NAME; |
|||
|
|||
public class DeleteDeviceProfileTest extends AbstractDriverBaseTest { |
|||
|
|||
private SideBarMenuViewHelper sideBarMenuView; |
|||
private ProfilesPageHelper profilesPage; |
|||
|
|||
@BeforeMethod |
|||
public void login() { |
|||
new LoginPageHelper(driver).authorizationTenant(); |
|||
sideBarMenuView = new SideBarMenuViewHelper(driver); |
|||
profilesPage = new ProfilesPageHelper(driver); |
|||
} |
|||
|
|||
@Test(priority = 10, groups = "smoke") |
|||
@Description |
|||
public void removeDeviceProfile() { |
|||
String name = ENTITY_NAME + random(); |
|||
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name)); |
|||
|
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.deleteBtn(name).click(); |
|||
profilesPage.warningPopUpYesBtn().click(); |
|||
profilesPage.refreshBtn(); |
|||
|
|||
Assert.assertTrue(profilesPage.entityIsNotPresent(name)); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void removeDeviceProfileFromView() { |
|||
String name = ENTITY_NAME + random(); |
|||
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name)); |
|||
|
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.entity(name).click(); |
|||
profilesPage.deviceProfileViewDeleteBtn().click(); |
|||
profilesPage.warningPopUpYesBtn().click(); |
|||
profilesPage.refreshBtn(); |
|||
|
|||
Assert.assertTrue(profilesPage.entityIsNotPresent(name)); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void removeSelectedDeviceProfile() { |
|||
String name = ENTITY_NAME + random(); |
|||
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name)); |
|||
|
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.checkBox(name).click(); |
|||
profilesPage.deleteSelectedBtn().click(); |
|||
profilesPage.warningPopUpYesBtn().click(); |
|||
profilesPage.refreshBtn(); |
|||
|
|||
Assert.assertTrue(profilesPage.entityIsNotPresent(name)); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void removeDefaultDeviceProfile() { |
|||
sideBarMenuView.openDeviceProfiles(); |
|||
|
|||
Assert.assertFalse(profilesPage.deleteBtn("default").isEnabled()); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void removeDefaultDeviceProfileFromView() { |
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.entity("default").click(); |
|||
|
|||
Assert.assertTrue(profilesPage.deleteDeviceProfileFromViewBtnIsNotDisplayed()); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void removeSelectedDefaultDeviceProfile() { |
|||
sideBarMenuView.openDeviceProfiles(); |
|||
|
|||
Assert.assertNotNull(profilesPage.presentCheckBox("default")); |
|||
Assert.assertFalse(profilesPage.presentCheckBox("default").isDisplayed()); |
|||
} |
|||
|
|||
@Test(priority = 30, groups = "smoke") |
|||
@Description |
|||
public void removeDeviceProfileWithoutRefresh() { |
|||
String name = ENTITY_NAME + random(); |
|||
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name)); |
|||
|
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.deleteBtn(name).click(); |
|||
profilesPage.warningPopUpYesBtn().click(); |
|||
|
|||
Assert.assertTrue(profilesPage.entityIsNotPresent(name)); |
|||
} |
|||
} |
|||
@ -0,0 +1,98 @@ |
|||
/** |
|||
* Copyright © 2016-2022 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke; |
|||
|
|||
import io.qameta.allure.Description; |
|||
import org.testng.Assert; |
|||
import org.testng.annotations.BeforeMethod; |
|||
import org.testng.annotations.Test; |
|||
import org.thingsboard.server.msa.ui.base.AbstractDriverBaseTest; |
|||
import org.thingsboard.server.msa.ui.pages.LoginPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.ProfilesPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewHelper; |
|||
|
|||
import static org.thingsboard.server.msa.ui.base.AbstractBasePage.random; |
|||
import static org.thingsboard.server.msa.ui.utils.Const.ENTITY_NAME; |
|||
import static org.thingsboard.server.msa.ui.utils.EntityPrototypes.defaultDeviceProfile; |
|||
|
|||
public class DeleteSeveralDeviceProfilesTest extends AbstractDriverBaseTest { |
|||
private SideBarMenuViewHelper sideBarMenuView; |
|||
private ProfilesPageHelper profilesPage; |
|||
|
|||
@BeforeMethod |
|||
public void login() { |
|||
new LoginPageHelper(driver).authorizationTenant(); |
|||
sideBarMenuView = new SideBarMenuViewHelper(driver); |
|||
profilesPage = new ProfilesPageHelper(driver); |
|||
} |
|||
|
|||
@Test(priority = 10, groups = "smoke") |
|||
@Description |
|||
public void canDeleteSeveralDeviceProfilesByTopBtn() { |
|||
String name1 = ENTITY_NAME + random() + "1"; |
|||
String name2 = ENTITY_NAME + random() + "2"; |
|||
testRestClient.postDeviceProfile(defaultDeviceProfile(name1)); |
|||
testRestClient.postDeviceProfile(defaultDeviceProfile(name2)); |
|||
|
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.clickOnCheckBoxes(2); |
|||
profilesPage.deleteSelectedBtn().click(); |
|||
profilesPage.warningPopUpYesBtn().click(); |
|||
profilesPage.refreshBtn().click(); |
|||
|
|||
Assert.assertTrue(profilesPage.profileIsNotPresent(name1)); |
|||
Assert.assertTrue(profilesPage.profileIsNotPresent(name2)); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void selectAllDeviceProfiles() { |
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.selectAllCheckBox().click(); |
|||
profilesPage.deleteSelectedBtn().click(); |
|||
|
|||
Assert.assertNotNull(profilesPage.warningPopUpTitle()); |
|||
Assert.assertTrue(profilesPage.warningPopUpTitle().isDisplayed()); |
|||
Assert.assertTrue(profilesPage.warningPopUpTitle().getText().contains(String.valueOf(profilesPage.markCheckbox().size()))); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void removeDefaultDeviceProfile() { |
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.selectAllCheckBox().click(); |
|||
|
|||
Assert.assertFalse(profilesPage.checkBoxIsDisplayed("default")); |
|||
Assert.assertFalse(profilesPage.deleteBtn("default").isEnabled()); |
|||
} |
|||
|
|||
@Test(priority = 30, groups = "smoke") |
|||
@Description |
|||
public void deleteSeveralDeviceProfilesByTopBtnWithoutRefresh() { |
|||
String name1 = ENTITY_NAME + random() + "1"; |
|||
String name2 = ENTITY_NAME + random() + "2"; |
|||
testRestClient.postDeviceProfile(defaultDeviceProfile(name1)); |
|||
testRestClient.postDeviceProfile(defaultDeviceProfile(name2)); |
|||
|
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.clickOnCheckBoxes(2); |
|||
profilesPage.deleteSelectedBtn().click(); |
|||
profilesPage.warningPopUpYesBtn().click(); |
|||
|
|||
Assert.assertTrue(profilesPage.profileIsNotPresent(name1)); |
|||
Assert.assertTrue(profilesPage.profileIsNotPresent(name2)); |
|||
} |
|||
} |
|||
@ -0,0 +1,129 @@ |
|||
/** |
|||
* Copyright © 2016-2022 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke; |
|||
|
|||
import io.qameta.allure.Description; |
|||
import org.openqa.selenium.Keys; |
|||
import org.testng.Assert; |
|||
import org.testng.annotations.AfterMethod; |
|||
import org.testng.annotations.BeforeMethod; |
|||
import org.testng.annotations.Test; |
|||
import org.thingsboard.server.msa.ui.base.AbstractDriverBaseTest; |
|||
import org.thingsboard.server.msa.ui.pages.LoginPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.ProfilesPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewHelper; |
|||
import org.thingsboard.server.msa.ui.utils.DataProviderCredential; |
|||
import org.thingsboard.server.msa.ui.utils.EntityPrototypes; |
|||
|
|||
import static org.thingsboard.server.msa.ui.base.AbstractBasePage.getRandomNumber; |
|||
import static org.thingsboard.server.msa.ui.base.AbstractBasePage.random; |
|||
import static org.thingsboard.server.msa.ui.utils.Const.EMPTY_DEVICE_PROFILE_MESSAGE; |
|||
import static org.thingsboard.server.msa.ui.utils.Const.ENTITY_NAME; |
|||
|
|||
public class DeviceProfileEditMenuTest extends AbstractDriverBaseTest { |
|||
|
|||
private SideBarMenuViewHelper sideBarMenuView; |
|||
private ProfilesPageHelper profilesPage; |
|||
private String name; |
|||
|
|||
@BeforeMethod |
|||
public void login() { |
|||
new LoginPageHelper(driver).authorizationTenant(); |
|||
sideBarMenuView = new SideBarMenuViewHelper(driver); |
|||
profilesPage = new ProfilesPageHelper(driver); |
|||
} |
|||
|
|||
@AfterMethod |
|||
public void delete() { |
|||
if (name != null) { |
|||
testRestClient.deleteDeviseProfile(getDeviceProfileByName(name).getId()); |
|||
name = null; |
|||
} |
|||
} |
|||
|
|||
@Test(priority = 10, groups = "smoke") |
|||
@Description |
|||
public void changeName() { |
|||
String name = ENTITY_NAME + random(); |
|||
String newName = "Changed" + getRandomNumber(); |
|||
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name)); |
|||
this.name = name; |
|||
|
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.entity(name).click(); |
|||
profilesPage.setHeaderName(); |
|||
String titleBefore = profilesPage.getHeaderName(); |
|||
jsClick(profilesPage.editPencilBtn()); |
|||
profilesPage.changeNameEditMenu(newName); |
|||
profilesPage.doneBtnEditView().click(); |
|||
this.name = newName; |
|||
profilesPage.setHeaderName(); |
|||
String titleAfter = profilesPage.getHeaderName(); |
|||
|
|||
Assert.assertNotEquals(titleBefore, titleAfter); |
|||
Assert.assertEquals(titleAfter, newName); |
|||
} |
|||
|
|||
@Test(priority = 10, groups = "smoke") |
|||
@Description |
|||
public void deleteName() { |
|||
String name = ENTITY_NAME + random(); |
|||
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name)); |
|||
this.name = name; |
|||
|
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.entity(name).click(); |
|||
jsClick(profilesPage.editPencilBtn()); |
|||
profilesPage.changeNameEditMenu(""); |
|||
|
|||
Assert.assertFalse(profilesPage.doneBtnEditViewVisible().isEnabled()); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke") |
|||
@Description |
|||
public void saveWithOnlySpaceInName() { |
|||
String name = ENTITY_NAME + random(); |
|||
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name)); |
|||
this.name = name; |
|||
|
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.entity(name).click(); |
|||
jsClick(profilesPage.editPencilBtn()); |
|||
profilesPage.changeNameEditMenu(Keys.SPACE); |
|||
profilesPage.doneBtnEditView().click(); |
|||
|
|||
Assert.assertNotNull(profilesPage.warningMessage()); |
|||
Assert.assertTrue(profilesPage.warningMessage().isDisplayed()); |
|||
Assert.assertEquals(profilesPage.warningMessage().getText(), EMPTY_DEVICE_PROFILE_MESSAGE); |
|||
} |
|||
|
|||
@Test(priority = 30, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "editMenuDescription") |
|||
@Description |
|||
public void editDescription(String description, String newDescription, String finalDescription) { |
|||
String name = ENTITY_NAME + random(); |
|||
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name, description)); |
|||
this.name = name; |
|||
|
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.entity(name).click(); |
|||
jsClick(profilesPage.editPencilBtn()); |
|||
profilesPage.profileViewDescriptionField().sendKeys(newDescription); |
|||
profilesPage.doneBtnEditView().click(); |
|||
profilesPage.setDescription(); |
|||
|
|||
Assert.assertEquals(profilesPage.getDescription(), finalDescription); |
|||
} |
|||
} |
|||
@ -0,0 +1,69 @@ |
|||
/** |
|||
* Copyright © 2016-2022 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke; |
|||
|
|||
import io.qameta.allure.Description; |
|||
import org.testng.Assert; |
|||
import org.testng.annotations.AfterMethod; |
|||
import org.testng.annotations.BeforeMethod; |
|||
import org.testng.annotations.Test; |
|||
import org.thingsboard.server.msa.ui.base.AbstractDriverBaseTest; |
|||
import org.thingsboard.server.msa.ui.pages.LoginPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.ProfilesPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewHelper; |
|||
|
|||
public class MakeDeviceProfileDefaultTest extends AbstractDriverBaseTest { |
|||
private SideBarMenuViewHelper sideBarMenuView; |
|||
private ProfilesPageHelper profilesPage; |
|||
|
|||
@BeforeMethod |
|||
public void login() { |
|||
new LoginPageHelper(driver).authorizationTenant(); |
|||
sideBarMenuView = new SideBarMenuViewHelper(driver); |
|||
profilesPage = new ProfilesPageHelper(driver); |
|||
} |
|||
|
|||
@AfterMethod |
|||
public void makeProfileDefault() { |
|||
testRestClient.setDefaultDeviceProfile(getDeviceProfileByName("default").getId()); |
|||
} |
|||
|
|||
@Test(priority = 10, groups = "smoke") |
|||
@Description |
|||
public void makeDeviceProfileDefaultByRightCornerBtn() { |
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.setProfileName(); |
|||
String profile = profilesPage.getProfileName(); |
|||
profilesPage.makeProfileDefaultBtn(profile).click(); |
|||
profilesPage.warningPopUpYesBtn().click(); |
|||
|
|||
Assert.assertTrue(profilesPage.defaultCheckbox(profile).isDisplayed()); |
|||
} |
|||
|
|||
@Test(priority = 10, groups = "smoke") |
|||
@Description |
|||
public void makeDeviceProfileDefaultFromView() { |
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.setProfileName(); |
|||
String profile = profilesPage.getProfileName(); |
|||
profilesPage.entity(profile).click(); |
|||
profilesPage.deviceProfileViewMakeDefaultBtn().click(); |
|||
profilesPage.warningPopUpYesBtn().click(); |
|||
profilesPage.closeEntityViewBtn().click(); |
|||
|
|||
Assert.assertTrue(profilesPage.defaultCheckbox(profile).isDisplayed()); |
|||
} |
|||
} |
|||
@ -0,0 +1,63 @@ |
|||
/** |
|||
* Copyright © 2016-2022 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke; |
|||
|
|||
import io.qameta.allure.Description; |
|||
import org.testng.Assert; |
|||
import org.testng.annotations.AfterMethod; |
|||
import org.testng.annotations.BeforeMethod; |
|||
import org.testng.annotations.Test; |
|||
import org.thingsboard.server.msa.ui.base.AbstractDriverBaseTest; |
|||
import org.thingsboard.server.msa.ui.pages.LoginPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.ProfilesPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewHelper; |
|||
import org.thingsboard.server.msa.ui.utils.DataProviderCredential; |
|||
|
|||
import static org.thingsboard.server.msa.ui.utils.EntityPrototypes.defaultDeviceProfile; |
|||
|
|||
public class SearchDeviceProfileTest extends AbstractDriverBaseTest { |
|||
|
|||
private SideBarMenuViewHelper sideBarMenuView; |
|||
private ProfilesPageHelper profilesPage; |
|||
private String name; |
|||
|
|||
@BeforeMethod |
|||
public void login() { |
|||
new LoginPageHelper(driver).authorizationTenant(); |
|||
sideBarMenuView = new SideBarMenuViewHelper(driver); |
|||
profilesPage = new ProfilesPageHelper(driver); |
|||
} |
|||
|
|||
@AfterMethod |
|||
public void delete() { |
|||
if (name != null) { |
|||
testRestClient.deleteDeviseProfile(getDeviceProfileByName(name).getId()); |
|||
name = null; |
|||
} |
|||
} |
|||
|
|||
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "deviceProfileSearch") |
|||
@Description |
|||
public void searchFirstWord(String name, String namePath) { |
|||
testRestClient.postDeviceProfile(defaultDeviceProfile(name)); |
|||
this.name = name; |
|||
|
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.searchEntity(namePath); |
|||
|
|||
profilesPage.allEntity().forEach(x -> Assert.assertTrue(x.getText().contains(namePath))); |
|||
} |
|||
} |
|||
@ -0,0 +1,127 @@ |
|||
/** |
|||
* Copyright © 2016-2022 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke; |
|||
|
|||
import io.qameta.allure.Description; |
|||
import org.testng.Assert; |
|||
import org.testng.annotations.AfterMethod; |
|||
import org.testng.annotations.BeforeMethod; |
|||
import org.testng.annotations.Test; |
|||
import org.thingsboard.server.msa.ui.base.AbstractDriverBaseTest; |
|||
import org.thingsboard.server.msa.ui.pages.LoginPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.ProfilesPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewHelper; |
|||
import org.thingsboard.server.msa.ui.utils.DataProviderCredential; |
|||
|
|||
import static org.thingsboard.server.msa.ui.utils.EntityPrototypes.defaultDeviceProfile; |
|||
|
|||
public class SortByNameTest extends AbstractDriverBaseTest { |
|||
private SideBarMenuViewHelper sideBarMenuView; |
|||
private ProfilesPageHelper profilesPage; |
|||
private String name; |
|||
|
|||
@BeforeMethod |
|||
public void login() { |
|||
new LoginPageHelper(driver).authorizationTenant(); |
|||
sideBarMenuView = new SideBarMenuViewHelper(driver); |
|||
profilesPage = new ProfilesPageHelper(driver); |
|||
} |
|||
|
|||
@AfterMethod |
|||
public void delete() { |
|||
if (name != null) { |
|||
testRestClient.deleteDeviseProfile(getDeviceProfileByName(name).getId()); |
|||
name = null; |
|||
} |
|||
} |
|||
|
|||
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSort") |
|||
@Description |
|||
public void specialCharacterUp(String name) { |
|||
testRestClient.postDeviceProfile(defaultDeviceProfile(name)); |
|||
this.name = name; |
|||
|
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.sortByNameBtn().click(); |
|||
profilesPage.setProfileName(); |
|||
|
|||
Assert.assertEquals(profilesPage.getProfileName(), name); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForAllSort") |
|||
@Description |
|||
public void allSortUp(String deviceProfile, String deviceProfileSymbol, String deviceProfileNumber) { |
|||
testRestClient.postDeviceProfile(defaultDeviceProfile(deviceProfileSymbol)); |
|||
testRestClient.postDeviceProfile(defaultDeviceProfile(deviceProfile)); |
|||
testRestClient.postDeviceProfile(defaultDeviceProfile(deviceProfileNumber)); |
|||
|
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.sortByNameBtn().click(); |
|||
profilesPage.setProfileName(0); |
|||
String firstDeviceProfile = profilesPage.getProfileName(); |
|||
profilesPage.setProfileName(1); |
|||
String secondDeviceProfile = profilesPage.getProfileName(); |
|||
profilesPage.setProfileName(2); |
|||
String thirdDeviceProfile = profilesPage.getProfileName(); |
|||
|
|||
testRestClient.deleteDeviseProfile(getDeviceProfileByName(deviceProfile).getId()); |
|||
testRestClient.deleteDeviseProfile(getDeviceProfileByName(deviceProfileNumber).getId()); |
|||
testRestClient.deleteDeviseProfile(getDeviceProfileByName(deviceProfileSymbol).getId()); |
|||
|
|||
Assert.assertEquals(firstDeviceProfile, deviceProfileSymbol); |
|||
Assert.assertEquals(secondDeviceProfile, deviceProfileNumber); |
|||
Assert.assertEquals(thirdDeviceProfile, deviceProfile); |
|||
} |
|||
|
|||
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSort") |
|||
@Description |
|||
public void specialCharacterDown(String name) { |
|||
testRestClient.postDeviceProfile(defaultDeviceProfile(name)); |
|||
this.name = name; |
|||
|
|||
sideBarMenuView.openDeviceProfiles(); |
|||
profilesPage.sortByNameDown(); |
|||
profilesPage.setProfileName(profilesPage.allEntity().size() - 1); |
|||
|
|||
Assert.assertEquals(profilesPage.getProfileName(), name); |
|||
} |
|||
|
|||
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForAllSort") |
|||
@Description |
|||
public void allSortDown(String deviceProfile, String deviceProfileSymbol, String deviceProfileNumber) { |
|||
testRestClient.postDeviceProfile(defaultDeviceProfile(deviceProfileSymbol)); |
|||
testRestClient.postDeviceProfile(defaultDeviceProfile(deviceProfile)); |
|||
testRestClient.postDeviceProfile(defaultDeviceProfile(deviceProfileNumber)); |
|||
|
|||
sideBarMenuView.openDeviceProfiles(); |
|||
int lastIndex = profilesPage.allEntity().size() - 1; |
|||
profilesPage.sortByNameDown(); |
|||
profilesPage.setProfileName(lastIndex); |
|||
String firstDeviceProfile = profilesPage.getProfileName(); |
|||
profilesPage.setProfileName(lastIndex - 1); |
|||
String secondDeviceProfile = profilesPage.getProfileName(); |
|||
profilesPage.setProfileName(lastIndex - 2); |
|||
String thirdDeviceProfile = profilesPage.getProfileName(); |
|||
|
|||
testRestClient.deleteDeviseProfile(getDeviceProfileByName(deviceProfile).getId()); |
|||
testRestClient.deleteDeviseProfile(getDeviceProfileByName(deviceProfileNumber).getId()); |
|||
testRestClient.deleteDeviseProfile(getDeviceProfileByName(deviceProfileSymbol).getId()); |
|||
|
|||
Assert.assertEquals(firstDeviceProfile, deviceProfileSymbol); |
|||
Assert.assertEquals(secondDeviceProfile, deviceProfileNumber); |
|||
Assert.assertEquals(thirdDeviceProfile, deviceProfile); |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
{ |
|||
"name": "Asset Profile For Import", |
|||
"description": null, |
|||
"image": null, |
|||
"defaultRuleChainId": null, |
|||
"defaultDashboardId": null, |
|||
"defaultQueueName": null, |
|||
"externalId": null, |
|||
"default": false |
|||
} |
|||
@ -1,2 +1,3 @@ |
|||
tb.baseUrl=http://localhost:8080 |
|||
tb.wsUrl=ws://localhost:8080 |
|||
tb.baseUiUrl=http://localhost:8080 |
|||
tb.wsUrl=ws://localhost:8080 |
|||
@ -0,0 +1,29 @@ |
|||
{ |
|||
"name": "Device Profile For Import", |
|||
"description": "", |
|||
"image": null, |
|||
"type": "DEFAULT", |
|||
"transportType": "DEFAULT", |
|||
"provisionType": "DISABLED", |
|||
"defaultRuleChainId": null, |
|||
"defaultDashboardId": null, |
|||
"defaultQueueName": null, |
|||
"profileData": { |
|||
"configuration": { |
|||
"type": "DEFAULT" |
|||
}, |
|||
"transportConfiguration": { |
|||
"type": "DEFAULT" |
|||
}, |
|||
"provisionConfiguration": { |
|||
"type": "DISABLED", |
|||
"provisionDeviceSecret": null |
|||
}, |
|||
"alarms": null |
|||
}, |
|||
"provisionDeviceKey": null, |
|||
"firmwareId": null, |
|||
"softwareId": null, |
|||
"externalId": null, |
|||
"default": false |
|||
} |
|||
@ -0,0 +1,36 @@ |
|||
<?xml version="1.0" encoding="ISO-8859-1"?> |
|||
<!-- |
|||
|
|||
Copyright © 2016-2022 The Thingsboard Authors |
|||
|
|||
Licensed under the Apache License, Version 2.0 (the "License"); |
|||
you may not use this file except in compliance with the License. |
|||
You may obtain a copy of the License at |
|||
|
|||
http://www.apache.org/licenses/LICENSE-2.0 |
|||
|
|||
Unless required by applicable law or agreed to in writing, software |
|||
distributed under the License is distributed on an "AS IS" BASIS, |
|||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
See the License for the specific language governing permissions and |
|||
limitations under the License. |
|||
|
|||
--> |
|||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > |
|||
|
|||
<suite name="Profiles Smoke Tests"> |
|||
<listeners> |
|||
<listener class-name="org.thingsboard.server.msa.ui.listeners.RetryTestListener"/> |
|||
</listeners> |
|||
<test name="Profiles ui smoke tests"> |
|||
<groups> |
|||
<run> |
|||
<exclude name="broken"/> |
|||
</run> |
|||
</groups> |
|||
<packages> |
|||
<package name="org.thingsboard.server.msa.ui.tests.deviceProfileSmoke"/> |
|||
<package name="org.thingsboard.server.msa.ui.tests.assetProfileSmoke"/> |
|||
</packages> |
|||
</test> |
|||
</suite> |
|||
Loading…
Reference in new issue