Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating app analytics jest and cypress tests #1398

Merged
merged 46 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
fefedef
some updates
paulstn Jan 6, 2024
69d9923
beginning assertion
paulstn Jan 18, 2024
981f52f
fix typo
paulstn Jan 22, 2024
296e221
TEMPORARY: only run app analytics github action
paulstn Jan 22, 2024
01a79a5
included wait for all requests
paulstn Jan 22, 2024
eeb0787
explicitly add sample data flights and logs
paulstn Jan 23, 2024
6eee9a2
otel imported
paulstn Jan 24, 2024
a92e93a
update otel requests
paulstn Jan 24, 2024
623e39d
reintroduce otel data
paulstn Jan 24, 2024
19b3a77
switch browser to electron
paulstn Jan 24, 2024
189cb59
fixed issues with timepicker not being shared properly, separated app…
paulstn Jan 24, 2024
f7293a0
small updates to spec
paulstn Jan 24, 2024
406ff99
fix some of the time logic
paulstn Jan 24, 2024
487ac43
small fixes to spec
paulstn Jan 25, 2024
82ea50d
double click to open service flyout, doesn't work otherwise
paulstn Jan 25, 2024
80d7898
click to render chart
paulstn Jan 25, 2024
ab9c71f
fixed issue where availability lines weren't showing up due to delete…
paulstn Jan 26, 2024
cbe591a
extra character for query while autocomplete issue is being worked on
paulstn Jan 26, 2024
c15542a
uncomment everything whoops
paulstn Jan 26, 2024
4de0738
typing bandaid
paulstn Jan 26, 2024
3b0c022
intercept loading panel and remove waits
paulstn Jan 26, 2024
f099dce
minimally viable testing
paulstn Jan 29, 2024
84a55be
switch back to electron
paulstn Jan 29, 2024
4be200e
temp load data for ftr run
paulstn Jan 29, 2024
6a2b89f
change waiting order
paulstn Jan 29, 2024
513a677
only need one loading panels wait
paulstn Jan 29, 2024
55be2ad
update ftr tests
paulstn Jan 29, 2024
e8ea6b8
include two network intercepts
paulstn Jan 31, 2024
7c7e49a
ftr test update delete success getter
paulstn Jan 31, 2024
922f426
add intercept after selection
paulstn Jan 31, 2024
7b42ed6
take into account new name
paulstn Jan 31, 2024
be5a872
manual wait to isolate other issues
paulstn Jan 31, 2024
0aea584
repeat test 10 times to check for flakiness
paulstn Jan 31, 2024
bc45904
revert repeat 10 tests
paulstn Jan 31, 2024
8b3da41
updated snapshots
paulstn Jan 31, 2024
e407493
remove ftr test
paulstn Jan 31, 2024
50c9c7f
go back to running all integration tests
paulstn Jan 31, 2024
eb906c7
reduce usage of within
paulstn Jan 31, 2024
7e76158
run app analytics test 10 times on github runner
paulstn Jan 31, 2024
43ee4d3
add wait to avoid test avoiding checkbox
paulstn Jan 31, 2024
b53db6b
explain why i have a wait
paulstn Feb 1, 2024
bfe8ea3
remove repeating tests
paulstn Feb 1, 2024
0544589
Merge branch 'main' into app-analytics-test-coverage
paulstn Feb 1, 2024
2b54979
small changes
paulstn Feb 2, 2024
6792276
change and remove some jest tests
paulstn Feb 2, 2024
94ec7b5
Merge branch 'main' into app-analytics-test-coverage
paulstn Feb 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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({

Check warning on line 34 in .cypress/utils/app_constants.js

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
force: true,
});
// Load sample logs data
cy.get(`button[data-test-subj="addSampleDataSetlogs"]`).click({

Check warning on line 38 in .cypress/utils/app_constants.js

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
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,19 +131,18 @@
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 });

Check warning on line 138 in .cypress/utils/app_constants.js

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
cy.get('[aria-label="Time unit"]').select(timeUnit);
cy.get('.euiButton').contains('Apply').click();
cy.get('[data-test-subj="superDatePickerApplyTimeButton"]').click();
};

export const expectMessageOnHover = (button, message) => {
cy.get(`[data-test-subj="${button}"]`).click({ force: true });

Check warning on line 145 in .cypress/utils/app_constants.js

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
cy.get('.euiToolTipPopover').contains(message).should('exist');
};

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
Loading