12 changed files with 523 additions and 369 deletions
@ -0,0 +1,44 @@ |
|||
/** |
|||
* 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 CUSTOMER_DETAILS_VIEW = "//tb-details-panel"; |
|||
private static final String CUSTOMER_DETAILS_ALARMS = CUSTOMER_DETAILS_VIEW + "//span[text()='Alarms']"; |
|||
|
|||
public WebElement customerDetailsView() { |
|||
return waitUntilPresenceOfElementLocated(CUSTOMER_DETAILS_VIEW); |
|||
} |
|||
|
|||
public WebElement customerDetailsAlarmsBtn() { |
|||
return waitUntilElementToBeClickable(CUSTOMER_DETAILS_ALARMS); |
|||
} |
|||
|
|||
public void openAssetAlarms(String assetName) { |
|||
if (!customerDetailsView().isDisplayed()) { |
|||
entity(assetName).click(); |
|||
} |
|||
customerDetailsAlarmsBtn().click(); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,45 @@ |
|||
/** |
|||
* 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 EntityViewPage extends OtherPageElementsHelper{ |
|||
public EntityViewPage(WebDriver driver) { |
|||
super(driver); |
|||
} |
|||
|
|||
private static final String CUSTOMER_DETAILS_VIEW = "//tb-details-panel"; |
|||
private static final String CUSTOMER_DETAILS_ALARMS = CUSTOMER_DETAILS_VIEW + "//span[text()='Alarms']"; |
|||
|
|||
public WebElement customerDetailsView() { |
|||
return waitUntilPresenceOfElementLocated(CUSTOMER_DETAILS_VIEW); |
|||
} |
|||
|
|||
public WebElement customerDetailsAlarmsBtn() { |
|||
return waitUntilElementToBeClickable(CUSTOMER_DETAILS_ALARMS); |
|||
} |
|||
|
|||
|
|||
public void openEntityViewAlarms(String customerName) { |
|||
if (!customerDetailsView().isDisplayed()) { |
|||
entity(customerName).click(); |
|||
} |
|||
customerDetailsAlarmsBtn().click(); |
|||
} |
|||
|
|||
} |
|||
@ -1,21 +0,0 @@ |
|||
/** |
|||
* 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 org.thingsboard.server.msa.ui.base.AbstractDriverBaseTest; |
|||
|
|||
abstract public class AbstractAssignByCustomerTest extends AbstractDriverBaseTest { |
|||
} |
|||
@ -1,19 +0,0 @@ |
|||
/** |
|||
* 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; |
|||
|
|||
public class AssignByCustomerTest extends AbstractAssignByCustomerTest{ |
|||
} |
|||
@ -1,235 +0,0 @@ |
|||
/** |
|||
* 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 org.testng.Assert; |
|||
import org.testng.annotations.Test; |
|||
import org.thingsboard.server.msa.ui.pages.AssetPageElements; |
|||
import org.thingsboard.server.msa.ui.utils.Const; |
|||
|
|||
import static org.assertj.core.api.Assertions.assertThat; |
|||
|
|||
public class AssignDetailsTab extends AbstractAssignTest { |
|||
|
|||
@Test(dataProvider = "alarms") |
|||
public void assignAlarmToYourself(String alarm) { |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(deviceName); |
|||
alarmPage.assignAlarmTo(alarm, Const.TENANT_EMAIL); |
|||
|
|||
Assert.assertTrue(alarmPage.assignedUser(Const.TENANT_EMAIL).isDisplayed()); |
|||
} |
|||
|
|||
@Test(dataProvider = "alarms") |
|||
public void assignAlarmToAnotherUser(String alarm) { |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(deviceName); |
|||
alarmPage.assignAlarmTo(alarm, userEmail); |
|||
|
|||
Assert.assertTrue(alarmPage.assignedUser(userEmail).isDisplayed()); |
|||
} |
|||
|
|||
@Test(dataProvider = "assignedAlarms") |
|||
public void unassignedAlarm(String assignedAlarm) { |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(deviceName); |
|||
alarmPage.unassignedAlarm(assignedAlarm); |
|||
|
|||
Assert.assertTrue(alarmPage.unassigned(assignedAlarm).isDisplayed()); |
|||
} |
|||
|
|||
@Test(dataProvider = "assignedAlarms") |
|||
public void reassignAlarm(String assignedAlarm) { |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(deviceName); |
|||
alarmPage.assignAlarmTo(assignedAlarm, Const.TENANT_EMAIL); |
|||
|
|||
Assert.assertTrue(alarmPage.assignedUser(Const.TENANT_EMAIL).isDisplayed()); |
|||
} |
|||
|
|||
@Test |
|||
public void searchByEmail() { |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(deviceName); |
|||
alarmPage.searchAlarm(alarm, Const.TENANT_EMAIL); |
|||
alarmPage.setUsers(); |
|||
|
|||
assertThat(alarmPage.getUsers()).hasSize(1).contains(Const.TENANT_EMAIL); |
|||
alarmPage.assignUsers().forEach(u -> assertThat(u.isDisplayed()).isTrue()); |
|||
} |
|||
|
|||
@Test |
|||
public void searchByName() { |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(deviceName); |
|||
alarmPage.searchAlarm(alarm, name); |
|||
alarmPage.setUsers(); |
|||
|
|||
//assertThat(alarmPage.getUsers()).hasSize(1).contains(name);
|
|||
alarmPage.assignUsers().forEach(u -> assertThat(u.isDisplayed()).isTrue()); |
|||
} |
|||
|
|||
@Test |
|||
public void assignAlarmToYourselfFromDetails() { |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(deviceName); |
|||
alarmPage.alarmDetailsBtn(alarm).click(); |
|||
alarmDetailsView.assignAlarmTo(Const.TENANT_EMAIL); |
|||
alarmDetailsView.closeAlarmDetailsViewBtn().click(); |
|||
|
|||
Assert.assertTrue(alarmPage.assignedUser(Const.TENANT_EMAIL).isDisplayed()); |
|||
} |
|||
|
|||
@Test |
|||
public void assignAlarmToAnotherUserFromDetails() { |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(deviceName); |
|||
alarmPage.alarmDetailsBtn(alarm).click(); |
|||
alarmDetailsView.assignAlarmTo(userEmail); |
|||
alarmDetailsView.closeAlarmDetailsViewBtn().click(); |
|||
|
|||
Assert.assertTrue(alarmPage.assignedUser(userEmail).isDisplayed()); |
|||
} |
|||
|
|||
@Test |
|||
public void unassignedAlarmFromDetails() { |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(deviceName); |
|||
alarmPage.alarmDetailsBtn(assignedAlarm).click(); |
|||
alarmDetailsView.unassignedAlarm(); |
|||
alarmDetailsView.closeAlarmDetailsViewBtn().click(); |
|||
|
|||
Assert.assertTrue(alarmPage.unassigned(assignedAlarm).isDisplayed()); |
|||
} |
|||
|
|||
@Test |
|||
public void reassignAlarmFromDetails() { |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(deviceName); |
|||
alarmPage.alarmDetailsBtn(assignedAlarm).click(); |
|||
alarmDetailsView.assignAlarmTo(Const.TENANT_EMAIL); |
|||
alarmDetailsView.closeAlarmDetailsViewBtn().click(); |
|||
|
|||
Assert.assertTrue(alarmPage.assignedUser(Const.TENANT_EMAIL).isDisplayed()); |
|||
} |
|||
|
|||
@Test |
|||
public void assignAlarmToYourselfCustomer() { |
|||
loginByUser(userEmail); |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(deviceName); |
|||
alarmPage.assignAlarmTo(alarm, userEmail); |
|||
clearStorage(); |
|||
|
|||
Assert.assertTrue(alarmPage.assignedUser(userEmail).isDisplayed()); |
|||
} |
|||
|
|||
@Test |
|||
public void reassignAlarmByCustomerFromAnotherCustomerUser() { |
|||
loginByUser(userWithNameEmail); |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(deviceName); |
|||
alarmPage.assignAlarmTo(assignedAlarm, name); |
|||
clearStorage(); |
|||
|
|||
Assert.assertTrue(alarmPage.assignedUser(name).isDisplayed()); |
|||
} |
|||
|
|||
@Test |
|||
public void unassignedAlarmFromCustomer() { |
|||
loginByUser(userWithNameEmail); |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(deviceName); |
|||
alarmPage.unassignedAlarm(assignedAlarm); |
|||
clearStorage(); |
|||
|
|||
Assert.assertTrue(alarmPage.unassigned(assignedAlarm).isDisplayed()); |
|||
} |
|||
|
|||
@Test |
|||
public void unassignedAlarmFromAnotherUserFromCustomer() { |
|||
loginByUser(userEmail); |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(deviceName); |
|||
alarmPage.unassignedAlarm(assignedAlarm); |
|||
clearStorage(); |
|||
|
|||
Assert.assertTrue(alarmPage.unassigned(assignedAlarm).isDisplayed()); |
|||
} |
|||
|
|||
@Test |
|||
public void checkTheDisplayOfNamesEmailsFromCustomer() { |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(tenantDeviceName); |
|||
alarmPage.assignAlarmTo(tenantAlarm, Const.TENANT_EMAIL); |
|||
devicePage.closeDeviceDetailsViewBtn().click(); |
|||
devicePage.assignToCustomerBtn(tenantDeviceName).click(); |
|||
devicePage.assignToCustomer(customerTitle); |
|||
loginByUser(userEmail); |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(tenantDeviceName); |
|||
|
|||
clearStorage(); |
|||
Assert.assertTrue(alarmPage.assignedUser(Const.TENANT_EMAIL).isDisplayed()); |
|||
} |
|||
|
|||
@Test |
|||
public void reassignTenantForOldAlarm() { |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(tenantDeviceName); |
|||
alarmPage.assignAlarmTo(tenantAlarm, Const.TENANT_EMAIL); |
|||
devicePage.closeDeviceDetailsViewBtn().click(); |
|||
devicePage.assignToCustomerBtn(tenantDeviceName).click(); |
|||
devicePage.assignToCustomer(customerTitle); |
|||
loginByUser(userEmail); |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(tenantDeviceName); |
|||
alarmPage.assignAlarmTo(tenantAlarm, userEmail); |
|||
|
|||
clearStorage(); |
|||
Assert.assertTrue(alarmPage.accessForbiddenDialogView().isDisplayed()); |
|||
} |
|||
|
|||
@Test |
|||
public void assignCustomerAlarmToYourself() { |
|||
sideBarMenuView.customerBtn().click(); |
|||
customerPage.openCustomerAlarms(customerTitle); |
|||
alarmPage.assignAlarmTo(customerAlarm, userEmail); |
|||
|
|||
Assert.assertTrue(alarmPage.assignedUser(userEmail).isDisplayed()); |
|||
} |
|||
|
|||
@Test |
|||
public void assignAssetAlarmToYourself() { |
|||
AssetPageElements assetPageElements = new AssetPageElements(driver); |
|||
sideBarMenuView.goToAssetsPage(); |
|||
assetPageElements.openAssetAlarms(customerTitle); |
|||
alarmPage.assignAlarmTo(assetAlarm, userEmail); |
|||
|
|||
Assert.assertTrue(alarmPage.assignedUser(userEmail).isDisplayed()); |
|||
} |
|||
|
|||
@Test |
|||
public void assignEntityViewsAlarmToYourself() { |
|||
AssetPageElements assetPageElements = new AssetPageElements(driver); |
|||
sideBarMenuView.goToEntityViewsPage(); |
|||
assetPageElements.openAssetAlarms(entityViewName); |
|||
alarmPage.assignAlarmTo(entityViewAlarm, userEmail); |
|||
|
|||
Assert.assertTrue(alarmPage.assignedUser(userEmail).isDisplayed()); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,229 @@ |
|||
/** |
|||
* 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 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.AssetPageElements; |
|||
import org.thingsboard.server.msa.ui.pages.EntityViewPage; |
|||
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; |
|||
|
|||
public class AssignDetailsTabAssignTest extends AbstractAssignTest { |
|||
|
|||
private AlarmId propageteAlarmId; |
|||
private AlarmId propageteAssigneAlarmId; |
|||
private AlarmId customerAlarmId; |
|||
private AlarmId assetAlarmId; |
|||
private AlarmId entityViewAlarmId; |
|||
private String assetName; |
|||
private String entityViewName; |
|||
private final String propagateAlarm = "Test propagated alarm 1 " + random(); |
|||
private final String propagateAssignedAlarm = "Test propagated alarm 2 " + random(); |
|||
private final String customerAlarm = "Test customer alarm" + random(); |
|||
private final String assetAlarm = "Test asset alarm" + random(); |
|||
private final String entityViewAlarm = "Test entity view alarm" + random(); |
|||
private AssetId assetId; |
|||
private EntityViewId entityViewId; |
|||
|
|||
@BeforeClass |
|||
public void generateTestEntities() { |
|||
customerAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(customerId, customerAlarm)).getId(); |
|||
assetId = testRestClient.postAsset(EntityPrototypes.defaultAssetPrototype("", customerId)).getId(); |
|||
assetName = testRestClient.getAssetById(assetId).getName(); |
|||
assetAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(assetId, assetAlarm)).getId(); |
|||
entityViewId = testRestClient.postEntityView(EntityPrototypes.defaultEntityViewPrototype("", "", "DEVICE")).getId(); |
|||
entityViewName = testRestClient.getEntityViewById(entityViewId).getName(); |
|||
entityViewAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(entityViewId, entityViewAlarm)).getId(); |
|||
} |
|||
|
|||
@BeforeMethod |
|||
public void generateTestAlarms() { |
|||
propageteAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(deviceId, propagateAlarm, true)).getId(); |
|||
propageteAssigneAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(deviceId, propagateAssignedAlarm, userId, true)).getId(); |
|||
} |
|||
|
|||
@AfterClass |
|||
public void deleteTestEntities() { |
|||
testRestClient.deleteAlarm(customerAlarmId); |
|||
testRestClient.deleteAlarm(assetAlarmId); |
|||
testRestClient.deleteAlarm(entityViewAlarmId); |
|||
testRestClient.deleteAsset(assetId); |
|||
testRestClient.deleteEntityView(entityViewId); |
|||
} |
|||
|
|||
@AfterMethod |
|||
public void deleteTestAlarms() { |
|||
testRestClient.deleteAlarm(propageteAlarmId); |
|||
testRestClient.deleteAlarm(propageteAssigneAlarmId); |
|||
} |
|||
|
|||
@DataProvider |
|||
public Object[][] alarms() { |
|||
return new Object[][]{ |
|||
{alarm}, |
|||
{propagateAlarm}}; |
|||
} |
|||
|
|||
@DataProvider |
|||
public Object[][] assignedAlarms() { |
|||
return new Object[][]{ |
|||
{assignedAlarm}, |
|||
{propagateAssignedAlarm}}; |
|||
} |
|||
|
|||
@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)); |
|||
} |
|||
|
|||
@Test(dataProvider = "alarms") |
|||
public void assignAlarmToAnotherUser(String alarm) { |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(deviceName); |
|||
alarmPage.assignAlarmTo(alarm, userEmail); |
|||
|
|||
assertIsDisplayed(alarmPage.assignedUser(userEmail)); |
|||
} |
|||
|
|||
@Test(dataProvider = "assignedAlarms") |
|||
public void unassignedAlarm(String assignedAlarm) { |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(deviceName); |
|||
alarmPage.unassignedAlarm(assignedAlarm); |
|||
|
|||
assertIsDisplayed(alarmPage.unassigned(assignedAlarm)); |
|||
} |
|||
|
|||
@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)); |
|||
} |
|||
|
|||
@Test |
|||
public void searchByEmail() { |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(deviceName); |
|||
alarmPage.searchAlarm(alarm, 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); |
|||
} |
|||
|
|||
@Test(groups = "broken") |
|||
public void searchByName() { |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(deviceName); |
|||
alarmPage.searchAlarm(alarm, userName); |
|||
alarmPage.setUsers(); |
|||
|
|||
assertThat(alarmPage.getUsers()).hasSize(1).as("Search result contains search input").contains(userName); |
|||
alarmPage.assignUsers().forEach(this::assertIsDisplayed); |
|||
} |
|||
|
|||
@Test |
|||
public void assignAlarmToYourselfFromDetails() { |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(deviceName); |
|||
alarmPage.alarmDetailsBtn(alarm).click(); |
|||
alarmDetailsView.assignAlarmTo(Const.TENANT_EMAIL); |
|||
alarmDetailsView.closeAlarmDetailsViewBtn().click(); |
|||
|
|||
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL)); |
|||
} |
|||
|
|||
@Test |
|||
public void assignAlarmToAnotherUserFromDetails() { |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(deviceName); |
|||
alarmPage.alarmDetailsBtn(alarm).click(); |
|||
alarmDetailsView.assignAlarmTo(userEmail); |
|||
alarmDetailsView.closeAlarmDetailsViewBtn().click(); |
|||
|
|||
assertIsDisplayed(alarmPage.assignedUser(userEmail)); |
|||
} |
|||
|
|||
@Test |
|||
public void unassignedAlarmFromDetails() { |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(deviceName); |
|||
alarmPage.alarmDetailsBtn(assignedAlarm).click(); |
|||
alarmDetailsView.unassignedAlarm(); |
|||
alarmDetailsView.closeAlarmDetailsViewBtn().click(); |
|||
|
|||
assertIsDisplayed(alarmPage.unassigned(assignedAlarm)); |
|||
} |
|||
|
|||
@Test |
|||
public void reassignAlarmFromDetails() { |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(deviceName); |
|||
alarmPage.alarmDetailsBtn(assignedAlarm).click(); |
|||
alarmDetailsView.assignAlarmTo(Const.TENANT_EMAIL); |
|||
alarmDetailsView.closeAlarmDetailsViewBtn().click(); |
|||
|
|||
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL)); |
|||
} |
|||
|
|||
@Test |
|||
public void assignCustomerAlarmToYourself() { |
|||
sideBarMenuView.customerBtn().click(); |
|||
customerPage.openCustomerAlarms(customerTitle); |
|||
alarmPage.assignAlarmTo(customerAlarm, Const.TENANT_EMAIL); |
|||
|
|||
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL)); |
|||
} |
|||
|
|||
@Test |
|||
public void assignAssetAlarmToYourself() { |
|||
AssetPageElements assetPageElements = new AssetPageElements(driver); |
|||
sideBarMenuView.goToAssetsPage(); |
|||
assetPageElements.openAssetAlarms(assetName); |
|||
alarmPage.assignAlarmTo(assetAlarm, Const.TENANT_EMAIL); |
|||
|
|||
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL)); |
|||
} |
|||
|
|||
@Test |
|||
public void assignEntityViewsAlarmToYourself() { |
|||
EntityViewPage entityViewPage = new EntityViewPage(driver); |
|||
sideBarMenuView.goToEntityViewsPage(); |
|||
entityViewPage.openEntityViewAlarms(entityViewName); |
|||
alarmPage.assignAlarmTo(entityViewAlarm, Const.TENANT_EMAIL); |
|||
|
|||
assertIsDisplayed(alarmPage.assignedUser(Const.TENANT_EMAIL)); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,129 @@ |
|||
/** |
|||
* 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 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; |
|||
|
|||
public class AssignDetailsTabFromCustomerAssignTest extends AbstractAssignTest { |
|||
|
|||
AlarmId tenantAlarmId; |
|||
DeviceId tenantDeviceId; |
|||
String tenantDeviceName; |
|||
String tenantAlarm = "Test tenant alarm " + random(); |
|||
|
|||
public void loginByUser(String userEmail) { |
|||
sideBarMenuView.customerBtn().click(); |
|||
customerPage.manageCustomersUserBtn(customerTitle).click(); |
|||
customerPage.getUserLoginBtnByEmail(userEmail).click(); |
|||
} |
|||
|
|||
@BeforeMethod |
|||
public void generateTenantEntity() { |
|||
if (getJwtTokenFromLocalStorage() == null) { |
|||
new LoginPageHelper(driver).authorizationTenant(); |
|||
} |
|||
tenantDeviceName = testRestClient.postDevice("", EntityPrototypes.defaultDevicePrototype("")).getName(); |
|||
tenantDeviceId = testRestClient.getDeviceByName(tenantDeviceName).getId(); |
|||
tenantAlarmId = testRestClient.postAlarm(EntityPrototypes.defaultAlarm(tenantDeviceId, tenantAlarm)).getId(); |
|||
} |
|||
|
|||
@AfterMethod |
|||
public void clear() { |
|||
testRestClient.deleteAlarm(tenantAlarmId); |
|||
testRestClient.deleteDevice(tenantDeviceId); |
|||
clearStorage(); |
|||
} |
|||
|
|||
@Test |
|||
public void assignAlarmToYourselfCustomer() { |
|||
loginByUser(userEmail); |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(deviceName); |
|||
alarmPage.assignAlarmTo(alarm, userEmail); |
|||
|
|||
assertIsDisplayed(alarmPage.assignedUser(userEmail)); |
|||
} |
|||
|
|||
@Test |
|||
public void reassignAlarmByCustomerFromAnotherCustomerUser() { |
|||
loginByUser(userWithNameEmail); |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(deviceName); |
|||
alarmPage.assignAlarmTo(assignedAlarm, userName); |
|||
|
|||
assertIsDisplayed(alarmPage.assignedUser(userName)); |
|||
} |
|||
|
|||
@Test |
|||
public void unassignedAlarmFromCustomer() { |
|||
loginByUser(userWithNameEmail); |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(deviceName); |
|||
alarmPage.unassignedAlarm(assignedAlarm); |
|||
|
|||
assertIsDisplayed(alarmPage.unassigned(assignedAlarm)); |
|||
} |
|||
|
|||
@Test |
|||
public void unassignedAlarmFromAnotherUserFromCustomer() { |
|||
loginByUser(userEmail); |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(deviceName); |
|||
alarmPage.unassignedAlarm(assignedAlarm); |
|||
|
|||
assertIsDisplayed(alarmPage.unassigned(assignedAlarm)); |
|||
} |
|||
|
|||
@Test |
|||
public void checkTheDisplayOfNamesEmailsFromCustomer() { |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(tenantDeviceName); |
|||
alarmPage.assignAlarmTo(tenantAlarm, 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)); |
|||
} |
|||
|
|||
@Test |
|||
public void reassignTenantForOldAlarm() { |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(tenantDeviceName); |
|||
alarmPage.assignAlarmTo(tenantAlarm, Const.TENANT_EMAIL); |
|||
devicePage.closeDeviceDetailsViewBtn().click(); |
|||
devicePage.assignToCustomerBtn(tenantDeviceName).click(); |
|||
devicePage.assignToCustomer(customerTitle); |
|||
loginByUser(userEmail); |
|||
sideBarMenuView.goToDevicesPage(); |
|||
devicePage.openDeviceAlarms(tenantDeviceName); |
|||
alarmPage.assignBtn(tenantAlarm).click(); |
|||
|
|||
assertIsDisplayed(alarmPage.accessForbiddenDialogView()); |
|||
} |
|||
} |
|||
@ -0,0 +1,36 @@ |
|||
<?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="Customer Smoke Tests"> |
|||
<listeners> |
|||
<listener class-name="org.thingsboard.server.msa.ui.listeners.RetryTestListener"/> |
|||
</listeners> |
|||
<test name="Customer ui smoke tests"> |
|||
<groups> |
|||
<run> |
|||
<exclude name="broken"/> |
|||
</run> |
|||
</groups> |
|||
<classes> |
|||
<class name="org.thingsboard.server.msa.ui.tests.assignee.AssignDetailsTabAssignTest"/> |
|||
<class name="org.thingsboard.server.msa.ui.tests.assignee.AssignDetailsTabFromCustomerAssignTest"/> |
|||
</classes> |
|||
</test> |
|||
</suite> |
|||
Loading…
Reference in new issue