-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
365 additions
and
32 deletions.
There are no files selected for viewing
14 changes: 10 additions & 4 deletions
14
e2e/playwright-tests/features/create_project_and_upload_bom.test.feature
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
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
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
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
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
122 changes: 122 additions & 0 deletions
122
e2e/playwright-tests/page-objects/policy-management.pom.ts
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,122 @@ | ||
import {Page, Locator, expect} from '@playwright/test'; | ||
import { getValue } from "../utilities/utils"; | ||
import {NotificationToast} from "./notification-toast.pom"; | ||
|
||
export class PolicyPage { | ||
page: Page; | ||
createPolicyButton: Locator; | ||
searchFieldInput: Locator; | ||
|
||
modalContent: Locator; | ||
|
||
policyNameInput: Locator; | ||
policyCreationCreateButton: Locator; | ||
policyCreationClosePolicyButton: Locator; | ||
|
||
policyDetailView: Locator; | ||
|
||
policyDetailNameInput: Locator; | ||
policyDetailOperatorSelect: Locator; | ||
policyDetailViolationStateSelect: Locator; | ||
policyDetailConditionSubjectSelect: Locator; | ||
policyDetailConditionOperatorSelect: Locator; | ||
policyDetailConditionInput: Locator; | ||
|
||
policyDetailAddConditionButton: Locator; | ||
policyDetailDeleteConditionButton: Locator; | ||
|
||
policyDeletionButton: Locator; | ||
|
||
constructor(page: Page) { | ||
this.page = page; | ||
|
||
this.createPolicyButton = page.getByRole('button', { name: getValue("message", "create_policy") }); | ||
this.searchFieldInput = page.locator('.search-input').first(); // Todo nach talk mit Niklas .first() removen | ||
|
||
this.modalContent = page.locator('.modal-content'); | ||
|
||
// Create Policy | ||
this.policyNameInput = this.modalContent.locator('#identifier-input'); | ||
this.policyCreationCreateButton = this.modalContent.getByRole('button', { name: getValue("message", "create") }); | ||
this.policyCreationClosePolicyButton = this.modalContent.getByRole('button', { name: getValue("message", "close") }); | ||
|
||
this.policyDetailView = page.locator('.detail-view'); | ||
|
||
// Edit Policy | ||
this.policyDetailNameInput = this.policyDetailView.locator('#identifier-input'); | ||
this.policyDetailOperatorSelect = this.policyDetailView.locator('#input-repository-type-input').first();// getByLabel(getValue("message", "operator")); | ||
this.policyDetailViolationStateSelect = this.policyDetailView.locator('#input-repository-type-input').last(); // .getByLabel(getValue("message", "violation_state")); | ||
this.policyDetailConditionSubjectSelect = this.policyDetailView.locator('#input-subject-input'); | ||
this.policyDetailConditionOperatorSelect = this.policyDetailView.locator('#input-operator-input'); | ||
this.policyDetailConditionInput = this.policyDetailView.locator('#input-value-input'); | ||
|
||
this.policyDetailAddConditionButton = this.policyDetailView.locator('button.btn.pull-right').filter({ has: this.page.locator('.fa.fa-plus-square') }).first(); | ||
this.policyDetailDeleteConditionButton = this.policyDetailView.locator('button.btn.pull-right').filter({ has: this.page.locator('.fa.fa-trash-o') }).first(); | ||
|
||
// Delete Policy | ||
this.policyDeletionButton = this.policyDetailView.getByRole('button', { name: getValue("message", "delete_policy")}) | ||
} | ||
|
||
async clickOnCreatePolicy() { | ||
await this.createPolicyButton.click(); | ||
} | ||
|
||
async fillSearchFieldInput(search: string) { | ||
await this.searchFieldInput.clear(); | ||
await this.searchFieldInput.pressSequentially(search); | ||
await this.page.waitForTimeout(1000); | ||
} | ||
|
||
async ClearSearchFieldInput() { | ||
await this.searchFieldInput.clear(); | ||
} | ||
|
||
async createPolicy(policyName: string) { | ||
await expect(this.modalContent).toBeVisible(); | ||
await expect(this.modalContent).toContainText(getValue("message", "create_policy")); | ||
|
||
await this.policyNameInput.pressSequentially(policyName); | ||
await this.policyCreationCreateButton.click(); | ||
} | ||
|
||
async togglePolicyDetailView(policyName: string) { | ||
await this.fillSearchFieldInput(policyName); | ||
await this.page.getByRole('cell', { name: policyName }).click(); | ||
} | ||
|
||
async addConditionToPolicy(subject: string, operator: string, value: string) { | ||
await this.policyDetailAddConditionButton.click(); | ||
await this.policyDetailConditionSubjectSelect.selectOption(subject); | ||
await this.policyDetailConditionOperatorSelect.selectOption(operator); | ||
await this.policyDetailConditionInput.pressSequentially(value); | ||
} | ||
|
||
async deleteAllConditions() { | ||
const notificationToast = new NotificationToast(this.page); | ||
|
||
while (await this.policyDetailDeleteConditionButton.count() > 0) { | ||
await this.policyDetailDeleteConditionButton.click(); | ||
await notificationToast.verifySuccessfulConditionDeletedToast(); | ||
await this.page.waitForTimeout(1000); | ||
} | ||
} | ||
|
||
async deletePolicy() { | ||
await expect(this.policyDetailView).toBeVisible(); | ||
await this.policyDeletionButton.click(); | ||
} | ||
|
||
async updatePolicyName(newPolicyName: string) { | ||
await this.policyDetailNameInput.clear(); | ||
await this.policyDetailNameInput.pressSequentially(newPolicyName); | ||
} | ||
|
||
async updatePolicyOperator(operator: string) { | ||
await this.policyDetailOperatorSelect.selectOption(operator); | ||
} | ||
|
||
async updatePolicyViolationState(violationState: string) { | ||
await this.policyDetailViolationStateSelect.selectOption(violationState); | ||
} | ||
|
||
} |
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
Oops, something went wrong.