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) (#1483)

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

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>

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

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>

* Adds a focus call

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>

* Temp add 10 CI runs

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>

* Fixes sanity test spec

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>

* Revert "Temp add 10 CI runs"

This reverts commit 0619d35.

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>

---------

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
(cherry picked from commit a8ba15a)
  • Loading branch information
DarshitChanpura authored Aug 2, 2024
1 parent e046bf9 commit 48bc29a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 17 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
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 48bc29a

Please sign in to comment.