Skip to content

Commit

Permalink
convivial-profiler-builder-36586: Cypress: Basics.
Browse files Browse the repository at this point in the history
  • Loading branch information
naveenvalecha committed Oct 3, 2024
1 parent 4a97069 commit 95390ba
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions cypress/e2e/functional/app.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
// Test for Convivial Profiler Builder Configuration Tab
describe('Convivial Profiler Builder: Test - Application', () => {
it('1. Configuration Tab - Save configuration form, check popup message, click Okay, and verify local storage.', () => {
// Open the homepage.
beforeEach(() => {
// Open the homepage before each test
cy.visit(Cypress.env('baseUrl'));
});

it('Configuration Tab - Save configuration form, check popup message, click Okay, and verify local storage.', () => {
// Flush local storage.
cy.clearLocalStorage();

// Check the local storage variable 'convivial_profiler_builder_settings' does not exist.
cy.getLocalStorage('convivial_profiler_builder_settings')
.then($convivial_profiler_builder_settings => {
expect($convivial_profiler_builder_settings).to.equal(null)
})
expect($convivial_profiler_builder_settings).to.equal(null);
});

// Go to Configuration tab.
cy.get('#configuration-tab').click();
Expand All @@ -31,23 +35,20 @@ describe('Convivial Profiler Builder: Test - Application', () => {
cy.get('.swal-modal .swal-button-container .swal-button--confirm')
.click();

// Check the local storage variable 'convivial_profiler_builder_settings'
// Check the local storage variable 'convivial_profiler_builder_settings'.
cy.getLocalStorage('convivial_profiler_builder_settings').then((value) => {
const expectedValue = {
sources: 'https://raw.githubusercontent.com/eleonel/Convivial-Profiler/1.0.x/convivial_profiler.profiler_source.yml',
processors: 'https://raw.githubusercontent.com/eleonel/Convivial-Profiler/1.0.x/convivial_profiler.profiler_processor.yml',
destinations: 'https://raw.githubusercontent.com/eleonel/Convivial-Profiler/1.0.x/convivial_profiler.profiler_destination.yml'
};

// Assert that the local storage value matches the expected value
// Assert that the local storage value matches the expected value.
expect(JSON.parse(value)).to.deep.equal(expectedValue);
});
});

})
it('2. UI Builder Tab - Save UI Builder form.', () => {
// Open the homepage.
cy.visit(Cypress.env('baseUrl'));

it('UI Builder Tab - Save UI Builder form.', () => {
// Go to UI Builder tab.
cy.get('#builder-settings-tab').click();

Expand All @@ -67,6 +68,5 @@ describe('Convivial Profiler Builder: Test - Application', () => {

// There are no profilers.
cy.get('#profilersTable tbody').find('tr').should('have.length', 0);

})
});
});

0 comments on commit 95390ba

Please sign in to comment.