committed by
GitHub
22 changed files with 1349 additions and 6 deletions
@ -0,0 +1,78 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2023 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 AlarmDetailsEntityTabElements extends OtherPageElements { |
||||
|
public AlarmDetailsEntityTabElements(WebDriver driver) { |
||||
|
super(driver); |
||||
|
} |
||||
|
|
||||
|
private static final String ASSIGN_BTN = "//span[text() = '%s']/ancestor::mat-row//mat-icon[contains(text(),'keyboard_arrow_down')]/parent::button"; |
||||
|
private static final String USER_ASSIGN_DROPDOWN = "//div[@class='user-display-name']/span[text() = '%s']"; |
||||
|
protected static final String ASSIGN_USERS_DISPLAY_NAME = "//div[@class='user-display-name']/span"; |
||||
|
private static final String ASSIGN_USER_DISPLAY_NAME = "//span[@class='user-display-name'][contains(text(),'%s')]"; |
||||
|
private static final String SEARCH_FIELD = "//input[@placeholder='Search users']"; |
||||
|
private static final String UNASSIGNED_BTN = "//div[@role='listbox']//mat-icon[text() = 'account_circle']/following-sibling::span"; |
||||
|
private static final String UNASSIGNED = "//span[text() = '%s']/ancestor::mat-row//span[@class='assignee-cell']//mat-icon[text() = 'account_circle']/following-sibling::span"; |
||||
|
private static final String ALARM_DETAILS_BTN = "//span[text() = '%s']/ancestor::mat-row//mat-icon[contains(text(),'more_horiz')]/parent::button"; |
||||
|
private static final String ACCESS_FORBIDDEN_DIALOG_VIEW = "//h2[text() = 'Access Forbidden']/parent::tb-confirm-dialog"; |
||||
|
private static final String ALARM_ASSIGNEE_DROPDOWN = "//tb-alarm-assignee-panel"; |
||||
|
|
||||
|
public WebElement assignBtn(String type) { |
||||
|
return waitUntilElementToBeClickable(String.format(ASSIGN_BTN, type)); |
||||
|
} |
||||
|
|
||||
|
public WebElement userFromAssignDropDown(String userEmail) { |
||||
|
return waitUntilElementToBeClickable(String.format(USER_ASSIGN_DROPDOWN, userEmail)); |
||||
|
} |
||||
|
|
||||
|
public WebElement assignedUser(String userEmail) { |
||||
|
return waitUntilElementToBeClickable(String.format(ASSIGN_USER_DISPLAY_NAME, userEmail)); |
||||
|
} |
||||
|
|
||||
|
public List<WebElement> assignUsers() { |
||||
|
return waitUntilElementsToBeClickable(ASSIGN_USERS_DISPLAY_NAME); |
||||
|
} |
||||
|
|
||||
|
public WebElement searchUserField() { |
||||
|
return waitUntilElementToBeClickable(SEARCH_FIELD); |
||||
|
} |
||||
|
|
||||
|
public WebElement unassignedBtn() { |
||||
|
return waitUntilElementToBeClickable(UNASSIGNED_BTN); |
||||
|
} |
||||
|
|
||||
|
public WebElement unassigned(String alarmType) { |
||||
|
return waitUntilVisibilityOfElementLocated(String.format(UNASSIGNED, alarmType)); |
||||
|
} |
||||
|
|
||||
|
public WebElement alarmDetailsBtn(String alarmType) { |
||||
|
return waitUntilElementToBeClickable(String.format(ALARM_DETAILS_BTN, alarmType)); |
||||
|
} |
||||
|
|
||||
|
public WebElement accessForbiddenDialogView() { |
||||
|
return waitUntilVisibilityOfElementLocated(ACCESS_FORBIDDEN_DIALOG_VIEW); |
||||
|
} |
||||
|
|
||||
|
public WebElement alarmAssigneeDropdown() { |
||||
|
return waitUntilVisibilityOfElementLocated(ALARM_ASSIGNEE_DROPDOWN); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,61 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2023 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; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
public class AlarmDetailsEntityTabHelper extends AlarmDetailsEntityTabElements { |
||||
|
public AlarmDetailsEntityTabHelper(WebDriver driver) { |
||||
|
super(driver); |
||||
|
} |
||||
|
|
||||
|
public void assignAlarmTo(String alarmType, String user) { |
||||
|
jsClick(assignBtn(alarmType)); |
||||
|
userFromAssignDropDown(user).click(); |
||||
|
} |
||||
|
|
||||
|
public void unassignedAlarm(String alarmType) { |
||||
|
jsClick(assignBtn(alarmType)); |
||||
|
unassignedBtn().click(); |
||||
|
} |
||||
|
|
||||
|
public void searchAlarm(String alarmType, String emailOrName) { |
||||
|
jsClick(assignBtn(alarmType)); |
||||
|
searchUserField().sendKeys(emailOrName); |
||||
|
} |
||||
|
|
||||
|
private List<String> users; |
||||
|
|
||||
|
public void setUsers() { |
||||
|
users = assignUsers() |
||||
|
.stream() |
||||
|
.map(WebElement::getText) |
||||
|
.collect(Collectors.toList()); |
||||
|
} |
||||
|
|
||||
|
public List<String> getUsers() { |
||||
|
return users; |
||||
|
} |
||||
|
|
||||
|
public void assertUsersForAssignIsNotPresent() { |
||||
|
sleep(1); |
||||
|
elementsIsNotPresent(ASSIGN_USERS_DISPLAY_NAME); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,47 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2023 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 org.thingsboard.server.msa.ui.base.AbstractBasePage; |
||||
|
|
||||
|
public class AlarmDetailsViewElements extends AbstractBasePage { |
||||
|
public AlarmDetailsViewElements(WebDriver driver) { |
||||
|
super(driver); |
||||
|
} |
||||
|
|
||||
|
private static final String ASSIGN_FIELD = "//mat-label[text()='Assignee']/parent::label/parent::div//input"; |
||||
|
private static final String USER_FROM_DROP_DOWN = "//div[@class='user-display-name']/span[text() = '%s']"; |
||||
|
private static final String CLOSE_ALARM_DETAILS_VIEW_BTN = "//mat-dialog-container//mat-icon[contains(text(),'close')]/parent::button"; |
||||
|
private static final String UNASSIGNED_BTN = "//div[@role='listbox']//mat-icon[text() = 'account_circle']/following-sibling::span"; |
||||
|
|
||||
|
public WebElement assignField() { |
||||
|
return waitUntilElementToBeClickable(ASSIGN_FIELD); |
||||
|
} |
||||
|
|
||||
|
public WebElement userFromAssignDropdown(String emailOrName) { |
||||
|
return waitUntilElementToBeClickable(String.format(USER_FROM_DROP_DOWN, emailOrName)); |
||||
|
} |
||||
|
|
||||
|
public WebElement closeAlarmDetailsViewBtn() { |
||||
|
return waitUntilElementToBeClickable(CLOSE_ALARM_DETAILS_VIEW_BTN); |
||||
|
} |
||||
|
|
||||
|
public WebElement unassignedBtn() { |
||||
|
return waitUntilElementToBeClickable(UNASSIGNED_BTN); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,34 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2023 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 AlarmDetailsViewHelper extends AlarmDetailsViewElements { |
||||
|
public AlarmDetailsViewHelper(WebDriver driver) { |
||||
|
super(driver); |
||||
|
} |
||||
|
|
||||
|
public void assignAlarmTo(String emailOrName) { |
||||
|
assignField().click(); |
||||
|
userFromAssignDropdown(emailOrName).click(); |
||||
|
} |
||||
|
|
||||
|
public void unassignedAlarm() { |
||||
|
assignField().click(); |
||||
|
unassignedBtn().click(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,37 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2023 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; |
||||
|
|
||||
|
public class AssetPageElements extends OtherPageElements { |
||||
|
public AssetPageElements(WebDriver driver) { |
||||
|
super(driver); |
||||
|
} |
||||
|
|
||||
|
private static final String ASSET_DETAILS_VIEW = "//tb-details-panel"; |
||||
|
private static final String ASSET_DETAILS_ALARMS = ASSET_DETAILS_VIEW + "//span[text()='Alarms']"; |
||||
|
|
||||
|
public WebElement assetDetailsView() { |
||||
|
return waitUntilPresenceOfElementLocated(ASSET_DETAILS_VIEW); |
||||
|
} |
||||
|
|
||||
|
public WebElement assetDetailsAlarmsBtn() { |
||||
|
return waitUntilElementToBeClickable(ASSET_DETAILS_ALARMS); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,32 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2023 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 AssetPageHelper extends AssetPageElements { |
||||
|
public AssetPageHelper(WebDriver driver) { |
||||
|
super(driver); |
||||
|
} |
||||
|
|
||||
|
public void openAssetAlarms(String assetName) { |
||||
|
if (!assetDetailsView().isDisplayed()) { |
||||
|
entity(assetName).click(); |
||||
|
} |
||||
|
assetDetailsAlarmsBtn().click(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,67 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2023 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; |
||||
|
|
||||
|
public class DevicePageElements extends OtherPageElements { |
||||
|
public DevicePageElements(WebDriver driver) { |
||||
|
super(driver); |
||||
|
} |
||||
|
|
||||
|
private static final String DEVICE = "//table//span[text()='%s']"; |
||||
|
private static final String DEVICE_DETAILS_VIEW = "//tb-details-panel"; |
||||
|
private static final String DEVICE_DETAILS_ALARMS = DEVICE_DETAILS_VIEW + "//span[text()='Alarms']"; |
||||
|
private static final String ASSIGN_TO_CUSTOMER_BTN = "//mat-cell[contains(@class,'name')]/span[text()='%s']" + |
||||
|
"/ancestor::mat-row//mat-icon[contains(text(),'assignment_ind')]/parent::button"; |
||||
|
private static final String CHOOSE_CUSTOMER_FOR_ASSIGN_FIELD = "//input[@formcontrolname='entity']"; |
||||
|
private static final String CUSTOMER_FROM_ASSIGN_DROPDOWN = "//div[@role = 'listbox']//span[text() = '%s']"; |
||||
|
private static final String CLOSE_DEVICE_DETAILS_VIEW = "//header//mat-icon[contains(text(),'close')]/parent::button"; |
||||
|
private static final String SUBMIT_ASSIGN_TO_CUSTOMER_BTN = "//button[@type='submit']"; |
||||
|
|
||||
|
public WebElement device(String deviceName) { |
||||
|
return waitUntilElementToBeClickable(String.format(DEVICE, deviceName)); |
||||
|
} |
||||
|
|
||||
|
public WebElement deviceDetailsAlarmsBtn() { |
||||
|
return waitUntilElementToBeClickable(DEVICE_DETAILS_ALARMS); |
||||
|
} |
||||
|
|
||||
|
public WebElement deviceDetailsView() { |
||||
|
return waitUntilPresenceOfElementLocated(DEVICE_DETAILS_VIEW); |
||||
|
} |
||||
|
|
||||
|
public WebElement assignToCustomerBtn(String deviceName) { |
||||
|
return waitUntilElementToBeClickable(String.format(ASSIGN_TO_CUSTOMER_BTN, deviceName)); |
||||
|
} |
||||
|
|
||||
|
public WebElement chooseCustomerForAssignField() { |
||||
|
return waitUntilElementToBeClickable(CHOOSE_CUSTOMER_FOR_ASSIGN_FIELD); |
||||
|
} |
||||
|
|
||||
|
public WebElement customerFromAssignDropdown(String customerTitle) { |
||||
|
return waitUntilElementToBeClickable(String.format(CUSTOMER_FROM_ASSIGN_DROPDOWN, customerTitle)); |
||||
|
} |
||||
|
|
||||
|
public WebElement closeDeviceDetailsViewBtn() { |
||||
|
return waitUntilElementToBeClickable(CLOSE_DEVICE_DETAILS_VIEW); |
||||
|
} |
||||
|
|
||||
|
public WebElement submitAssignToCustomerBtn() { |
||||
|
return waitUntilElementToBeClickable(SUBMIT_ASSIGN_TO_CUSTOMER_BTN); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,37 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2023 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 DevicePageHelper extends DevicePageElements { |
||||
|
public DevicePageHelper(WebDriver driver) { |
||||
|
super(driver); |
||||
|
} |
||||
|
|
||||
|
public void openDeviceAlarms(String deviceName) { |
||||
|
if (!deviceDetailsView().isDisplayed()) { |
||||
|
device(deviceName).click(); |
||||
|
} |
||||
|
deviceDetailsAlarmsBtn().click(); |
||||
|
} |
||||
|
|
||||
|
public void assignToCustomer(String customerTitle) { |
||||
|
chooseCustomerForAssignField().click(); |
||||
|
customerFromAssignDropdown(customerTitle).click(); |
||||
|
submitAssignToCustomerBtn().click(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,37 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2023 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; |
||||
|
|
||||
|
public class EntityViewPageElements extends OtherPageElementsHelper { |
||||
|
public EntityViewPageElements(WebDriver driver) { |
||||
|
super(driver); |
||||
|
} |
||||
|
|
||||
|
private static final String ENTITY_VIEW_DETAILS_VIEW = "//tb-details-panel"; |
||||
|
private static final String ENTITY_VIEW_DETAILS_ALARMS = ENTITY_VIEW_DETAILS_VIEW + "//span[text()='Alarms']"; |
||||
|
|
||||
|
public WebElement entityViewDetailsView() { |
||||
|
return waitUntilPresenceOfElementLocated(ENTITY_VIEW_DETAILS_VIEW); |
||||
|
} |
||||
|
|
||||
|
public WebElement entityViewDetailsAlarmsBtn() { |
||||
|
return waitUntilElementToBeClickable(ENTITY_VIEW_DETAILS_ALARMS); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,32 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2023 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 EntityViewPageHelper extends EntityViewPageElements { |
||||
|
public EntityViewPageHelper(WebDriver driver) { |
||||
|
super(driver); |
||||
|
} |
||||
|
|
||||
|
public void openEntityViewAlarms(String customerName) { |
||||
|
if (!entityViewDetailsView().isDisplayed()) { |
||||
|
entity(customerName).click(); |
||||
|
} |
||||
|
entityViewDetailsAlarmsBtn().click(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,105 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2023 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.assignee; |
||||
|
|
||||
|
import io.qameta.allure.Epic; |
||||
|
import org.testng.annotations.AfterClass; |
||||
|
import org.testng.annotations.AfterMethod; |
||||
|
import org.testng.annotations.BeforeClass; |
||||
|
import org.testng.annotations.BeforeMethod; |
||||
|
import org.thingsboard.server.common.data.id.AlarmId; |
||||
|
import org.thingsboard.server.common.data.id.CustomerId; |
||||
|
import org.thingsboard.server.common.data.id.DeviceId; |
||||
|
import org.thingsboard.server.common.data.id.UserId; |
||||
|
import org.thingsboard.server.msa.ui.base.AbstractDriverBaseTest; |
||||
|
import org.thingsboard.server.msa.ui.pages.AlarmDetailsEntityTabHelper; |
||||
|
import org.thingsboard.server.msa.ui.pages.AlarmDetailsViewHelper; |
||||
|
import org.thingsboard.server.msa.ui.pages.CustomerPageHelper; |
||||
|
import org.thingsboard.server.msa.ui.pages.DevicePageHelper; |
||||
|
import org.thingsboard.server.msa.ui.pages.LoginPageHelper; |
||||
|
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; |
||||
|
|
||||
|
@Epic("Alarm assign") |
||||
|
abstract public class AbstractAssignTest extends AbstractDriverBaseTest { |
||||
|
|
||||
|
protected AlarmId alarmId; |
||||
|
protected AlarmId assignedAlarmId; |
||||
|
protected DeviceId deviceId; |
||||
|
protected UserId userId; |
||||
|
protected UserId userWithNameId; |
||||
|
protected CustomerId customerId; |
||||
|
protected String deviceName; |
||||
|
protected String userName; |
||||
|
protected String customerTitle; |
||||
|
protected String userEmail; |
||||
|
protected String userWithNameEmail; |
||||
|
protected String alarmType; |
||||
|
protected String assignedAlarmType; |
||||
|
protected SideBarMenuViewHelper sideBarMenuView; |
||||
|
protected AlarmDetailsEntityTabHelper alarmPage; |
||||
|
protected DevicePageHelper devicePage; |
||||
|
protected CustomerPageHelper customerPage; |
||||
|
protected AlarmDetailsViewHelper alarmDetailsView; |
||||
|
|
||||
|
@BeforeClass |
||||
|
public void generateCommonTestEntity() { |
||||
|
new LoginPageHelper(driver).authorizationTenant(); |
||||
|
sideBarMenuView = new SideBarMenuViewHelper(driver); |
||||
|
alarmPage = new AlarmDetailsEntityTabHelper(driver); |
||||
|
devicePage = new DevicePageHelper(driver); |
||||
|
customerPage = new CustomerPageHelper(driver); |
||||
|
alarmDetailsView = new AlarmDetailsViewHelper(driver); |
||||
|
|
||||
|
userName = "User " + random(); |
||||
|
customerTitle = "Customer " + random(); |
||||
|
userEmail = random() + "@thingsboard.org"; |
||||
|
userWithNameEmail = random() + "@thingsboard.org"; |
||||
|
alarmType = "Test alarm " + random(); |
||||
|
assignedAlarmType = "Test assigned alarm " + random(); |
||||
|
|
||||
|
customerId = testRestClient.postCustomer(EntityPrototypes.defaultCustomerPrototype(customerTitle)).getId(); |
||||
|
userId = testRestClient.postUser(EntityPrototypes.defaultUser(userEmail, getCustomerByName(customerTitle).getId())).getId(); |
||||
|
userWithNameId = testRestClient.postUser(EntityPrototypes.defaultUser(userWithNameEmail, getCustomerByName(customerTitle).getId(), userName)).getId(); |
||||
|
deviceName = testRestClient.postDevice("", EntityPrototypes.defaultDevicePrototype("Device ", customerId)).getName(); |
||||
|
deviceId = testRestClient.getDeviceByName(deviceName).getId(); |
||||
|
} |
||||
|
|
||||
|
@AfterClass |
||||
|
public void deleteCommonEntities() { |
||||
|
deleteCustomerById(customerId); |
||||
|
deleteDeviceById(deviceId); |
||||
|
} |
||||
|
|
||||
|
@BeforeMethod |
||||
|
public void createCommonTestAlarms() { |
||||
|
alarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(deviceId, alarmType)).getId(); |
||||
|
assignedAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(deviceId, assignedAlarmType, userId)).getId(); |
||||
|
} |
||||
|
|
||||
|
@AfterMethod |
||||
|
public void deleteCommonCreatedAlarms() { |
||||
|
deleteAlarmsByIds(alarmId, assignedAlarmId); |
||||
|
} |
||||
|
|
||||
|
public void loginByUser(String userEmail) { |
||||
|
sideBarMenuView.customerBtn().click(); |
||||
|
customerPage.manageCustomersUserBtn(customerTitle).click(); |
||||
|
customerPage.getUserLoginBtnByEmail(userEmail).click(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,253 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2023 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.assignee; |
||||
|
|
||||
|
import io.qameta.allure.Description; |
||||
|
import io.qameta.allure.Feature; |
||||
|
import org.testng.annotations.AfterClass; |
||||
|
import org.testng.annotations.AfterMethod; |
||||
|
import org.testng.annotations.BeforeClass; |
||||
|
import org.testng.annotations.BeforeMethod; |
||||
|
import org.testng.annotations.DataProvider; |
||||
|
import org.testng.annotations.Test; |
||||
|
import org.thingsboard.server.common.data.id.AlarmId; |
||||
|
import org.thingsboard.server.common.data.id.AssetId; |
||||
|
import org.thingsboard.server.common.data.id.EntityViewId; |
||||
|
import org.thingsboard.server.msa.ui.pages.AssetPageHelper; |
||||
|
import org.thingsboard.server.msa.ui.pages.EntityViewPageHelper; |
||||
|
import org.thingsboard.server.msa.ui.utils.Const; |
||||
|
import org.thingsboard.server.msa.ui.utils.EntityPrototypes; |
||||
|
|
||||
|
import static org.assertj.core.api.Assertions.assertThat; |
||||
|
import static org.thingsboard.server.msa.ui.base.AbstractBasePage.random; |
||||
|
|
||||
|
@Feature("Assign from details tab of entity (by tenant)") |
||||
|
public class AssignDetailsTabAssignTest extends AbstractAssignTest { |
||||
|
|
||||
|
private AssetId assetId; |
||||
|
private AlarmId propageteAlarmId; |
||||
|
private AlarmId propageteAssigneAlarmId; |
||||
|
private AlarmId customerAlarmId; |
||||
|
private AlarmId assetAlarmId; |
||||
|
private AlarmId entityViewAlarmId; |
||||
|
private EntityViewId entityViewId; |
||||
|
private String assetName; |
||||
|
private String entityViewName; |
||||
|
private String propagateAlarmType; |
||||
|
private String propagateAssignedAlarmType; |
||||
|
private String customerAlarmType; |
||||
|
private String assetAlarmType; |
||||
|
private String entityViewAlarmType; |
||||
|
private AssetPageHelper assetPage; |
||||
|
private EntityViewPageHelper entityViewPage; |
||||
|
|
||||
|
@BeforeClass |
||||
|
public void generateTestEntities() { |
||||
|
assetPage = new AssetPageHelper(driver); |
||||
|
entityViewPage = new EntityViewPageHelper(driver); |
||||
|
|
||||
|
customerAlarmType = "Test customer alarm" + random(); |
||||
|
assetAlarmType = "Test asset alarm" + random(); |
||||
|
entityViewAlarmType = "Test entity view alarm" + random(); |
||||
|
propagateAlarmType = "Test propagated alarm " + random(); |
||||
|
propagateAssignedAlarmType = "Test propagated alarm " + random(); |
||||
|
|
||||
|
customerAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(customerId, customerAlarmType)).getId(); |
||||
|
assetId = testRestClient.postAsset(EntityPrototypes.defaultAssetPrototype("Asset", customerId)).getId(); |
||||
|
assetName = testRestClient.getAssetById(assetId).getName(); |
||||
|
assetAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(assetId, assetAlarmType)).getId(); |
||||
|
entityViewId = testRestClient.postEntityView(EntityPrototypes.defaultEntityViewPrototype("Entity view", "", "DEVICE")).getId(); |
||||
|
entityViewName = testRestClient.getEntityViewById(entityViewId).getName(); |
||||
|
entityViewAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(entityViewId, entityViewAlarmType)).getId(); |
||||
|
} |
||||
|
|
||||
|
@BeforeMethod |
||||
|
public void generateTestAlarms() { |
||||
|
propageteAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(deviceId, propagateAlarmType, true)).getId(); |
||||
|
propageteAssigneAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(deviceId, propagateAssignedAlarmType, userId, true)).getId(); |
||||
|
} |
||||
|
|
||||
|
@AfterClass |
||||
|
public void deleteTestEntities() { |
||||
|
deleteAlarmById(customerAlarmId); |
||||
|
deleteAlarmById(assetAlarmId); |
||||
|
deleteAlarmById(entityViewAlarmId); |
||||
|
deleteAssetById(assetId); |
||||
|
deleteEntityView(entityViewId); |
||||
|
} |
||||
|
|
||||
|
@AfterMethod |
||||
|
public void deleteTestAlarms() { |
||||
|
deleteAlarmsByIds(propageteAlarmId, propageteAssigneAlarmId); |
||||
|
} |
||||
|
|
||||
|
@DataProvider |
||||
|
public Object[][] alarms() { |
||||
|
return new Object[][]{ |
||||
|
{alarmType}, |
||||
|
{propagateAlarmType}}; |
||||
|
} |
||||
|
|
||||
|
@DataProvider |
||||
|
public Object[][] assignedAlarms() { |
||||
|
return new Object[][]{ |
||||
|
{assignedAlarmType}, |
||||
|
{propagateAssignedAlarmType}}; |
||||
|
} |
||||
|
|
||||
|
@Description("Can assign alarm to yourself/Can assign propagate alarm to yourself") |
||||
|
@Test(dataProvider = "alarms") |
||||
|
public void assignAlarmToYourself(String alarm) { |
||||
|
sideBarMenuView.goToDevicesPage(); |
||||
|
devicePage.openDeviceAlarms(deviceName); |
||||
|
alarmPage.assignAlarmTo(alarm, Const.TENANT_EMAIL); |
||||
|
|
||||
|
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL)); |
||||
|
} |
||||
|
|
||||
|
@Description("Can assign alarm to another user/Can assign propagate alarm to another user") |
||||
|
@Test(dataProvider = "alarms") |
||||
|
public void assignAlarmToAnotherUser(String alarm) { |
||||
|
sideBarMenuView.goToDevicesPage(); |
||||
|
devicePage.openDeviceAlarms(deviceName); |
||||
|
alarmPage.assignAlarmTo(alarm, userEmail); |
||||
|
|
||||
|
assertIsDisplayed(alarmPage.assignedUser(userEmail)); |
||||
|
} |
||||
|
|
||||
|
@Description("Can unassign alarm/Can unassign propagate alarm") |
||||
|
@Test(dataProvider = "assignedAlarms") |
||||
|
public void unassignedAlarm(String assignedAlarm) { |
||||
|
sideBarMenuView.goToDevicesPage(); |
||||
|
devicePage.openDeviceAlarms(deviceName); |
||||
|
alarmPage.unassignedAlarm(assignedAlarm); |
||||
|
|
||||
|
assertIsDisplayed(alarmPage.unassigned(assignedAlarm)); |
||||
|
} |
||||
|
|
||||
|
@Description("Can reassign alarm to another user/Can reassign propagate alarm to another user") |
||||
|
@Test(dataProvider = "assignedAlarms") |
||||
|
public void reassignAlarm(String assignedAlarm) { |
||||
|
sideBarMenuView.goToDevicesPage(); |
||||
|
devicePage.openDeviceAlarms(deviceName); |
||||
|
alarmPage.assignAlarmTo(assignedAlarm, Const.TENANT_EMAIL); |
||||
|
|
||||
|
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL)); |
||||
|
} |
||||
|
|
||||
|
@Description("Search by email") |
||||
|
@Test |
||||
|
public void searchByEmail() { |
||||
|
sideBarMenuView.goToDevicesPage(); |
||||
|
devicePage.openDeviceAlarms(deviceName); |
||||
|
alarmPage.searchAlarm(alarmType, Const.TENANT_EMAIL); |
||||
|
alarmPage.setUsers(); |
||||
|
|
||||
|
assertThat(alarmPage.getUsers()).hasSize(1).as("Search result contains search input").contains(Const.TENANT_EMAIL); |
||||
|
alarmPage.assignUsers().forEach(this::assertIsDisplayed); |
||||
|
} |
||||
|
|
||||
|
@Description("Search by name") |
||||
|
@Test(groups = "broken") |
||||
|
public void searchByName() { |
||||
|
sideBarMenuView.goToDevicesPage(); |
||||
|
devicePage.openDeviceAlarms(deviceName); |
||||
|
alarmPage.searchAlarm(alarmType, userName); |
||||
|
alarmPage.setUsers(); |
||||
|
|
||||
|
assertThat(alarmPage.getUsers()).hasSize(1).as("Search result contains search input").contains(userName); |
||||
|
alarmPage.assignUsers().forEach(this::assertIsDisplayed); |
||||
|
} |
||||
|
|
||||
|
@Description("Assign alarm to yourself from details of alarm") |
||||
|
@Test |
||||
|
public void assignAlarmToYourselfFromDetails() { |
||||
|
sideBarMenuView.goToDevicesPage(); |
||||
|
devicePage.openDeviceAlarms(deviceName); |
||||
|
alarmPage.alarmDetailsBtn(alarmType).click(); |
||||
|
alarmDetailsView.assignAlarmTo(Const.TENANT_EMAIL); |
||||
|
alarmDetailsView.closeAlarmDetailsViewBtn().click(); |
||||
|
|
||||
|
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL)); |
||||
|
} |
||||
|
|
||||
|
@Description("Assign alarm to another user from details of alarm") |
||||
|
@Test |
||||
|
public void assignAlarmToAnotherUserFromDetails() { |
||||
|
sideBarMenuView.goToDevicesPage(); |
||||
|
devicePage.openDeviceAlarms(deviceName); |
||||
|
alarmPage.alarmDetailsBtn(alarmType).click(); |
||||
|
alarmDetailsView.assignAlarmTo(userEmail); |
||||
|
alarmDetailsView.closeAlarmDetailsViewBtn().click(); |
||||
|
|
||||
|
assertIsDisplayed(alarmPage.assignedUser(userEmail)); |
||||
|
} |
||||
|
|
||||
|
@Description("Unassign alarm from details of alarm") |
||||
|
@Test |
||||
|
public void unassignedAlarmFromDetails() { |
||||
|
sideBarMenuView.goToDevicesPage(); |
||||
|
devicePage.openDeviceAlarms(deviceName); |
||||
|
alarmPage.alarmDetailsBtn(assignedAlarmType).click(); |
||||
|
alarmDetailsView.unassignedAlarm(); |
||||
|
alarmDetailsView.closeAlarmDetailsViewBtn().click(); |
||||
|
|
||||
|
assertIsDisplayed(alarmPage.unassigned(assignedAlarmType)); |
||||
|
} |
||||
|
|
||||
|
@Description("Reassign alarm to another user from details of alarm") |
||||
|
@Test |
||||
|
public void reassignAlarmFromDetails() { |
||||
|
sideBarMenuView.goToDevicesPage(); |
||||
|
devicePage.openDeviceAlarms(deviceName); |
||||
|
alarmPage.alarmDetailsBtn(assignedAlarmType).click(); |
||||
|
alarmDetailsView.assignAlarmTo(Const.TENANT_EMAIL); |
||||
|
alarmDetailsView.closeAlarmDetailsViewBtn().click(); |
||||
|
|
||||
|
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL)); |
||||
|
} |
||||
|
|
||||
|
@Description("Assign alarm to yourself for Customer entity details") |
||||
|
@Test |
||||
|
public void assignCustomerAlarmToYourself() { |
||||
|
sideBarMenuView.customerBtn().click(); |
||||
|
customerPage.openCustomerAlarms(customerTitle); |
||||
|
alarmPage.assignAlarmTo(customerAlarmType, Const.TENANT_EMAIL); |
||||
|
|
||||
|
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL)); |
||||
|
} |
||||
|
|
||||
|
@Description("Assign alarm to yourself for Asset details") |
||||
|
@Test |
||||
|
public void assignAssetAlarmToYourself() { |
||||
|
sideBarMenuView.goToAssetsPage(); |
||||
|
assetPage.openAssetAlarms(assetName); |
||||
|
alarmPage.assignAlarmTo(assetAlarmType, Const.TENANT_EMAIL); |
||||
|
|
||||
|
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL)); |
||||
|
} |
||||
|
|
||||
|
@Description("Assign alarm to yourself for Entity view details") |
||||
|
@Test |
||||
|
public void assignEntityViewsAlarmToYourself() { |
||||
|
sideBarMenuView.goToEntityViewsPage(); |
||||
|
entityViewPage.openEntityViewAlarms(entityViewName); |
||||
|
alarmPage.assignAlarmTo(entityViewAlarmType, Const.TENANT_EMAIL); |
||||
|
|
||||
|
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL)); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,171 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2023 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.assignee; |
||||
|
|
||||
|
import io.qameta.allure.Description; |
||||
|
import io.qameta.allure.Feature; |
||||
|
import org.testng.annotations.AfterMethod; |
||||
|
import org.testng.annotations.BeforeMethod; |
||||
|
import org.testng.annotations.Test; |
||||
|
import org.thingsboard.server.common.data.id.AlarmId; |
||||
|
import org.thingsboard.server.common.data.id.DeviceId; |
||||
|
import org.thingsboard.server.msa.ui.pages.LoginPageHelper; |
||||
|
import org.thingsboard.server.msa.ui.utils.Const; |
||||
|
import org.thingsboard.server.msa.ui.utils.EntityPrototypes; |
||||
|
|
||||
|
import static org.thingsboard.server.msa.ui.base.AbstractBasePage.random; |
||||
|
|
||||
|
@Feature("Assign from details tab of entity (by customer)") |
||||
|
public class AssignDetailsTabFromCustomerAssignTest extends AbstractAssignTest { |
||||
|
|
||||
|
private AlarmId tenantAlarmId; |
||||
|
private DeviceId tenantDeviceId; |
||||
|
private String tenantDeviceName; |
||||
|
private String tenantAlarmType; |
||||
|
private AlarmId assignedTenantAlarmId; |
||||
|
|
||||
|
@BeforeMethod |
||||
|
public void generateTenantEntity() { |
||||
|
if (getJwtTokenFromLocalStorage() == null) { |
||||
|
new LoginPageHelper(driver).authorizationTenant(); |
||||
|
} |
||||
|
tenantAlarmType = "Test tenant alarm " + random(); |
||||
|
|
||||
|
tenantDeviceName = testRestClient.postDevice("", EntityPrototypes.defaultDevicePrototype("")).getName(); |
||||
|
tenantDeviceId = testRestClient.getDeviceByName(tenantDeviceName).getId(); |
||||
|
tenantAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(tenantDeviceId, tenantAlarmType)).getId(); |
||||
|
} |
||||
|
|
||||
|
@AfterMethod |
||||
|
public void deleteTenantEntity() { |
||||
|
deleteAlarmsByIds(tenantAlarmId, assignedTenantAlarmId); |
||||
|
deleteDeviceById(tenantDeviceId); |
||||
|
clearStorage(); |
||||
|
} |
||||
|
|
||||
|
@Description("Can assign alarm to yourself") |
||||
|
@Test |
||||
|
public void assignAlarmToYourselfCustomer() { |
||||
|
loginByUser(userEmail); |
||||
|
sideBarMenuView.goToDevicesPage(); |
||||
|
devicePage.openDeviceAlarms(deviceName); |
||||
|
alarmPage.assignAlarmTo(alarmType, userEmail); |
||||
|
|
||||
|
assertIsDisplayed(alarmPage.assignedUser(userEmail)); |
||||
|
} |
||||
|
|
||||
|
@Description("Can reassign alarm from himself to another customer user") |
||||
|
@Test |
||||
|
public void reassignAlarmByCustomerFromAnotherCustomerUser() { |
||||
|
loginByUser(userWithNameEmail); |
||||
|
sideBarMenuView.goToDevicesPage(); |
||||
|
devicePage.openDeviceAlarms(deviceName); |
||||
|
alarmPage.assignAlarmTo(assignedAlarmType, userName); |
||||
|
|
||||
|
assertIsDisplayed(alarmPage.assignedUser(userName)); |
||||
|
} |
||||
|
|
||||
|
@Description("Can unassign alarm from himself") |
||||
|
@Test |
||||
|
public void unassignedAlarmFromCustomer() { |
||||
|
loginByUser(userEmail); |
||||
|
sideBarMenuView.goToDevicesPage(); |
||||
|
devicePage.openDeviceAlarms(deviceName); |
||||
|
alarmPage.unassignedAlarm(assignedAlarmType); |
||||
|
|
||||
|
assertIsDisplayed(alarmPage.unassigned(assignedAlarmType)); |
||||
|
} |
||||
|
|
||||
|
@Description("Unassign alarm from any other customer user") |
||||
|
@Test |
||||
|
public void unassignedAlarmFromAnotherUserFromCustomer() { |
||||
|
loginByUser(userWithNameEmail); |
||||
|
sideBarMenuView.goToDevicesPage(); |
||||
|
devicePage.openDeviceAlarms(deviceName); |
||||
|
alarmPage.unassignedAlarm(assignedAlarmType); |
||||
|
|
||||
|
assertIsDisplayed(alarmPage.unassigned(assignedAlarmType)); |
||||
|
} |
||||
|
|
||||
|
@Description("Unassign alarm from any tenant user") |
||||
|
@Test |
||||
|
public void unassignedAlarmFromTenant() { |
||||
|
String assignedTenantAlarmType = "Test tenant assigned alarm " + random(); |
||||
|
assignedTenantAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(deviceId, assignedTenantAlarmType)).getId(); |
||||
|
|
||||
|
sideBarMenuView.goToDevicesPage(); |
||||
|
devicePage.openDeviceAlarms(deviceName); |
||||
|
alarmPage.assignAlarmTo(assignedTenantAlarmType, Const.TENANT_EMAIL); |
||||
|
devicePage.closeDeviceDetailsViewBtn().click(); |
||||
|
loginByUser(userWithNameEmail); |
||||
|
sideBarMenuView.goToDevicesPage(); |
||||
|
devicePage.openDeviceAlarms(deviceName); |
||||
|
alarmPage.unassignedAlarm(assignedTenantAlarmType); |
||||
|
|
||||
|
assertIsDisplayed(alarmPage.unassigned(assignedTenantAlarmType)); |
||||
|
} |
||||
|
|
||||
|
@Description("Check the display of names (emails)") |
||||
|
@Test |
||||
|
public void checkTheDisplayOfNamesEmailsFromCustomer() { |
||||
|
sideBarMenuView.goToDevicesPage(); |
||||
|
devicePage.openDeviceAlarms(tenantDeviceName); |
||||
|
alarmPage.assignAlarmTo(tenantAlarmType, Const.TENANT_EMAIL); |
||||
|
devicePage.closeDeviceDetailsViewBtn().click(); |
||||
|
devicePage.assignToCustomerBtn(tenantDeviceName).click(); |
||||
|
devicePage.assignToCustomer(customerTitle); |
||||
|
loginByUser(userEmail); |
||||
|
sideBarMenuView.goToDevicesPage(); |
||||
|
devicePage.openDeviceAlarms(tenantDeviceName); |
||||
|
|
||||
|
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL)); |
||||
|
} |
||||
|
|
||||
|
@Description("Check the reassign tenant for old alarm on device") |
||||
|
@Test |
||||
|
public void reassignTenantForOldAlarm() { |
||||
|
sideBarMenuView.goToDevicesPage(); |
||||
|
devicePage.openDeviceAlarms(tenantDeviceName); |
||||
|
alarmPage.assignAlarmTo(tenantAlarmType, Const.TENANT_EMAIL); |
||||
|
devicePage.closeDeviceDetailsViewBtn().click(); |
||||
|
devicePage.assignToCustomerBtn(tenantDeviceName).click(); |
||||
|
devicePage.assignToCustomer(customerTitle); |
||||
|
loginByUser(userEmail); |
||||
|
sideBarMenuView.goToDevicesPage(); |
||||
|
devicePage.openDeviceAlarms(tenantDeviceName); |
||||
|
jsClick(alarmPage.assignBtn(tenantAlarmType)); |
||||
|
|
||||
|
assertIsDisplayed(alarmPage.accessForbiddenDialogView()); |
||||
|
} |
||||
|
|
||||
|
@Description("Check the reassign tenant for old alarm on device") |
||||
|
@Test |
||||
|
public void reassignTenantForOldAlarmFromDetails() { |
||||
|
sideBarMenuView.goToDevicesPage(); |
||||
|
devicePage.openDeviceAlarms(tenantDeviceName); |
||||
|
alarmPage.assignAlarmTo(tenantAlarmType, Const.TENANT_EMAIL); |
||||
|
devicePage.closeDeviceDetailsViewBtn().click(); |
||||
|
devicePage.assignToCustomerBtn(tenantDeviceName).click(); |
||||
|
devicePage.assignToCustomer(customerTitle); |
||||
|
loginByUser(userEmail); |
||||
|
sideBarMenuView.goToDevicesPage(); |
||||
|
devicePage.openDeviceAlarms(tenantDeviceName); |
||||
|
alarmPage.alarmDetailsBtn(tenantAlarmType).click(); |
||||
|
|
||||
|
|
||||
|
assertIsDisplayed(alarmPage.accessForbiddenDialogView()); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,35 @@ |
|||||
|
<?xml version="1.0" encoding="ISO-8859-1"?> |
||||
|
<!-- |
||||
|
|
||||
|
Copyright © 2016-2023 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="Assignee ui tests"> |
||||
|
<listeners> |
||||
|
<listener class-name="org.thingsboard.server.msa.ui.listeners.RetryTestListener"/> |
||||
|
</listeners> |
||||
|
<test name="Assignee ui tests"> |
||||
|
<groups> |
||||
|
<run> |
||||
|
<exclude name="broken"/> |
||||
|
</run> |
||||
|
</groups> |
||||
|
<packages> |
||||
|
<package name="org.thingsboard.server.msa.ui.tests.assignee.*"/> |
||||
|
</packages> |
||||
|
</test> |
||||
|
</suite> |
||||
Loading…
Reference in new issue