Skip to content

Commit

Permalink
Fixes the permissions spec and related to fixtures to reflect correct…
Browse files Browse the repository at this point in the history
… action-group names (#1449)

* Fixes the permissions spec and related to fixtures to reflect correct action-group names

Signed-off-by: Darshit Chanpura <[email protected]>

* Adds a test case to check for button availability before making a call

Signed-off-by: Darshit Chanpura <[email protected]>

* Adds a focus call

Signed-off-by: Darshit Chanpura <[email protected]>

* Temp add 10 CI runs

Signed-off-by: Darshit Chanpura <[email protected]>

* Fixes sanity test spec

Signed-off-by: Darshit Chanpura <[email protected]>

* Revert "Temp add 10 CI runs"

This reverts commit 0619d35.

Signed-off-by: Darshit Chanpura <[email protected]>

---------

Signed-off-by: Darshit Chanpura <[email protected]>
  • Loading branch information
DarshitChanpura authored Aug 1, 2024
1 parent 66307da commit a8ba15a
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"total": 26,
"data": {
"test": {
"test-selection": {
"reserved": false,
"hidden": false,
"allowed_actions": ["data_access"],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"total": 26,
"data": {
"test": {
"test-creation": {
"reserved": false,
"hidden": false,
"allowed_actions": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,16 @@ if (Cypress.env('SECURITY_ENABLED')) {
cy.loadSampleData('flights');
// Step 3: Navigate to Manage data to add an index pattern
cy.visit(`${BASE_PATH}/app/home`);
cy.get('button[aria-label="Closes this modal window"]').click();

cy.get('.euiOverlayMask').then(($body) => {
if (
$body.find('button[aria-label="Closes this modal window"]').length
) {
cy.get('button[aria-label="Closes this modal window"]').click();
} else {
// do nothing
}
});
cy.contains('Manage').click(); // Adjust the selector as needed

// Step 4: Add the index pattern
Expand Down
40 changes: 25 additions & 15 deletions cypress/integration/plugins/security/permissions_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,7 @@ if (Cypress.env('SECURITY_ENABLED')) {
});

it('should create new action group successfully by selecting `Create from blank`', () => {
cy.mockPermissionsAction(
SEC_PERMISSIONS_FIXTURES_PATH +
'/actiongroups_post_new_creation_response.json',
() => {
cy.visit(SEC_UI_PERMISSIONS_PATH);
}
);
cy.visit(SEC_UI_PERMISSIONS_PATH);

cy.contains('button', 'Create action group')
.first()
Expand All @@ -92,16 +86,26 @@ if (Cypress.env('SECURITY_ENABLED')) {
cy.contains('.euiModalHeader__title', 'Create new action group');

const actionGroupName = 'test-creation';
cy.get('input[data-test-subj="name-text"]').type(actionGroupName, {
force: true,
});
cy.get('input[data-test-subj="name-text"]')
.focus()
.clear()
.type(actionGroupName, {
force: true,
})
.blur();
cy.get('input[data-test-subj="name-text"]').should(
'have.value',
actionGroupName
);
cy.get('button[id="submit"]').should('not.have.attr', 'disabled');

cy.get('button[id="submit"]').first().click({ force: true });

cy.mockPermissionsAction(
SEC_PERMISSIONS_FIXTURES_PATH +
'/actiongroups_post_new_creation_response.json',
() => {
cy.get('button[id="submit"]').first().click({ force: true });
}
);
cy.url().should((url) => {
expect(url).to.contain('/permissions');
});
Expand Down Expand Up @@ -139,13 +143,19 @@ if (Cypress.env('SECURITY_ENABLED')) {
cy.contains('.euiModalHeader__title', 'Create new action group');

const actionGroupName = 'test-selection';
cy.get('input[data-test-subj="name-text"]').type(actionGroupName, {
force: true,
});
cy.get('input[data-test-subj="name-text"]')
.focus()
.clear()
.type(actionGroupName, {
force: true,
})
.blur();

cy.get('input[data-test-subj="name-text"]').should(
'have.value',
actionGroupName
);
cy.get('button[id="submit"]').should('not.have.attr', 'disabled');

cy.get('div[data-test-subj="comboBoxInput"]')
.find('span')
Expand Down

0 comments on commit a8ba15a

Please sign in to comment.