9 changed files with 355 additions and 1 deletions
@ -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.tests.devicessmoke; |
||||
|
|
||||
|
import io.qameta.allure.Epic; |
||||
|
import org.testng.annotations.AfterMethod; |
||||
|
import org.testng.annotations.BeforeClass; |
||||
|
import org.thingsboard.server.msa.ui.base.AbstractDriverBaseTest; |
||||
|
import org.thingsboard.server.msa.ui.pages.DevicePageHelper; |
||||
|
import org.thingsboard.server.msa.ui.pages.LoginPageHelper; |
||||
|
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewElements; |
||||
|
|
||||
|
@Epic("Device smoke tests") |
||||
|
abstract public class AbstractDeviceTest extends AbstractDriverBaseTest { |
||||
|
|
||||
|
protected SideBarMenuViewElements sideBarMenuView; |
||||
|
protected DevicePageHelper devicePage; |
||||
|
protected String deviceName; |
||||
|
|
||||
|
@BeforeClass |
||||
|
public void login() { |
||||
|
new LoginPageHelper(driver).authorizationTenant(); |
||||
|
sideBarMenuView = new SideBarMenuViewElements(driver); |
||||
|
devicePage = new DevicePageHelper(driver); |
||||
|
} |
||||
|
|
||||
|
@AfterMethod |
||||
|
public void delete() { |
||||
|
deleteDeviceByName(deviceName); |
||||
|
deviceName = null; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,132 @@ |
|||||
|
/** |
||||
|
* 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.devicessmoke; |
||||
|
|
||||
|
import io.qameta.allure.Description; |
||||
|
import io.qameta.allure.Feature; |
||||
|
import org.testng.annotations.Test; |
||||
|
import org.thingsboard.server.common.data.Device; |
||||
|
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; |
||||
|
import static org.thingsboard.server.msa.ui.utils.Const.EMPTY_DEVICE_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_MESSAGE; |
||||
|
|
||||
|
@Feature("Create device") |
||||
|
public class CreateDeviceTest extends AbstractDeviceTest { |
||||
|
|
||||
|
@Test(groups = "smoke") |
||||
|
@Description("Add device after specifying the name (text/numbers /special characters)") |
||||
|
public void createDevice() { |
||||
|
deviceName = ENTITY_NAME + random(); |
||||
|
|
||||
|
sideBarMenuView.devicesBtn().click(); |
||||
|
devicePage.openCreateDeviceView(); |
||||
|
devicePage.enterName(deviceName); |
||||
|
devicePage.addBtnC().click(); |
||||
|
devicePage.refreshBtn().click(); |
||||
|
|
||||
|
assertIsDisplayed(devicePage.entity(deviceName)); |
||||
|
} |
||||
|
|
||||
|
@Test(groups = "smoke") |
||||
|
@Description("Add device after specifying the name and description (text/numbers /special characters)") |
||||
|
public void createDeviceWithDescription() { |
||||
|
deviceName = ENTITY_NAME + random(); |
||||
|
|
||||
|
sideBarMenuView.devicesBtn().click(); |
||||
|
devicePage.openCreateDeviceView(); |
||||
|
devicePage.enterName(deviceName); |
||||
|
devicePage.enterDescription(deviceName); |
||||
|
devicePage.addBtnC().click(); |
||||
|
devicePage.refreshBtn().click(); |
||||
|
devicePage.entity(deviceName).click(); |
||||
|
devicePage.setHeaderName(); |
||||
|
|
||||
|
assertThat(devicePage.getHeaderName()).as("Header of device details tab").isEqualTo(deviceName); |
||||
|
assertThat(devicePage.descriptionEntityView().getAttribute("value")) |
||||
|
.as("Description in device details tab").isEqualTo(deviceName); |
||||
|
} |
||||
|
|
||||
|
@Test(groups = "smoke") |
||||
|
@Description("Add device without the name") |
||||
|
public void createDeviceWithoutName() { |
||||
|
sideBarMenuView.devicesBtn().click(); |
||||
|
devicePage.openCreateDeviceView(); |
||||
|
devicePage.nameField().click(); |
||||
|
devicePage.addBtnC().click(); |
||||
|
|
||||
|
assertIsDisplayed(devicePage.addDeviceView()); |
||||
|
assertThat(devicePage.errorMessage().getText()).as("Text of warning message").isEqualTo(NAME_IS_REQUIRED_MESSAGE); |
||||
|
} |
||||
|
|
||||
|
@Test(groups = "smoke") |
||||
|
@Description("Create device only with spase in name") |
||||
|
public void createDeviceWithOnlySpace() { |
||||
|
sideBarMenuView.devicesBtn().click(); |
||||
|
devicePage.openCreateDeviceView(); |
||||
|
devicePage.enterName(" "); |
||||
|
devicePage.addBtnC().click(); |
||||
|
|
||||
|
assertIsDisplayed(devicePage.warningMessage()); |
||||
|
assertThat(devicePage.warningMessage().getText()).as("Text of warning message").isEqualTo(EMPTY_DEVICE_MESSAGE); |
||||
|
assertIsDisplayed(devicePage.addDeviceView()); |
||||
|
} |
||||
|
|
||||
|
@Test(priority = 20, groups = "smoke") |
||||
|
@Description("Create a device with the same name") |
||||
|
public void createRuleChainWithSameName() { |
||||
|
Device device = testRestClient.postDevice("", EntityPrototypes.defaultDevicePrototype(ENTITY_NAME)); |
||||
|
deviceName = device.getName(); |
||||
|
|
||||
|
sideBarMenuView.devicesBtn().click(); |
||||
|
devicePage.openCreateDeviceView(); |
||||
|
devicePage.enterName(deviceName); |
||||
|
devicePage.addBtnC().click(); |
||||
|
|
||||
|
assertIsDisplayed(devicePage.warningMessage()); |
||||
|
assertThat(devicePage.warningMessage().getText()).as("Text of warning message").isEqualTo(SAME_NAME_WARNING_DEVICE_MESSAGE); |
||||
|
assertIsDisplayed(devicePage.addDeviceView()); |
||||
|
} |
||||
|
|
||||
|
@Test(priority = 30, groups = "smoke") |
||||
|
@Description("Add device after specifying the name (text/numbers /special characters) without refresh") |
||||
|
public void createDeviceWithoutRefresh() { |
||||
|
deviceName = ENTITY_NAME + random(); |
||||
|
|
||||
|
sideBarMenuView.devicesBtn().click(); |
||||
|
devicePage.openCreateDeviceView(); |
||||
|
devicePage.enterName(deviceName); |
||||
|
devicePage.addBtnC().click(); |
||||
|
|
||||
|
assertIsDisplayed(devicePage.entity(deviceName)); |
||||
|
} |
||||
|
|
||||
|
@Test(priority = 40, groups = "smoke") |
||||
|
@Description("Go to devices documentation page") |
||||
|
public void documentation() { |
||||
|
String urlPath = "docs/user-guide/ui/devices/"; |
||||
|
|
||||
|
sideBarMenuView.devicesBtn().click(); |
||||
|
devicePage.entity("Thermostat T1").click(); |
||||
|
devicePage.goToHelpPage(); |
||||
|
|
||||
|
assertThat(urlContains(urlPath)).as("Redirected URL contains " + urlPath).isTrue(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,59 @@ |
|||||
|
/** |
||||
|
* 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.devicessmoke; |
||||
|
|
||||
|
import io.qameta.allure.Feature; |
||||
|
import org.testng.annotations.BeforeMethod; |
||||
|
import org.testng.annotations.Test; |
||||
|
import org.thingsboard.server.common.data.Device; |
||||
|
import org.thingsboard.server.msa.ui.utils.EntityPrototypes; |
||||
|
|
||||
|
import static org.thingsboard.server.msa.ui.utils.Const.ENTITY_NAME; |
||||
|
|
||||
|
@Feature("Delete device") |
||||
|
public class DeleteDeviceTest extends AbstractDeviceTest { |
||||
|
|
||||
|
@BeforeMethod |
||||
|
public void createDevice() { |
||||
|
Device device = testRestClient.postDevice("", EntityPrototypes.defaultDevicePrototype(ENTITY_NAME)); |
||||
|
deviceName = device.getName(); |
||||
|
} |
||||
|
|
||||
|
@Test(groups = "smoke") |
||||
|
public void deleteDeviceByRightSideBtn() { |
||||
|
sideBarMenuView.devicesBtn().click(); |
||||
|
devicePage.deleteDeviceByRightSideBtn(deviceName); |
||||
|
|
||||
|
devicePage.assertEntityIsNotPresent(deviceName); |
||||
|
} |
||||
|
|
||||
|
@Test(groups = "smoke") |
||||
|
public void deleteSelectedDevice() { |
||||
|
sideBarMenuView.devicesBtn().click(); |
||||
|
devicePage.deleteSelected(deviceName); |
||||
|
|
||||
|
devicePage.assertEntityIsNotPresent(deviceName); |
||||
|
} |
||||
|
|
||||
|
@Test(groups = "smoke") |
||||
|
public void deleteDeviceFromDetailsTab() { |
||||
|
sideBarMenuView.devicesBtn().click(); |
||||
|
devicePage.entity(deviceName).click(); |
||||
|
devicePage.deleteDeviceFromDetailsTab(); |
||||
|
|
||||
|
devicePage.assertEntityIsNotPresent(deviceName); |
||||
|
} |
||||
|
} |
||||
@ -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="Devices Smoke Tests"> |
||||
|
<listeners> |
||||
|
<listener class-name="org.thingsboard.server.msa.ui.listeners.RetryTestListener"/> |
||||
|
</listeners> |
||||
|
<test name="Devices ui smoke tests"> |
||||
|
<groups> |
||||
|
<run> |
||||
|
<exclude name="broken"/> |
||||
|
</run> |
||||
|
</groups> |
||||
|
<packages> |
||||
|
<package name="org.thingsboard.server.msa.ui.tests.devicessmoke"/> |
||||
|
</packages> |
||||
|
</test> |
||||
|
</suite> |
||||
Loading…
Reference in new issue