Skip to content

Commit

Permalink
Testing: Port test_user tests
Browse files Browse the repository at this point in the history
Port existing user tests from freeipa project to gherkin syntax.

Signed-off-by: Michal Polovka <mpolovka@redhat.com>
  • Loading branch information
miskopo committed Jun 27, 2023
1 parent ab29cd3 commit 87765d6
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 21 deletions.
14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions tests/features/steps/test_user.js

This file was deleted.

36 changes: 36 additions & 0 deletions tests/features/steps/test_webui.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const { Given, When, Then } = require("cucumber");

Given(
"an administrator account named {word} exists",
function (admin_account_exists) {
console.log("Admin exists, SUCCESS");
}
);

Given("I am logged in as {word}", function (admin_login) {
console.log("Admin logged in, SUCCESS");
});

Given("I have a sample {word}", function (create_record) {});

When("I click on {} tab", function (tab_name) {
document.getElementById(tab_name).click();
});

When("I click on {word} button", function (button_name) {
document.getElementById(button_name).click();
});

When("there is only one existing user", function () {});

Then("I should see {word} entry in the result table", function (entry_id) {});
When("I type in the field {word} text {}", function (field_id, content) {});
Given("There is an entry {word}", function (entry_id) {});
When("I open details for entry {word}", function (entry_id) {});
Then(
"I should see field {word} filled with {}",
function (field_id, content) {}
);
When("I open the details for the entry {word}", function () {});
Then("I should see the detail page for {word}", function () {});
Then("Entry {word} should be enabled", function () {});
80 changes: 80 additions & 0 deletions tests/features/test_active_user.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
Feature: User manipulation
Create, edit, delete, preserve and activate users

Background:
Given an administrator account named admin exists
And I am logged in as admin

Scenario: Navigate to users tab
When I click on Users tab
And there is only one existing user
Then I should see admin entry in the result table

Scenario Outline: Add a new user
Given I have a sample group
* I have a sample netgroup
* I have a sample rbac
* I have a sample hbac
* I have a sample sudorule
When I click on Add button
* I type in the field user-login text <username>
* I type in the field first-name text <firstname>
* I type in the field last-name text <lastname>
* I click on "Add" button
Then I should see <username> entry in the result table
* Entry <username> should be enabled
Examples:
| username | firstname | lastname
| testuser1 | test | user1
| testuser2 | test | user2
| testuser3 | test | user3
Scenario: Open user details
Given There is an entry testuser1
When I open the details for the entry testuser1
Then I should see the detail page for testuser1
Scenario: Fill in user details
Given There is an entry testuser1
When I open the details for the entry testuser1
* I type in the field first-name text Testfirst
* I type in the field last-name text Testlast
* I type in the field full-name text "Testfirst Testlast"
* I type in the field job-title text Testjobtitle
* I type in the field class-field text Testclass
* I type in the field gecos text "Testfirst Testlast, RandomOffice, 1234567, The Earth"
When I click on save button
Then I should see the detail page for testuser1
* I should see field first-name filled with Testfirst
* I should see field last-name filled with Testlast
* I should see field full-name filled with "Testfirst Testlast"
* I should see field job-title filled with Testjobtitle
* I should see field class-field filled with Testclass
* I should see field gecos filled with "Testfirst Testlast, RandomOffice, 1234567, The Earth"
Scenario: Add ssh key to a user
Given There is an entry testuser1
When I open details for entry testuser1
* I click on add_ssh_key button
* I type in the field ssh-key text "LONG SSH KEY HERE"
* I click on set button
Then I should see field "ssh_pubkey" filled with "SHORT_SSH_KEY_HERE"
Scenario: Add certificate to a user
Given There is an entry testuser1
When I open details for entry testuser1
* I click on add_certificate button
* I type in the field certificate text "CR_CONTENT_HERE"
* I click on set button
Then I should see field "certificate" filled with "CR_CONTENT_HERE"
Scenario: Add certificate mapping data to a user
Given There is an entry testuser1
When I open details for entry testuser1
* I click on add_certificate_mapping button
* I type in the field certificate_mapping text "CR MAPPING CONTENT"
* I click on set button
Then I should see field certificate_mapping filled with "CR MAPPING CONTENT"
15 changes: 15 additions & 0 deletions tests/features/test_active_user_associations.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Feature: User association
Test association of user with user groups, netgroups, roles, HBAC roles and
Sudo rules

Background:
Given an administrator account named admin exists
And I am logged in as admin
* I click on "Member of" tab
* I have a sample netgroup
* I have a sample rbac
* I have a sample hbac
* I have a sample sudorule

Scenario: # Enter scenario name here
# Enter steps here
12 changes: 0 additions & 12 deletions tests/features/test_user.feature

This file was deleted.

0 comments on commit 87765d6

Please sign in to comment.