Skip to content

Commit

Permalink
Updating app analytics jest and cypress tests (#1398) (#1416)
Browse files Browse the repository at this point in the history
* some updates



* beginning assertion



* fix typo



* TEMPORARY: only run app analytics github action



* included wait for all requests



* explicitly add sample data flights and logs



* otel imported



* update otel requests



* reintroduce otel data



* switch browser to electron



* fixed issues with timepicker not being shared properly, separated app and explorer times



* small updates to spec



* fix some of the time logic



* small fixes to spec



* double click to open service flyout, doesn't work otherwise



* click to render chart



* fixed issue where availability lines weren't showing up due to deleted parsing



* extra character for query while autocomplete issue is being worked on



* uncomment everything whoops



* typing bandaid



* intercept loading panel and remove waits



* minimally viable testing



* switch back to electron



* temp load data for ftr run



* change waiting order



* only need one loading panels wait



* update ftr tests



* include two network intercepts



* ftr test update delete success getter



* add intercept after selection



* take into account new name



* manual wait to isolate other issues



* repeat test 10 times to check for flakiness



* revert repeat 10 tests



* updated snapshots



* remove ftr test



* go back to running all integration tests



* reduce usage of within



* run app analytics test 10 times on github runner



* add wait to avoid test avoiding checkbox



* explain why i have a wait



* remove repeating tests



* small changes



* change and remove some jest tests



---------


(cherry picked from commit 3733eeb)

Signed-off-by: Paul Sebastian <paulstn@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 8951362 commit 489bb8c
Show file tree
Hide file tree
Showing 13 changed files with 1,596 additions and 89 deletions.
111 changes: 49 additions & 62 deletions .cypress/integration/app_analytics_test/app_analytics.spec.js

Large diffs are not rendered by default.

106 changes: 102 additions & 4 deletions .cypress/utils/app_constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,110 @@

export const delay = 1000;
export const timeoutDelay = 30000;
export const TYPING_DELAY = 150;
export const TYPING_DELAY = 450;

export const loadAllData = () => {
// flights and web logs, not using ecommerce currently
loadAllSampleData();

loadOtelData();
}

export const loadOtelData = () => {
testIndexDataSet.forEach(({ mapping_url, data_url, index }) =>
dumpDataSet(mapping_url, data_url, index)
);
}

export const loadAllSampleData = () => {
// Deleting all indices, cypress doesn't support conditionals in any way so to create a single
// line of execution, need to start from a clean slate
cy.request(
'DELETE',
`${Cypress.env('opensearch')}/index*,sample*,opensearch_dashboards*,test*,cypress*`
);

cy.visit(`${Cypress.env('opensearchDashboards')}/app/home#/tutorial_directory`);

// Load sample flights data
cy.get(`button[data-test-subj="addSampleDataSetflights"]`).click({
force: true,
});
// Load sample logs data
cy.get(`button[data-test-subj="addSampleDataSetlogs"]`).click({
force: true,
});

// Verify that sample data is add by checking toast notification
cy.contains('Sample flight data installed', { timeout: 60000 });
cy.contains('Sample web logs installed', { timeout: 60000 });
}

// took dumpDataSet and testIndexDataSet from https://github.com/opensearch-project/opensearch-dashboards-functional-test/blob/main/cypress/integration/plugins/observability-dashboards/0_before.spec.js
const dumpDataSet = (mapping_url, data_url, index) => {
cy.request({
method: 'PUT',
failOnStatusCode: false,
url: `${Cypress.env('opensearch')}/${index}`,
headers: {
'content-type': 'application/json;charset=UTF-8',
'osd-xsrf': true,
},
});

cy.request(mapping_url).then((response) => {
cy.request({
method: 'POST',
form: false,
url: `${Cypress.env('opensearch')}/${index}/_mapping`,
headers: {
'content-type': 'application/json;charset=UTF-8',
'osd-xsrf': true,
},
body: response.body,
});
});

cy.request(data_url).then((response) => {
cy.request({
method: 'POST',
form: false,
url: `${Cypress.env('opensearch')}/${index}/_bulk`,
headers: {
'content-type': 'application/json;charset=UTF-8',
'osd-xsrf': true,
},
body: response.body,
});
});
};

const testIndexDataSet = [
{
mapping_url:
'https://raw.githubusercontent.com/opensearch-project/dashboards-observability/main/.cypress/utils/otel-v1-apm-service-map-mappings.json',
data_url:
'https://raw.githubusercontent.com/opensearch-project/dashboards-observability/main/.cypress/utils/otel-v1-apm-service-map.json',
index: 'otel-v1-apm-service-map',
},
{
mapping_url:
'https://raw.githubusercontent.com/opensearch-project/dashboards-observability/main/.cypress/utils/otel-v1-apm-span-000001-mappings.json',
data_url:
'https://raw.githubusercontent.com/opensearch-project/dashboards-observability/main/.cypress/utils/otel-v1-apm-span-000001.json',
index: 'otel-v1-apm-span-000001',
},
{
mapping_url:
'https://raw.githubusercontent.com/opensearch-project/dashboards-observability/main/.cypress/utils/otel-v1-apm-span-000001-mappings.json',
data_url:
'https://raw.githubusercontent.com/opensearch-project/dashboards-observability/main/.cypress/utils/otel-v1-apm-span-000002.json',
index: 'otel-v1-apm-span-000002',
},
];

export const moveToHomePage = () => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability-applications#/`);
cy.wait(delay * 3);
cy.get('.euiTitle').contains('Applications').should('exist');
};

Expand All @@ -32,12 +131,11 @@ export const moveToEditPage = () => {
moveToApplication(nameOne);
cy.get('[data-test-subj="app-analytics-configTab"]').click();
cy.get('[data-test-subj="editApplicationButton"]').click();
cy.wait(delay);
cy.get('[data-test-subj="createPageTitle"]').should('contain', 'Edit application');
};

export const changeTimeTo24 = (timeUnit) => {
cy.get('[data-test-subj="superDatePickerToggleQuickMenuButton"]').trigger('mouseover').click();
cy.get('[data-test-subj="superDatePickerToggleQuickMenuButton"]').trigger('mouseover').click({ force: true });
cy.get('[aria-label="Time unit"]').select(timeUnit);
cy.get('.euiButton').contains('Apply').click();
cy.get('[data-test-subj="superDatePickerApplyTimeButton"]').click();
Expand Down
25 changes: 13 additions & 12 deletions .github/workflows/integration-tests-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@ jobs:
matrix:
os: [ubuntu-latest]
java: [11]
testgroups: [
app_analytics_test,
datasources_test,
event_analytics_test,
integrations_test,
metrics_analytics_test,
notebooks_test,
panels_test,
trace_analytics_test
]
testgroups:
[
app_analytics_test,
datasources_test,
event_analytics_test,
integrations_test,
metrics_analytics_test,
notebooks_test,
panels_test,
trace_analytics_test,
]
include:
- os: ubuntu-latest
cypress_cache_folder: ~/.cache/Cypress
Expand Down Expand Up @@ -134,7 +135,7 @@ jobs:
cd OpenSearch-Dashboards
nohup yarn start --no-base-path --no-watch | tee dashboard.log &
- name : Check If OpenSearch Dashboards Is Ready
- name: Check If OpenSearch Dashboards Is Ready
if: ${{ runner.os == 'Linux' }}
run: |
cd ./OpenSearch-Dashboards
Expand Down Expand Up @@ -165,7 +166,7 @@ jobs:
- name: Run Cypress tests for test group of ${{ matrix.testgroups }}
run: |
cd ./OpenSearch-Dashboards/plugins/dashboards-observability
yarn cypress:run --browser chrome --headless --spec '.cypress/integration/${{ matrix.testgroups }}/*'
yarn cypress:run --headless --spec '.cypress/integration/${{ matrix.testgroups }}/*'
- name: Capture failure screenshots
uses: actions/upload-artifact@v1
Expand Down
Loading

0 comments on commit 489bb8c

Please sign in to comment.