Skip to content

Commit

Permalink
reformat code + add case undefined update cache group
Browse files Browse the repository at this point in the history
  • Loading branch information
ntheanh201 committed Oct 25, 2023
1 parent 463ea85 commit 639b3e6
Showing 1 changed file with 40 additions and 14 deletions.
54 changes: 40 additions & 14 deletions traffic_portal/test/integration/specs/CacheGroup.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,18 @@
* specific language governing permissions and limitations
* under the License.
*/
import {browser} from 'protractor';

import {LoginPage} from '../PageObjects/LoginPage.po'
import {CacheGroupPage} from '../PageObjects/CacheGroup.po';
import {TopNavigationPage} from '../PageObjects/TopNavigationPage.po';
import {cachegroups} from "../Data";
import { browser } from "protractor";

import { LoginPage } from "../PageObjects/LoginPage.po";
import { CacheGroupPage } from "../PageObjects/CacheGroup.po";
import { TopNavigationPage } from "../PageObjects/TopNavigationPage.po";
import { cachegroups } from "../Data";

let loginPage = new LoginPage();
let topNavigation = new TopNavigationPage();
let cacheGroupPage = new CacheGroupPage();

cachegroups.tests.forEach(cacheGroupData => {
cachegroups.tests.forEach((cacheGroupData) => {
for (const login of cacheGroupData.logins) {
describe(`Traffic Portal - CacheGroup - ${cacheGroupData.testName}`, () => {
beforeAll(async () => {
Expand All @@ -45,21 +44,48 @@ cachegroups.tests.forEach(cacheGroupData => {
});
for (const create of cacheGroupData.create) {
it(create.Description, async () => {
expect(await cacheGroupPage.CreateCacheGroups(create, create.validationMessage)).toBeTruthy();
expect(
await cacheGroupPage.CreateCacheGroups(
create,
create.validationMessage
)
).toBeTruthy();
});
}
for (const update of cacheGroupData.update) {
it(update.Description, async () => {
await cacheGroupPage.SearchCacheGroups(update.Name);
expect(await cacheGroupPage.UpdateCacheGroups(update, update.validationMessage)).toBeTruthy();
});
if (update.Description.includes("cannot")) {
it(update.Description, async () => {
await cacheGroupPage.SearchCacheGroups(update.Name);
expect(
await cacheGroupPage.UpdateCacheGroups(
update,
update.validationMessage
)
).toBeUndefined();
});
} else {
it(update.Description, async () => {
await cacheGroupPage.SearchCacheGroups(update.Name);
expect(
await cacheGroupPage.UpdateCacheGroups(
update,
update.validationMessage
)
).toBeTruthy();
});
}
}
for (const remove of cacheGroupData.remove) {
it(remove.Description, async () => {
await cacheGroupPage.SearchCacheGroups(remove.Name);
expect(await cacheGroupPage.DeleteCacheGroups(remove.Name, remove.validationMessage)).toBeTruthy();
expect(
await cacheGroupPage.DeleteCacheGroups(
remove.Name,
remove.validationMessage
)
).toBeTruthy();
});
}
});
}
})
});

0 comments on commit 639b3e6

Please sign in to comment.