This is an automated email from the ASF dual-hosted git repository.
ocket8888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
The following commit(s) were added to refs/heads/master by this push:
new c6ae1ef Add Regions test (#6083)
c6ae1ef is described below
commit c6ae1ef2474fff6a28fed1573846d4308302a319
Author: dpham <[email protected]>
AuthorDate: Wed Aug 11 08:38:20 2021 -0600
Add Regions test (#6083)
Co-authored-by: Pham, Dandy (Contractor) <[email protected]>
---
traffic_portal/test/integration/Data/regions.ts | 18 ++++++++++++++++++
.../test/integration/PageObjects/RegionsPage.po.ts | 16 ++++++++++------
traffic_portal/test/integration/specs/Regions.spec.ts | 7 ++++++-
3 files changed, 34 insertions(+), 7 deletions(-)
diff --git a/traffic_portal/test/integration/Data/regions.ts
b/traffic_portal/test/integration/Data/regions.ts
index 108c727..581e90a 100644
--- a/traffic_portal/test/integration/Data/regions.ts
+++ b/traffic_portal/test/integration/Data/regions.ts
@@ -72,6 +72,12 @@ export const regions = {
password: "pa$$word"
}
],
+ check: [
+ {
+ description: "check CSV link from
Regions page",
+ Name: "Export as CSV"
+ }
+ ],
add: [
{
description: "create a Regions",
@@ -110,6 +116,12 @@ export const regions = {
password: "pa$$word"
}
],
+ check: [
+ {
+ description: "check CSV link from
Regions page",
+ Name: "Export as CSV"
+ }
+ ],
add: [
{
description: "create a Regions",
@@ -142,6 +154,12 @@ export const regions = {
password: "pa$$word"
}
],
+ check: [
+ {
+ description: "check CSV link from
Regions page",
+ Name: "Export as CSV"
+ }
+ ],
add: [
{
description: "create a Regions",
diff --git a/traffic_portal/test/integration/PageObjects/RegionsPage.po.ts
b/traffic_portal/test/integration/PageObjects/RegionsPage.po.ts
index ac3bfa9..81c835b 100644
--- a/traffic_portal/test/integration/PageObjects/RegionsPage.po.ts
+++ b/traffic_portal/test/integration/PageObjects/RegionsPage.po.ts
@@ -44,20 +44,20 @@ export class RegionsPage extends BasePage {
private txtSearch =
element(by.id('regionsTable_filter')).element(by.css('label input'));
private txtName = element(by.id('name'));
private txtDivision = element(by.name('division'));
- private btnDelete = element(by.xpath("//button[text()='Delete']"));
+ private btnDelete = element(by.buttonText('Delete'));
private txtConfirmName = element(by.name('confirmWithNameInput'));
private randomize = randomize;
- async OpenRegionsPage(){
+ public async OpenRegionsPage(){
let snp = new SideNavigationPage();
await snp.NavigateToRegionsPage();
}
- async OpenTopologyMenu(){
+ public async OpenTopologyMenu(){
let snp = new SideNavigationPage();
await snp.ClickTopologyMenu();
}
- async CreateRegions(regions: CreateRegion): Promise<boolean> {
+ public async CreateRegions(regions: CreateRegion): Promise<boolean> {
let result = false;
let basePage = new BasePage();
let snp = new SideNavigationPage();
@@ -89,7 +89,7 @@ export class RegionsPage extends BasePage {
return false;
}
- public async UpdateRegions(regions: UpdateRegion): Promise<boolean |
undefined> {
+ public async UpdateRegions(regions: UpdateRegion): Promise<boolean> {
let basePage = new BasePage();
switch(regions.description){
case "update Region's Division":
@@ -97,7 +97,7 @@ export class RegionsPage extends BasePage {
await basePage.ClickUpdate();
break;
default:
- return undefined;
+ return false;
}
return await basePage.GetOutputMessage().then(value =>
regions.validationMessage === value);
}
@@ -118,4 +118,8 @@ export class RegionsPage extends BasePage {
})
return result;
}
+
+ public async CheckCSV(name: string): Promise<boolean> {
+ return element(by.cssContainingText("span", name)).isPresent();
+ }
}
diff --git a/traffic_portal/test/integration/specs/Regions.spec.ts
b/traffic_portal/test/integration/specs/Regions.spec.ts
index 5f1ea3e..4380c7a 100644
--- a/traffic_portal/test/integration/specs/Regions.spec.ts
+++ b/traffic_portal/test/integration/specs/Regions.spec.ts
@@ -47,7 +47,12 @@ regions.tests.forEach(async regionsData => {
await regionsPage.OpenTopologyMenu();
await regionsPage.OpenRegionsPage();
});
-
+ regionsData.check.forEach(check => {
+ it(check.description, async () => {
+ expect(await regionsPage.CheckCSV(check.Name)).toBe(true);
+ await regionsPage.OpenRegionsPage();
+ });
+ });
regionsData.add.forEach(add => {
it(add.description, async () => {
expect(await regionsPage.CreateRegions(add)).toBeTruthy();