-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add TagsPage * add DeviceTags scenario * Update and rename TagsPage.cs to TagsConfigurationPage.cs * Update and rename DeviceTags.cs to TagsConfiguration.cs --------- Co-authored-by: unknown <yamraniala@T-45GV55J.local.isima.fr> Co-authored-by: Achraf-Git-dev <78796647+Achraf-Git-dev@users.noreply.github.com>
- Loading branch information
1 parent
336f2ec
commit 8823f73
Showing
2 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
src/AzureIoTHub.Portal.Tests.E2E/Pages/TagsConfigurationPage.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright (c) CGI France. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace AzureIoTHub.Portal.Tests.E2E.Pages | ||
{ | ||
using NUnit.Framework; | ||
using OpenQA.Selenium; | ||
using OpenQA.Selenium.Support.UI; | ||
|
||
public class TagsConfigurationPage | ||
{ | ||
public WebDriverWait wait; | ||
|
||
public TagsConfigurationPage() | ||
{ | ||
this.wait = new WebDriverWait(WebDriverFactory.Default, TimeSpan.FromSeconds(5)); | ||
|
||
_ = wait.Until(d => d.FindElement(By.CssSelector(".mud-nav-group:nth-child(5) > .mud-collapse-container .mud-nav-link-text")).Displayed); | ||
WebDriverFactory.Default.FindElement(By.CssSelector(".mud-nav-group:nth-child(5) > .mud-collapse-container .mud-nav-link-text")).Click(); | ||
} | ||
|
||
public void NavigateToTagsPage() | ||
{ | ||
_ = wait.Until(d => d.FindElement(By.CssSelector(".mud-nav-group:nth-child(5) > .mud-collapse-container .mud-nav-link-text")).Displayed); | ||
WebDriverFactory.Default.FindElement(By.CssSelector(".mud-nav-group:nth-child(5) > .mud-collapse-container .mud-nav-link-text")).Click(); | ||
} | ||
|
||
public void AddTag(string name, string label) | ||
{ | ||
_ = wait.Until(d => d.FindElement(By.Id("addTagButton")).Displayed); | ||
WebDriverFactory.Default.FindElement(By.Id("addTagButton")).Click(); | ||
|
||
WebDriverFactory.Default.FindElement(By.CssSelector(".tag- > .mud-table-cell:nth-child(1) .mud-input-slot:nth-child(1)")).Click(); | ||
WebDriverFactory.Default.FindElement(By.CssSelector(".tag- > .mud-table-cell:nth-child(1) .mud-input-slot:nth-child(1)")).SendKeys(name); | ||
|
||
_ = wait.Until(d => d.FindElement(By.CssSelector(".tag- > .mud-table-cell:nth-child(2) .mud-input-slot:nth-child(1)")).Displayed); | ||
WebDriverFactory.Default.FindElement(By.CssSelector(".tag- > .mud-table-cell:nth-child(2) .mud-input-slot:nth-child(1)")).SendKeys(label); | ||
|
||
WebDriverFactory.Default.FindElement(By.CssSelector(".tag-" + name + " #saveButton .mud-icon-root")).Click(); | ||
|
||
_ = wait.Until(d => d.FindElement(By.ClassName("mud-snackbar-content-message")).Displayed); | ||
Assert.That(WebDriverFactory.Default.FindElement(By.ClassName("mud-snackbar-content-message")).Text, Is.EqualTo("Settings have been successfully updated!")); | ||
WebDriverFactory.Default.FindElement(By.CssSelector("button[class='mud-button-root mud-icon-button mud-ripple mud-ripple-icon mud-icon-button-size-small ms-2']")).Click(); | ||
_ = wait.Until(d => !d.FindElement(By.Id("mud-snackbar-container")).Displayed); | ||
} | ||
|
||
public void RemoveTag(string name) | ||
{ | ||
WebDriverFactory.Default.FindElement(By.CssSelector(".tag-" + name + " #deleteButton .mud-icon-root")).Click(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright (c) CGI France. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace AzureIoTHub.Portal.Tests.E2E | ||
{ | ||
using AutoFixture; | ||
using AzureIoTHub.Portal.Tests.E2E.Pages; | ||
using NUnit.Framework; | ||
using NUnit.Framework.Internal; | ||
|
||
public class DeviceTags : E2ETest | ||
{ | ||
private LoginPage loginPage; | ||
|
||
[SetUp] | ||
public void SetUp() | ||
{ | ||
loginPage = new LoginPage(Configuration); | ||
|
||
loginPage.Login(); | ||
} | ||
|
||
[TearDown] | ||
public override void TearDown() | ||
{ | ||
loginPage.Logout(); | ||
|
||
base.TearDown(); | ||
} | ||
|
||
[Test] | ||
public void UserCanAddAndRemoveTagsConfiguration() | ||
{ | ||
var fixture = new Fixture(); | ||
|
||
var tagName = new string( | ||
fixture.CreateMany<char>(4) | ||
.Where(c => char.IsLetterOrDigit(c)) | ||
.ToArray() | ||
); | ||
|
||
var tagLabel = new string( | ||
fixture.CreateMany<char>(4) | ||
.Where(c => char.IsLetterOrDigit(c)) | ||
.ToArray() | ||
); | ||
|
||
var tag = new TagsConfigurationPage(); | ||
|
||
tag.AddTag(tagName, tagLabel); | ||
|
||
tag.RemoveTag(tagName); | ||
} | ||
} | ||
} |