-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[chore] update caniuse and fix some things in cypress #9483
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
base: main
Are you sure you want to change the base?
Changes from all commits
80fb25f
5af9895
a79ba71
bcc1068
9502946
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| test: | ||
| - Update caniuse and return promise and properly chain the async operations ([#9483](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9483)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,8 +16,8 @@ module.exports = defineConfig({ | |
| runMode: 2, | ||
| openMode: 0, | ||
| }, | ||
| viewportWidth: 2000, | ||
| viewportHeight: 1320, | ||
| viewportWidth: 1920, | ||
| viewportHeight: 1080, | ||
| env: { | ||
| ENGINE: { | ||
| name: 'default', | ||
|
|
@@ -50,7 +50,7 @@ module.exports = defineConfig({ | |
| e2e: { | ||
| baseUrl: 'http://localhost:5601', | ||
| specPattern: 'cypress/integration/**/*.spec.{js,jsx,ts,tsx}', | ||
| testIsolation: false, | ||
| testIsolation: true, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. previously i was wondering why this was set to false. If tests pass then yeah this should be set to true. But to give some background knowledge. In other environments we set this to false. This is because some of our tests require authentication and that does not persist if this is set to true |
||
| setupNodeEvents, | ||
| }, | ||
| }); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,8 @@ const runSavedSearchTests = () => { | |
| describe('saved search', () => { | ||
| // TODO: Currently we cannot convert this into a "before" and "after" due to us grabbing several aliases that are required by postRequestSaveSearch() | ||
| beforeEach(() => { | ||
| cy.clearLocalStorage(); | ||
| cy.clearAllSessionStorage(); | ||
| cy.osd.setupWorkspaceAndDataSourceWithIndices(workspaceName, [ | ||
| INDEX_WITH_TIME_1, | ||
| INDEX_WITH_TIME_2, | ||
|
|
@@ -90,14 +92,20 @@ const runSavedSearchTests = () => { | |
|
|
||
| it(`should successfully update a saved search for ${config.testName}`, () => { | ||
| // using a POST request to create a saved search to load | ||
| postRequestSaveSearch(config); | ||
| updateSavedSearchAndSaveAndVerify(config, workspaceName, DATASOURCE_NAME, false); | ||
| cy.wrap(null).then(() => { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this to ensure that the async operations are completed before continuing to the assertions? |
||
| return postRequestSaveSearch(config).then(() => { | ||
| updateSavedSearchAndSaveAndVerify(config, workspaceName, DATASOURCE_NAME, false); | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| it(`should successfully save a saved search as a new saved search for ${config.testName}`, () => { | ||
| // using a POST request to create a saved search to load | ||
| postRequestSaveSearch(config); | ||
| updateSavedSearchAndSaveAndVerify(config, workspaceName, DATASOURCE_NAME, true); | ||
| cy.wrap(null).then(() => { | ||
| return postRequestSaveSearch(config).then(() => { | ||
| updateSavedSearchAndSaveAndVerify(config, workspaceName, DATASOURCE_NAME, true); | ||
| }); | ||
| }); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why was this change needed? Your description says something about bumping the timeout, but is this section related to that? |
||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -433,11 +433,11 @@ const getSavedObjectPostBody = (config, workspaceId, datasourceId, indexPatternI | |
| * @param {SavedTestConfig} config - the relevant config for the test case | ||
| */ | ||
| export const postRequestSaveSearch = (config) => { | ||
| cy.get('@WORKSPACE_ID').then((workspaceId) => { | ||
| cy.get('@DATASOURCE_ID').then((datasourceId) => { | ||
| cy.get('@INDEX_PATTERN_ID').then((indexPatternId) => { | ||
| return cy.get('@WORKSPACE_ID').then((workspaceId) => { | ||
| return cy.get('@DATASOURCE_ID').then((datasourceId) => { | ||
| return cy.get('@INDEX_PATTERN_ID').then((indexPatternId) => { | ||
| // POST a saved search | ||
| cy.request({ | ||
| return cy.request({ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i wasn't originally seeing things wait for the saved search to load which should be async so i'm returning the promise chain so that then we can chain off the response and then proceed to validate. but i could be missing a wait from intercepting somehting. |
||
| method: 'POST', | ||
| url: `/w/${workspaceId}/api/saved_objects/search?overwrite=true`, | ||
| headers: { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,13 +5,19 @@ | |
|
|
||
| // --- Typed commands -- | ||
|
|
||
| Cypress.Commands.add('getElementByTestId', (testId, options = {}) => { | ||
| return cy.get(`[data-test-subj="${testId}"]`, options); | ||
| }); | ||
| Cypress.Commands.add( | ||
| 'getElementByTestId', | ||
| (testId, options = { timeout: Cypress.config('defaultCommandTimeout') }) => { | ||
| return cy.get(`[data-test-subj="${testId}"]`, options); | ||
| } | ||
| ); | ||
|
|
||
| Cypress.Commands.add('getElementByTestIdLike', (testId, options = {}) => { | ||
| return cy.get(`[data-test-subj*="${testId}"]`, options); | ||
| }); | ||
| Cypress.Commands.add( | ||
| 'getElementByTestIdLike', | ||
| (testId, options = { timeout: Cypress.config('defaultCommandTimeout') }) => { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there should be a way to just type the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think you already set this value at the cypress config level so i was kind of shooting in the dark with this one and can prolly remove not positive if the option will be passed down nested levels would make sense to me. but basically anyone could override it. unless you are trying to say it would be better to have a set an options that we would let people set and not let them configure it past that |
||
| return cy.get(`[data-test-subj*="${testId}"]`, options); | ||
| } | ||
| ); | ||
|
|
||
| Cypress.Commands.add('getElementsByTestIds', (testIds, options = {}) => { | ||
| const selectors = [testIds].flat(Infinity).map((testId) => `[data-test-subj="${testId}"]`); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have any screenshot comparisons we have to worry about breaking here?