-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UXE-5195] feat: add create cache settings drawer to rules engine form (
#1791) * feat: add e2e tests to this cenary * fix: change import path
- Loading branch information
1 parent
27de4e5
commit 1bbd1ed
Showing
9 changed files
with
223 additions
and
17 deletions.
There are no files selected for viewing
102 changes: 102 additions & 0 deletions
102
cypress/e2e/edge-application/rules-engine/create-rule-engine-set-cache-policy.cy.js
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,102 @@ | ||
import generateUniqueName from '../../../support/utils' | ||
import selectors from '../../../support/selectors' | ||
|
||
let fixtures = {} | ||
|
||
/** | ||
* Creates a new edge application with basic settings. | ||
*/ | ||
const createEdgeApplicationCase = () => { | ||
// Act | ||
cy.get(selectors.edgeApplication.mainSettings.createButton).click() | ||
cy.get(selectors.edgeApplication.mainSettings.nameInput).type(fixtures.edgeApplicationName) | ||
cy.get(selectors.edgeApplication.mainSettings.addressInput).clear() | ||
cy.get(selectors.edgeApplication.mainSettings.addressInput).type('httpbingo.org') | ||
cy.get(selectors.form.actionsSubmitButton).click() | ||
cy.verifyToast('success', 'Your edge application has been created') | ||
cy.get(selectors.form.actionsCancelButton).click() | ||
|
||
// Assert - Verify the edge application was created | ||
cy.get(selectors.list.searchInput).type(fixtures.edgeApplicationName) | ||
cy.get(selectors.list.filteredRow.column('name')).should( | ||
'have.text', | ||
fixtures.edgeApplicationName | ||
) | ||
|
||
// Act - Navigate to the created edge application | ||
cy.get(selectors.list.filteredRow.column('name')).click() | ||
} | ||
|
||
describe('Edge Application', { tags: ['@dev4'] }, () => { | ||
beforeEach(() => { | ||
fixtures.edgeApplicationName = generateUniqueName('EdgeApp') | ||
// Login | ||
cy.login() | ||
|
||
fixtures = { | ||
functionName: generateUniqueName('EdgeFunction'), | ||
functionInstanceName: generateUniqueName('FunctionsInstance'), | ||
edgeApplicationName: generateUniqueName('EdgeApp'), | ||
originName: generateUniqueName('origin'), | ||
rulesEngineName: generateUniqueName('RulesEng'), | ||
cacheSettingName: generateUniqueName('cacheSetting') | ||
} | ||
}) | ||
|
||
it('should create a rule engine set cache policy', () => { | ||
// Arrange | ||
cy.openProduct('Edge Application') | ||
createEdgeApplicationCase() | ||
cy.get(selectors.edgeApplication.tabs('Rules Engine')).click() | ||
|
||
// Act | ||
// Create a rule | ||
cy.get(selectors.edgeApplication.rulesEngine.createButton).click() | ||
cy.get(selectors.edgeApplication.rulesEngine.ruleNameInput).type(fixtures.rulesEngineName) | ||
cy.get(selectors.edgeApplication.rulesEngine.criteriaOperatorDropdown(0, 0)).click() | ||
cy.get(selectors.edgeApplication.rulesEngine.criteriaOperatorOption('is equal')).click() | ||
cy.get(selectors.edgeApplication.rulesEngine.criteriaInputValue(0, 0)).clear() | ||
cy.get(selectors.edgeApplication.rulesEngine.criteriaInputValue(0, 0)).type('/') | ||
cy.get(selectors.edgeApplication.rulesEngine.behaviorsDropdown(0)).click() | ||
cy.get(selectors.edgeApplication.rulesEngine.behaviorsOption('Set Cache Policy')).click() | ||
cy.get(selectors.edgeApplication.rulesEngine.setCachePolicySelect(0)).click() | ||
cy.get(selectors.edgeApplication.rulesEngine.createCachePolicyButton).click() | ||
cy.get(selectors.edgeApplication.cacheSettings.nameInput).type(fixtures.cacheSettingName) | ||
|
||
cy.intercept('GET', 'api/v3/edge_applications/*/cache_settings?page_size=200').as( | ||
'getCachePolicy' | ||
) | ||
cy.get(selectors.edgeApplication.rulesEngine.cachePolicyActionBar) | ||
.find(selectors.form.actionsSubmitButton) | ||
.click() | ||
cy.verifyToast('success', 'Cache Settings successfully created') | ||
|
||
cy.wait('@getCachePolicy') | ||
cy.get(selectors.edgeApplication.rulesEngine.setCachePolicySelect(0)).click() | ||
cy.get(selectors.edgeApplication.rulesEngine.setCachePolicySelect(0)) | ||
.find(selectors.edgeApplication.rulesEngine.cachePolicyOption(fixtures.cacheSettingName)) | ||
.click() | ||
|
||
cy.get(selectors.form.actionsSubmitButton).click() | ||
cy.verifyToast('success', 'Your Rules Engine has been created.') | ||
|
||
// Assert | ||
cy.get(selectors.list.searchInput).type(fixtures.rulesEngineName) | ||
cy.get(selectors.list.filteredRow.column('name')).should('have.text', fixtures.rulesEngineName) | ||
|
||
// Cleanup - Remove the rule engine | ||
cy.deleteEntityFromLoadedList().then(() => { | ||
cy.verifyToast('Rule Engine successfully deleted') | ||
}) | ||
}) | ||
|
||
afterEach(() => { | ||
// Delete the edge application | ||
cy.deleteEntityFromList({ | ||
entityName: fixtures.edgeApplicationName, | ||
productName: 'Edge Application' | ||
}).then(() => { | ||
cy.verifyToast('Resource successfully deleted') | ||
}) | ||
}) | ||
}) |
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
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
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
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
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
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
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
Oops, something went wrong.