Skip to content

Commit

Permalink
Miner: cypress - fixed failing cypress in main (#14275)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaileshParmar11 committed Dec 6, 2023
1 parent e70721a commit 54d89c8
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { BASE_WAIT_TIME, RETRY_TIMES } from './common';
import { RETRY_TIMES } from './common';

const BASE_WAIT_TIME = 4000;

export const checkDataInsightSuccessStatus = (
count = 1,
Expand All @@ -27,7 +29,7 @@ export const checkDataInsightSuccessStatus = (
$ingestionStatus.text() !== 'Failed' &&
count <= RETRY_TIMES
) {
// retry after waiting with log1 method [20s,40s,80s,160s,320s]
// retry after waiting with log1 method [4s,8s,16s,32s,64s]
cy.wait(timer);
timer *= 2;
cy.reload();
Expand Down
50 changes: 35 additions & 15 deletions openmetadata-ui/src/main/resources/ui/cypress/common/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -573,21 +573,41 @@ export const visitEntityDetailsPage = ({
.first()
.click();
} else {
// if term is not available in search suggestion,
// hitting enter to search box so it will redirect to explore page
cy.get('body').click(1, 1);
cy.get('[data-testid="searchBox"]').type('{enter}');
verifyResponseStatusCode('@explorePageSearch', 200);

const tabName = EXPLORE_PAGE_TABS?.[entity] ?? entity;

cy.get(`[data-testid="${tabName}-tab"]`).click();

verifyResponseStatusCode('@explorePageTabSearch', 200);

cy.get(`[data-testid="${id}"] [data-testid="entity-link"]`)
.scrollIntoView()
.click();
cy.get(`[data-testid="global-search-suggestion-box"]`)
.contains(term)
.then(($body) => {
if ($body.length) {
cy.get(`[data-testid="global-search-suggestion-box"]`)
.contains(term)
.click();
} else {
// if term is not available in search suggestion,
// hitting enter to search box so it will redirect to explore page
cy.get('body').click(1, 1);
cy.get('[data-testid="searchBox"]').type('{enter}');
verifyResponseStatusCode('@explorePageSearch', 200);

const tabName = EXPLORE_PAGE_TABS?.[entity] ?? entity;

cy.get(`[data-testid="${tabName}-tab"]`).click();

verifyResponseStatusCode('@explorePageTabSearch', 200);

if (
$body.find(`[data-testid="${id}"] [data-testid="entity-link"]`)
.length
) {
cy.get(`[data-testid="${id}"] [data-testid="entity-link"]`)
.scrollIntoView()
.click();
} else {
cy.get(`[data-testid="entity-link"]`)
.contains(term)
.eq(0)
.click();
}
}
});
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ describe('Postgres Ingestion', () => {
.scrollIntoView()
.contains('Usage Ingestion')
.click();

cy.get('#root\\/filterCondition')
.scrollIntoView()
.type(`s.query like '%${tableName}%'`);
cy.get('[data-testid="submit-btn"]')
.scrollIntoView()
.should('be.visible')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ const Suggestions = ({

const getEntitiesSuggestions = () => {
return (
<div role="none">
<div data-testid="global-search-suggestion-box" role="none">
{[
{ suggestions: tableSuggestions, searchIndex: SearchIndex.TABLE },
{ suggestions: topicSuggestions, searchIndex: SearchIndex.TOPIC },
Expand Down

0 comments on commit 54d89c8

Please sign in to comment.