-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test the addition of the user. This test still depends on login via old_UI and will be changed in the future. It also depends on #134 Signed-off-by: Michal Polovka <mpolovka@redhat.com>
- Loading branch information
Showing
3 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
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,66 @@ | ||
import { When, Then, Given } from "@badeball/cypress-cucumber-preprocessor"; | ||
|
||
Given("I am on login page", () => { | ||
// temporary solution as the new UI doesn't have login page yet | ||
cy.visit("/ipa/ui"); | ||
}); | ||
|
||
Given( | ||
"an administrator account named {word} exists", | ||
(admin_account_exists) => { | ||
console.log("Admin exists, SUCCESS"); | ||
// TODO: implement | ||
} | ||
); | ||
|
||
When("I log in as {string} with password {string}", (loginName, password) => { | ||
// temporary solution as the new UI doesn't have login page yet | ||
cy.get("[id=username1]").type(loginName); | ||
cy.get("[id=password2").type(password); | ||
cy.get("button[name=login]").click(); | ||
cy.wait(1000); | ||
cy.visit("/ipa/modern_ui"); | ||
}); | ||
|
||
When("I logout", () => {}); | ||
|
||
When("I open the side menu", () => { | ||
cy.get('[id="nav-toggle"]').then(($ele) => { | ||
if ($ele.attr("aria-expanded") === "false") { | ||
$ele.click(); | ||
} | ||
}); | ||
}); | ||
|
||
When("I close the side menu", () => { | ||
cy.get('[id="nav-toggle"]').then(($ele) => { | ||
if ($ele.attr("aria-expanded") === "true") { | ||
$ele.click(); | ||
} | ||
}); | ||
}); | ||
When("I click on {string} tab", (tabText) => { | ||
cy.get("nav a").contains(tabText).click(); | ||
}); | ||
|
||
When("I click on {string} button", function (buttonText) { | ||
cy.wait(1000); | ||
cy.get("button").contains(buttonText).click(); | ||
}); | ||
|
||
When("in the modal dialog I click on {string} button", function (buttonText) { | ||
cy.get("[role=dialog] button").contains(buttonText).click(); | ||
}); | ||
|
||
When("I type in the field {string} text {string}", (fieldName, content) => { | ||
cy.get("[role=dialog] label") | ||
.contains(fieldName) | ||
.parent() | ||
.then(($label) => { | ||
cy.get("[name=modal-form-" + $label.attr("for") + "]").type(content); | ||
}); | ||
}); | ||
|
||
Then("I should see {string} entry in the data table", (name) => { | ||
cy.get("tr[id=" + name + "]").should("be.visible"); | ||
}); |
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,16 @@ | ||
import { When, Then, Given } from "@badeball/cypress-cucumber-preprocessor"; | ||
|
||
Given("there is only admin user active", () => { | ||
cy.get("tr[id=admin]", { timeout: 10000 }).should("be.visible"); | ||
cy.get('input[aria-label="Select all"]').check(); | ||
cy.get("tr[id=admin] input[type=checkbox]").uncheck(); | ||
|
||
cy.get("button") | ||
.contains("Delete") | ||
.then(($deleteButton) => { | ||
if ($deleteButton.prop("disabled")) return; | ||
|
||
$deleteButton.click(); | ||
cy.get("[role=dialog] button").contains("Delete").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,20 @@ | ||
Feature: User manipulation | ||
Create, edit, delete, preserve and activate users | ||
|
||
Background: | ||
Given I am on login page | ||
When I log in as "admin" with password "Secret123" | ||
|
||
Scenario: Add a new user | ||
Given I open the side menu | ||
* I click on "Active users" tab | ||
* I close the side menu | ||
* there is only admin user active | ||
When I click on "Add" button | ||
* I type in the field "User login" text "testuser1" | ||
* I type in the field "First name" text "Arthur" | ||
* I type in the field "Last name" text "Dent" | ||
* I type in the field "New Password" text "ILoveKlingonPoetry42" | ||
* I type in the field "Verify password" text "ILoveKlingonPoetry42" | ||
* in the modal dialog I click on "Add" button | ||
Then I should see "testuser1" entry in the data table |