Skip to content

Commit

Permalink
fix: flaky tests in discover.spec.js (#1033)
Browse files Browse the repository at this point in the history
* fix: manually set global as default tenant

Signed-off-by: SuZhou-Joe <[email protected]>

* fix: add delay to ensure the input is right

Signed-off-by: SuZhou-Joe <[email protected]>

* feat: add some comment

Signed-off-by: SuZhou-Joe <[email protected]>

---------

Signed-off-by: SuZhou-Joe <[email protected]>
(cherry picked from commit 94a5d3c)
  • Loading branch information
SuZhou-Joe authored and github-actions[bot] committed Feb 5, 2024
1 parent d9d4060 commit ea1727b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ const indexSet = [

describe('discover app', { scrollBehavior: false }, () => {
before(() => {
if (Cypress.env('SECURITY_ENABLED')) {
/**
* Security plugin is using private tenant as default.
* So here we'd need to set global tenant as default manually.
*/
cy.changeDefaultTenant({
multitenancy_enabled: true,
private_tenant_enabled: true,
default_tenant: 'global',
});
}
CURRENT_TENANT.newTenant = 'global';
// import logstash functional
testFixtureHandler.importJSONDocIfNeeded(
Expand Down
10 changes: 8 additions & 2 deletions cypress/utils/dashboards/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ Cypress.Commands.add('setTopNavDate', (start, end, submit = true) => {
cy.getElementByTestId('superDatePickerAbsoluteDateInput', opts)
.click(opts)
.clear(opts)
.type(start, opts);
.type(start, {
...opts,
delay: 0, // add a delay here, cypress sometimes fails to type all the content into the input.
});

// Click end date
cy.getElementByTestId('superDatePickerendDatePopoverButton', opts)
Expand All @@ -96,7 +99,10 @@ Cypress.Commands.add('setTopNavDate', (start, end, submit = true) => {
.last(opts)
.click(opts)
.clear(opts)
.type(end, opts);
.type(end, {
...opts,
delay: 0, // add a delay here, cypress sometimes fails to type all the content into the input.
});

// Close popup
cy.getElementByTestId('superDatePickerendDatePopoverButton', opts).click(
Expand Down

0 comments on commit ea1727b

Please sign in to comment.