Skip to content

Commit

Permalink
initial skeleton
Browse files Browse the repository at this point in the history
Signed-off-by: Sam <samuel.costa@eliatra.com>
  • Loading branch information
samuelcostae committed Nov 21, 2023
1 parent 76ec82d commit 6618236
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions cypress/integration/plugins/security/auth_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,47 @@ import {
} from '../../../utils/constants';

if (Cypress.env('SECURITY_ENABLED')) {

describe('OpenSearch Dashboards Security Plugin - User Creation', () => {
const username = 'newuser';
const password = 'newpassword';

beforeEach(() => {
// Visit the OpenSearch Dashboards login page
cy.visit('/');

// Login as admin
cy.get('input[name="username"]').type(Cypress.env('username'));
cy.get('input[name="password"]').type(Cypress.env('password'), { log: false });
cy.get('button[type="submit"]').click();

// Wait for the OpenSearch Dashboards home page to load
cy.contains('Welcome to OpenSearch Dashboards', { timeout: 60000 }).should('be.visible');
});

it('should create a new internal user', () => {
// Navigate to Security/Internal User Database section
cy.visit('/app/security-dashboards#/users');

// Click on 'Add internal user' button
cy.get('button').contains('Add internal user').click();

// Provide username and password for the new user
cy.get('input[data-test-subj="user-name"]').type(username);
cy.get('input[data-test-subj="password"]').type(password);
cy.get('input[data-test-subj="password-confirmation"]').type(password);

// Optionally add backend role and user attribute
// Skipping as per the instruction [No backend role]

// Submit the form to create the user
cy.get('button').contains('Submit').click();

// Verify that the user is created
cy.contains(username).should('exist');
});
});

describe('Authc and Authz page', () => {
// start a server so that server responses can be mocked via fixtures
// in all of the below test cases
Expand Down

0 comments on commit 6618236

Please sign in to comment.