You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by oc...@apache.org on 2021/06/22 23:03:29 UTC
[trafficcontrol] branch master updated: Migrate Delivery Service
test from e2e to integration suite TP (#5929)
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 c16b91b Migrate Delivery Service test from e2e to integration suite TP (#5929)
c16b91b is described below
commit c16b91b598f01b4456bf9720187dfbfb40d67a8a
Author: dpham <ph...@yahoo.com>
AuthorDate: Tue Jun 22 17:03:17 2021 -0600
Migrate Delivery Service test from e2e to integration suite TP (#5929)
* Add base delivery service
* Add test
* Fix attribute and add more test
* Fix and add all test
* add log out function
* Update test
* Retest
* update opearation role
* Update newline
* Revert "update opearation role"
This reverts commit aa9e814ece4db16b21aa2b49ee3dd8eaa4a9df57.
* Maximize browser and add operation
* Add await and close menu tab bug
* Fix pr request change
* change button attribute link
* Retest
Co-authored-by: Pham, Dandy (Contractor) <Da...@comcast.com>
---
.../test/integration/Data/deliveryservices.ts | 496 +++++++++++++++++++++
.../PageObjects/DeliveryServicePage.po.ts | 219 +++++++++
traffic_portal/test/integration/config.ts | 2 +-
.../integration/specs/DeliveryServices.spec.ts | 100 +++++
4 files changed, 816 insertions(+), 1 deletion(-)
diff --git a/traffic_portal/test/integration/Data/deliveryservices.ts b/traffic_portal/test/integration/Data/deliveryservices.ts
new file mode 100644
index 0000000..edac646
--- /dev/null
+++ b/traffic_portal/test/integration/Data/deliveryservices.ts
@@ -0,0 +1,496 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+export const deliveryservices = {
+ cleanup: [
+ {
+ action: "DeleteServers",
+ route: "/servers",
+ method: "delete",
+ data: [
+ {
+ route: "/servers/",
+ getRequest: [
+ {
+ route: "/servers",
+ queryKey: "hostName",
+ queryValue: "DSTest",
+ replace: "route"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ action: "DeletePhysLocations",
+ route: "/phys_locations",
+ method: "delete",
+ data: [
+ {
+ route: "/phys_locations/",
+ getRequest: [
+ {
+ route: "/phys_locations",
+ queryKey: "name",
+ queryValue: "DSTest",
+ replace: "route"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ action: "DeleteRegions",
+ route: "/regions",
+ method: "delete",
+ data: [
+ {
+ route: "/regions?name=DSTest"
+ }
+ ]
+ },
+ {
+ action: "DeleteDivisions",
+ route: "/divisions",
+ method: "delete",
+ data: [
+ {
+ route: "/divisions/",
+ getRequest: [
+ {
+ route: "/divisions",
+ queryKey: "name",
+ queryValue: "DSTest",
+ replace: "route"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ action: "DeleteServerCapabilities",
+ route: "/server_capabilities",
+ method: "delete",
+ data: [
+ {
+ route: "/server_capabilities?name=DSTestCap"
+ }
+ ]
+ },
+ {
+ action: "DeleteDeliveryServices",
+ route: "/deliveryservices",
+ method: "delete",
+ data: [
+ {
+ route: "/deliveryservices/",
+ getRequest: [
+ {
+ route: "/deliveryservices",
+ queryKey: "xmlId",
+ queryValue: "dstestro1",
+ replace: "route"
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ setup: [
+ {
+ action: "CreateDeliveryServices",
+ route: "/deliveryservices",
+ method: "post",
+ data: [
+ {
+ active: true,
+ cdnId: 0,
+ displayName: "DSTestReadOnly",
+ dscp: 0,
+ geoLimit: 0,
+ geoProvider: 0,
+ initialDispersion: 1,
+ ipv6RoutingEnabled: true,
+ logsEnabled: false,
+ missLat: 41.881944,
+ missLong: -87.627778,
+ multiSiteOrigin: false,
+ orgServerFqdn: "http://origin.infra.ciab.test",
+ protocol: 0,
+ qstringIgnore: 0,
+ rangeRequestHandling: 0,
+ regionalGeoBlocking: false,
+ tenantId: 0,
+ typeId: 1,
+ xmlId: "dstestro1",
+ getRequest: [
+ {
+ route: "/tenants",
+ queryKey: "name",
+ queryValue: "tenantSame",
+ replace: "tenantId"
+ },
+ {
+ route: "/cdns",
+ queryKey: "name",
+ queryValue: "dummycdn",
+ replace: "cdnId"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ action: "CreateServerCapabilities",
+ route: "/server_capabilities",
+ method: "post",
+ data: [
+ {
+ name: "DSTestCap"
+ }
+ ]
+ },
+ {
+ action: "CreateDivisions",
+ route: "/divisions",
+ method: "post",
+ data: [
+ {
+ name: "DSTest"
+ }
+ ]
+ },
+ {
+ action: "CreateRegions",
+ route: "/regions",
+ method: "post",
+ data: [
+ {
+ name: "DSTest",
+ division: "4",
+ divisionName: "DSTest",
+ getRequest: [
+ {
+ route: "/divisions",
+ queryKey: "name",
+ queryValue: "DSTest",
+ replace: "division"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ action: "CreatePhysLocation",
+ route: "/phys_locations",
+ method: "post",
+ data: [
+ {
+ address: "Buckingham Palace",
+ city: "London",
+ comments: "Buckingham Palace",
+ email: "steve.kingstone@royal.gsx.gov.uk",
+ name: "DSTest",
+ phone: "0-843-816-6276",
+ poc: "Her Majesty The Queen Elizabeth Alexandra Mary Windsor II",
+ regionId: 3,
+ shortName: "tpphys2",
+ state: "NA",
+ zip: "99999",
+ getRequest: [
+ {
+ route: "/regions",
+ queryKey: "name",
+ queryValue: "DSTest",
+ replace: "regionId"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ action: "CreateServers",
+ route: "/servers",
+ method: "post",
+ data: [
+ {
+ cachegroupId: 0,
+ cdnId: 0,
+ domainName: "test.net",
+ hostName: "DSTest",
+ httpsPort: 443,
+ iloIpAddress: "",
+ iloIpGateway: "",
+ iloIpNetmask: "",
+ iloPassword: "",
+ iloUsername: "",
+ interfaces: [
+ {
+ ipAddresses: [
+ {
+ address: "::1",
+ gateway: "::2",
+ serviceAddress: true
+ }
+ ],
+ maxBandwidth: null,
+ monitor: true,
+ mtu: 1500,
+ name: "eth0"
+ }
+ ],
+ interfaceMtu: 1500,
+ interfaceName: "eth0",
+ ip6Address: "::1",
+ ip6Gateway: "::2",
+ ipAddress: "0.0.0.1",
+ ipGateway: "0.0.0.2",
+ ipNetmask: "255.255.255.0",
+ mgmtIpAddress: "",
+ mgmtIpGateway: "",
+ mgmtIpNetmask: "",
+ offlineReason: "",
+ physLocationId: 0,
+ profileId: 0,
+ routerHostName: "",
+ routerPortName: "",
+ statusId: 3,
+ tcpPort: 80,
+ typeId: 11,
+ updPending: false,
+ getRequest: [
+ {
+ route: "/phys_locations",
+ queryKey: "name",
+ queryValue: "DSTest",
+ replace: "physLocationId"
+ },
+ {
+ route: "/cdns",
+ queryKey: "name",
+ queryValue: "dummycdn",
+ replace: "cdnId"
+ },
+ {
+ route: "/cachegroups",
+ queryKey: "name",
+ queryValue: "testCG",
+ replace: "cachegroupId"
+ },
+ {
+ route: "/profiles",
+ queryKey: "name",
+ queryValue: "testProfile",
+ replace: "profileId"
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ tests: [
+ {
+ logins: [
+ {
+ description: "Admin Role",
+ username: "TPAdmin",
+ password: "pa$$word"
+ }
+ ],
+ add: [
+ {
+ description: "create ANY_MAP delivery service",
+ Name: "tpdservice1",
+ Type: "ANY_MAP",
+ validationMessage: "Delivery Service [ tpdservice1 ] created"
+ },
+ {
+ description: "create DNS delivery service",
+ Name: "tpdservice2",
+ Type: "DNS",
+ validationMessage: "Delivery Service [ tpdservice2 ] created"
+ },
+ {
+ description: "create STEERING delivery service",
+ Name: "tpdservice3",
+ Type: "STEERING",
+ validationMessage: "Delivery Service [ tpdservice3 ] created"
+ }
+ ],
+ update: [
+ {
+ description: "update delivery service display name",
+ Name: "tpdservice1",
+ NewName: "TPServiceNew1",
+ validationMessage: "Delivery Service [ tpdservice1 ] updated"
+ }
+ ],
+ assignserver: [
+ {
+ description: "assign server to delivery service",
+ ServerName: "DSTest",
+ DSName: "TPServiceNew1",
+ validationMessage: "server assignments complete"
+ }
+ ],
+ assignrequiredcapabilities: [
+ {
+ description: "assign required capabilities to delivery service",
+ RCName: "DSTestCap",
+ DSName: "tpdservice2",
+ validationMessage: "deliveryservice.RequiredCapability was created."
+ }
+ ],
+ remove: [
+ {
+ description: "delete a delivery service",
+ Name: "tpdservice1",
+ validationMessage: "Delivery service [ tpdservice1 ] deleted"
+ },
+ {
+ description: "delete a delivery service",
+ Name: "tpdservice2",
+ validationMessage: "Delivery service [ tpdservice2 ] deleted"
+ },
+ {
+ description: "delete a delivery service",
+ Name: "tpdservice3",
+ validationMessage: "Delivery service [ tpdservice3 ] deleted"
+ }
+ ]
+ },
+ {
+ logins: [
+ {
+ description: "Read Only Role",
+ username: "TPReadOnly",
+ password: "pa$$word"
+ }
+ ],
+ add: [
+ {
+ description: "create ANY_MAP delivery service",
+ Name: "tpdservice1",
+ Type: "ANY_MAP",
+ validationMessage: "Forbidden."
+ }
+ ],
+ update: [
+ {
+ description: "update delivery service display name",
+ Name: "dstestro1",
+ NewName: "TPServiceNew1",
+ validationMessage: "Forbidden."
+ }
+ ],
+ assignserver: [
+ {
+ description: "assign server to delivery service",
+ ServerName: "DSTest",
+ DSName: "dstestro1",
+ validationMessage: "Forbidden."
+ }
+ ],
+ assignrequiredcapabilities: [
+ {
+ description: "assign required capabilities to delivery service",
+ RCName: "DSTestCap",
+ DSName: "dstestro1",
+ validationMessage: "Forbidden."
+ }
+ ],
+ remove: [
+ {
+ description: "delete a delivery service",
+ Name: "dstestro1",
+ validationMessage: "Forbidden."
+ }
+ ]
+ },
+ {
+ logins: [
+ {
+ description: "Operation Role",
+ username: "TPOperator",
+ password: "pa$$word"
+ }
+ ],
+ add: [
+ {
+ description: "create ANY_MAP delivery service",
+ Name: "optpdservice1",
+ Type: "ANY_MAP",
+ validationMessage: "Delivery Service [ optpdservice1 ] created"
+ },
+ {
+ description: "create DNS delivery service",
+ Name: "optpdservice2",
+ Type: "DNS",
+ validationMessage: "Delivery Service [ optpdservice2 ] created"
+ },
+ {
+ description: "create STEERING delivery service",
+ Name: "optpdservice3",
+ Type: "STEERING",
+ validationMessage: "Delivery Service [ optpdservice3 ] created"
+ }
+ ],
+ update: [
+ {
+ description: "update delivery service display name",
+ Name: "optpdservice1",
+ NewName: "opTPServiceNew1",
+ validationMessage: "Delivery Service [ optpdservice1 ] updated"
+ }
+ ],
+ assignserver: [
+ {
+ description: "assign server to delivery service",
+ ServerName: "DSTest",
+ DSName: "opTPServiceNew1",
+ validationMessage: "server assignments complete"
+ }
+ ],
+ assignrequiredcapabilities: [
+ {
+ description: "assign required capabilities to delivery service",
+ RCName: "DSTestCap",
+ DSName: "optpdservice2",
+ validationMessage: "deliveryservice.RequiredCapability was created."
+ }
+ ],
+ remove: [
+ {
+ description: "delete a delivery service",
+ Name: "optpdservice1",
+ validationMessage: "Delivery service [ optpdservice1 ] deleted"
+ },
+ {
+ description: "delete a delivery service",
+ Name: "optpdservice2",
+ validationMessage: "Delivery service [ optpdservice2 ] deleted"
+ },
+ {
+ description: "delete a delivery service",
+ Name: "optpdservice3",
+ validationMessage: "Delivery service [ optpdservice3 ] deleted"
+ }
+ ]
+ }
+ ]
+}
diff --git a/traffic_portal/test/integration/PageObjects/DeliveryServicePage.po.ts b/traffic_portal/test/integration/PageObjects/DeliveryServicePage.po.ts
new file mode 100644
index 0000000..2d44d84
--- /dev/null
+++ b/traffic_portal/test/integration/PageObjects/DeliveryServicePage.po.ts
@@ -0,0 +1,219 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+import { BasePage } from './BasePage.po';
+import { randomize } from "../config";
+import { SideNavigationPage } from './SideNavigationPage.po';
+import { by, element } from 'protractor';
+
+interface DeliveryServices {
+ Type: string;
+ Name: string;
+ validationMessage: string;
+}
+interface UpdateDeliveryService {
+ description: string;
+ Name: string;
+ NewName: string;
+ validationMessage: string;
+}
+interface DeleteDeliveryService {
+ Name: string;
+ validationMessage: string;
+}
+interface AssignServer {
+ DSName: string;
+ ServerName: string;
+ validationMessage: string;
+}
+interface AssignRC {
+ RCName: string;
+ DSName: string;
+ validationMessage: string;
+}
+export class DeliveryServicePage extends BasePage {
+ private btnCreateNewDeliveryServices = element(by.linkText("Create Delivery Service"));
+ private mnuFormDropDown = element(by.name('selectFormDropdown'));
+ private btnSubmitFormDropDown = element(by.buttonText('Submit'));
+ private txtSearch = element(by.id("quickSearch"))
+ private txtConfirmName = element(by.name('confirmWithNameInput'));
+ private btnDelete = element(by.buttonText('Delete'));
+ private btnMore = element(by.name('moreBtn'));
+ private mnuManageRequiredServerCapabilities = element(by.linkText('Manage Required Server Capabilities'));
+ private btnAddRequiredServerCapabilities = element(by.name('addCapabilityBtn'));
+ private txtInputRC = element(by.name("selectFormDropdown"));
+ private mnuManageServers = element(by.buttonText('Manage Servers'));
+ private btnAssignServer = element(by.name("selectServersMenuItem"));
+ private txtXmlId = element(by.name('xmlId'));
+ private txtDisplayName = element(by.name('displayName'));
+ private selectActive = element(by.name('active'));
+ private selectType = element(by.id('type'));
+ private selectTenant = element(by.name('tenantId'));
+ private selectCDN = element(by.name('cdn'));
+ private txtOrgServerURL = element(by.name('orgServerFqdn'));
+ private txtProtocol = element(by.name('protocol'));
+ private txtRemapText = element(by.name('remapText'));
+ private btnCreateDeliveryServices = element(by.buttonText('Create'));
+ private randomize = randomize;
+
+ public async OpenDeliveryServicePage() {
+ const snp = new SideNavigationPage();
+ await snp.NavigateToDeliveryServicesPage();
+ }
+
+ public async OpenServicesMenu() {
+ const snp = new SideNavigationPage();
+ await snp.ClickServicesMenu();
+ }
+
+ public async CreateDeliveryService(deliveryservice: DeliveryServices): Promise<boolean> {
+ let result = false;
+ let type: string = deliveryservice.Type;
+ const basePage = new BasePage();
+ if (deliveryservice.validationMessage.includes("created")) {
+ deliveryservice.validationMessage = deliveryservice.validationMessage.replace(deliveryservice.Name, deliveryservice.Name + this.randomize)
+ }
+ await this.btnMore.click();
+ await this.btnCreateNewDeliveryServices.click();
+ await this.mnuFormDropDown.sendKeys(type);
+ await this.btnSubmitFormDropDown.click();
+ switch (type) {
+ case "ANY_MAP": {
+ await this.txtXmlId.sendKeys(deliveryservice.Name + this.randomize);
+ await this.txtDisplayName.sendKeys(deliveryservice.Name + this.randomize);
+ await this.selectActive.sendKeys('Active')
+ await this.selectType.sendKeys('ANY_MAP')
+ await this.selectTenant.sendKeys('- root')
+ await this.selectCDN.sendKeys('dummycdn')
+ await this.txtRemapText.sendKeys('test')
+ break;
+ }
+ case "DNS": {
+ await this.txtXmlId.sendKeys(deliveryservice.Name + this.randomize);
+ await this.txtDisplayName.sendKeys(deliveryservice.Name + this.randomize);
+ await this.selectActive.sendKeys('Active')
+ await this.selectType.sendKeys('DNS')
+ await this.selectTenant.sendKeys('- root')
+ await this.selectCDN.sendKeys('dummycdn')
+ await this.txtOrgServerURL.sendKeys('http://origin.infra.ciab.test');
+ await this.txtProtocol.sendKeys('HTTP')
+ break;
+ }
+ case "HTTP": {
+ await this.txtXmlId.sendKeys(deliveryservice.Name + this.randomize);
+ await this.txtDisplayName.sendKeys(deliveryservice.Name + this.randomize);
+ await this.selectActive.sendKeys('Active')
+ await this.selectType.sendKeys('HTTP')
+ await this.selectTenant.sendKeys('- root')
+ await this.selectCDN.sendKeys('dummycdn')
+ await this.txtOrgServerURL.sendKeys('http://origin.infra.ciab.test');
+ await this.txtProtocol.sendKeys('HTTP')
+ break;
+ }
+ case "STEERING": {
+ await this.txtXmlId.sendKeys(deliveryservice.Name + this.randomize);
+ await this.txtDisplayName.sendKeys(deliveryservice.Name + this.randomize);
+ await this.selectActive.sendKeys('Active')
+ await this.selectType.sendKeys('STEERING')
+ await this.selectTenant.sendKeys('- root')
+ await this.selectCDN.sendKeys('dummycdn')
+ await this.txtProtocol.sendKeys('HTTP')
+ break;
+ }
+ default:
+ {
+ console.log('Wrong Type name');
+ break;
+ }
+ }
+ await this.btnCreateDeliveryServices.click();
+ result = await basePage.GetOutputMessage().then(value => value === deliveryservice.validationMessage);
+ return result;
+ }
+
+ public async SearchDeliveryService(nameDS: string): Promise<boolean> {
+ const name = nameDS + this.randomize;
+ await this.txtSearch.clear();
+ await this.txtSearch.sendKeys(name);
+ const result = await element(by.cssContainingText("span", name)).isPresent();
+ await element(by.cssContainingText("span", name)).click();
+ return !result;
+ }
+
+ public async UpdateDeliveryService(deliveryservice: UpdateDeliveryService): Promise<boolean | undefined> {
+ let result: boolean | undefined = false;
+ const basePage = new BasePage();
+ if (deliveryservice.validationMessage.includes("updated")) {
+ deliveryservice.validationMessage = deliveryservice.validationMessage.replace(deliveryservice.Name, deliveryservice.Name + this.randomize)
+ }
+ switch (deliveryservice.description) {
+ case "update delivery service display name":
+ await this.txtDisplayName.clear();
+ await this.txtDisplayName.sendKeys(deliveryservice.NewName + this.randomize);
+ await basePage.ClickUpdate();
+ break;
+ default:
+ result = undefined;
+ }
+ if (result = !undefined) {
+ result = await basePage.GetOutputMessage().then(value => value === deliveryservice.validationMessage);
+ }
+ return result;
+ }
+
+ public async DeleteDeliveryService(deliveryservice: DeleteDeliveryService): Promise<boolean> {
+ let result = false;
+ const basePage = new BasePage();
+ if (deliveryservice.validationMessage.includes("deleted")) {
+ deliveryservice.validationMessage = deliveryservice.validationMessage.replace(deliveryservice.Name, deliveryservice.Name + this.randomize);
+ }
+ await this.btnDelete.click();
+ await this.txtConfirmName.sendKeys(deliveryservice.Name + this.randomize);
+ await basePage.ClickDeletePermanently();
+ result = await basePage.GetOutputMessage().then(value => value === deliveryservice.validationMessage);
+ return result;
+ }
+
+ public async AssignServerToDeliveryService(deliveryservice: AssignServer): Promise<boolean>{
+ let result = false;
+ const basePage = new BasePage();
+ await this.btnMore.click();
+ await this.mnuManageServers.click();
+ await this.btnMore.click();
+ await this.btnAssignServer.click();
+ await element(by.cssContainingText("td", deliveryservice.ServerName)).click();
+ await this.ClickSubmit();
+ result = await basePage.GetOutputMessage().then(value => value === deliveryservice.validationMessage);
+ return result;
+ }
+
+ public async AssignRequiredCapabilitiesToDS(deliveryservice: AssignRC): Promise<boolean>{
+ let result = false;
+ const basePage = new BasePage();
+ await this.btnMore.click();
+ await this.mnuManageRequiredServerCapabilities.click();
+ await this.btnAddRequiredServerCapabilities.click();
+ await this.txtInputRC.sendKeys(deliveryservice.RCName);
+ await this.ClickSubmit();
+ result = await basePage.GetOutputMessage().then(value => value === deliveryservice.validationMessage);
+ return result;
+ }
+
+
+}
diff --git a/traffic_portal/test/integration/config.ts b/traffic_portal/test/integration/config.ts
index 9d4bec6..96ccc55 100644
--- a/traffic_portal/test/integration/config.ts
+++ b/traffic_portal/test/integration/config.ts
@@ -39,7 +39,7 @@ if (config.capabilities) {
}
config.onPrepare = async function () {
await browser.waitForAngularEnabled(true);
-
+ await browser.driver.manage().window().maximize();
emptyDir('./Reports/', function (err) {
console.log(err);
});
diff --git a/traffic_portal/test/integration/specs/DeliveryServices.spec.ts b/traffic_portal/test/integration/specs/DeliveryServices.spec.ts
new file mode 100644
index 0000000..2ba4a69
--- /dev/null
+++ b/traffic_portal/test/integration/specs/DeliveryServices.spec.ts
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+import { browser } from 'protractor';
+import { LoginPage } from '../PageObjects/LoginPage.po'
+import { DeliveryServicePage } from '../PageObjects/DeliveryServicePage.po';
+import { TopNavigationPage } from '../PageObjects/TopNavigationPage.po';
+import { API } from '../CommonUtils/API';
+import { deliveryservices } from "../Data/deliveryservices";
+
+const api = new API();
+const topNavigation = new TopNavigationPage();
+const loginPage = new LoginPage();
+const deliveryservicesPage = new DeliveryServicePage();
+
+describe('Setup API for delivery service test', function () {
+ it('Setup', async () => {
+ await api.UseAPI(deliveryservices.setup);
+ });
+});
+
+deliveryservices.tests.forEach(async deliveryservicesData => {
+ deliveryservicesData.logins.forEach(login =>{
+ describe(`Traffic Portal - Delivery Service - ${login.description}`, () =>{
+ it('can login', async () => {
+ browser.get(browser.params.baseUrl);
+ await loginPage.Login(login);
+ expect(await loginPage.CheckUserName(login)).toBe(true);
+ });
+ it('can open delivery service page', async () => {
+ await deliveryservicesPage.OpenServicesMenu();
+ await deliveryservicesPage.OpenDeliveryServicePage();
+ });
+ deliveryservicesData.add.forEach(add => {
+ it(add.description, async function () {
+ expect(await deliveryservicesPage.CreateDeliveryService(add)).toBe(true);
+ await deliveryservicesPage.OpenDeliveryServicePage();
+ });
+ });
+ deliveryservicesData.update.forEach(update => {
+ it(update.description, async function () {
+ await deliveryservicesPage.SearchDeliveryService(update.Name);
+ expect(await deliveryservicesPage.UpdateDeliveryService(update)).toBe(true);
+ await deliveryservicesPage.OpenDeliveryServicePage();
+ });
+ })
+ deliveryservicesData.assignserver.forEach(assignserver => {
+ it(assignserver.description, async function(){
+ await deliveryservicesPage.SearchDeliveryService(assignserver.DSName);
+ expect(await deliveryservicesPage.AssignServerToDeliveryService(assignserver)).toBe(true);
+ await deliveryservicesPage.OpenDeliveryServicePage();
+ }
+
+ )
+ })
+ deliveryservicesData.assignrequiredcapabilities.forEach(assignrc => {
+ it(assignrc.description, async function(){
+ await deliveryservicesPage.SearchDeliveryService(assignrc.DSName);
+ expect(await deliveryservicesPage.AssignRequiredCapabilitiesToDS(assignrc)).toBe(true);
+ await deliveryservicesPage.OpenDeliveryServicePage();
+ })
+ })
+ deliveryservicesData.remove.forEach(remove => {
+ it(remove.description, async () => {
+ await deliveryservicesPage.SearchDeliveryService(remove.Name);
+ expect(await deliveryservicesPage.DeleteDeliveryService(remove)).toBe(true);
+ await deliveryservicesPage.OpenDeliveryServicePage();
+ });
+ });
+ it('can close service menu tab', async () => {
+ await deliveryservicesPage.OpenServicesMenu();
+ });
+ it('can logout', async () => {
+ expect(await topNavigation.Logout()).toBe(true);
+ });
+ })
+ })
+
+})
+describe('Clean up API for delivery service test', () => {
+ it('Cleanup', async () => {
+ await api.UseAPI(deliveryservices.cleanup);
+ });
+});