add tests on create and import device profiles
This commit is contained in:
		
							parent
							
								
									d629151266
								
							
						
					
					
						commit
						3b891e5d10
					
				@ -34,7 +34,7 @@ public class OtherPageElements extends AbstractBasePage {
 | 
			
		||||
    private static final String WARNING_DELETE_POPUP_YES = "//tb-confirm-dialog//button[2]";
 | 
			
		||||
    private static final String WARNING_DELETE_POPUP_TITLE = "//tb-confirm-dialog/h2";
 | 
			
		||||
    private static final String REFRESH_BTN = "//mat-icon[contains(text(),'refresh')]/..";
 | 
			
		||||
    private static final String HELP_BTN = "//mat-icon[contains(text(),'help')]/..";
 | 
			
		||||
    private static final String HELP_BTN = "//mat-icon[contains(text(),'help')]/ancestor::button";
 | 
			
		||||
    private static final String CHECKBOX = "//mat-row//span[contains(text(),'%s')]/../..//mat-checkbox";
 | 
			
		||||
    private static final String CHECKBOXES = "//tbody//mat-checkbox";
 | 
			
		||||
    private static final String DELETE_SELECTED_BTN = "//span[contains(text(),'selected')]//..//mat-icon/../..";
 | 
			
		||||
 | 
			
		||||
@ -9,12 +9,13 @@ 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.ENTITY_NAME;
 | 
			
		||||
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;
 | 
			
		||||
import static org.thingsboard.server.msa.ui.utils.Const.TENANT_EMAIL;
 | 
			
		||||
import static org.thingsboard.server.msa.ui.utils.Const.TENANT_PASSWORD;
 | 
			
		||||
 | 
			
		||||
@ -82,16 +83,29 @@ public class CreateDeviceProfileImportTest extends AbstractDriverBaseTest {
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    public void importDeviceProfileWithSameName() {
 | 
			
		||||
        String name = ENTITY_NAME;
 | 
			
		||||
        testRestClient.postDeviceProfile()
 | 
			
		||||
        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();
 | 
			
		||||
        this.name = IMPORT_DEVICE_PROFILE_NAME;
 | 
			
		||||
        profilesPage.refreshBtn().click();
 | 
			
		||||
 | 
			
		||||
        Assert.assertNotNull(profilesPage.warningMessage());
 | 
			
		||||
        Assert.assertTrue(profilesPage.warningMessage().isDisplayed());
 | 
			
		||||
        Assert.assertEquals(profilesPage.warningMessage().getText(), SAME_NAME_WARNING_DEVICE_PROFILE_MESSAGE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    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());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user