Skip to content

Commit

Permalink
imporve link verification to support version
Browse files Browse the repository at this point in the history
Signed-off-by: Hailong Cui <[email protected]>
  • Loading branch information
Hailong-am committed Nov 14, 2024
1 parent 268a50c commit a744f86
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,34 +118,38 @@ if (Cypress.env('WORKSPACE_ENABLED')) {
cy.get('.euiLink')
.contains('Quickstart guide')
.should('be.visible')
.and(
'have.attr',
'href',
'https://opensearch.org/docs/latest/dashboards/quickstart/'
);
.and('have.attr', 'href')
.and((href) => {
expect(href).to.match(
/https:\/\/opensearch.org\/docs\/(latest|(\d.)+)\/dashboards\/quickstart\/$/
);
});
cy.get('.euiLink')
.contains('Building data visualizations')
.should('be.visible')
.and(
'have.attr',
'href',
'https://opensearch.org/docs/latest/dashboards/visualize/viz-index/'
);
.and('have.attr', 'href')
.and((href) => {
expect(href).to.match(
/https:\/\/opensearch.org\/docs\/(latest|(\d.)+)\/dashboards\/visualize\/viz-index\/$/
);
});
cy.get('.euiLink')
.contains('Creating dashboards')
.should('be.visible')
.and(
'have.attr',
'href',
'https://opensearch.org/docs/latest/dashboards/dashboard/index/'
);
.and('have.attr', 'href')
.and((href) => {
expect(href).to.match(
/https:\/\/opensearch.org\/docs\/(latest|(\d.)+)\/dashboards\/dashboard\/index\/$/
);
});
cy.contains('Learn more in Documentation')
.should('be.visible')
.and(
'have.attr',
'href',
'https://opensearch.org/docs/latest/dashboards/index/'
);
.and('have.attr', 'href')
.and((href) => {
expect(href).to.match(
/https:\/\/opensearch.org\/docs\/(latest|(\d.)+)\/dashboards\/index\/$/
);
});
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -127,27 +127,30 @@ if (Cypress.env('WORKSPACE_ENABLED')) {
// get a link with text as Quickstart guide
cy.get('a')
.contains('Quickstart guide')
.should(
'have.attr',
'href',
'https://opensearch.org/docs/latest/dashboards/quickstart/'
);
.should('have.attr', 'href')
.and((href) => {
expect(href).to.match(
/^https:\/\/opensearch.org\/docs\/(latest|(\d.)+)\/dashboards\/quickstart\/$/
);
});

cy.get('a')
.contains('Building data visualizations')
.should(
'have.attr',
'href',
'https://opensearch.org/docs/latest/dashboards/visualize/viz-index/'
);
.should('have.attr', 'href')
.and((href) => {
expect(href).to.match(
/^https:\/\/opensearch.org\/docs\/(latest|(\d.)+)\/dashboards\/visualize\/viz-index\/$/
);
});

cy.get('a')
.contains('Creating dashboards')
.should(
'have.attr',
'href',
'https://opensearch.org/docs/latest/dashboards/dashboard/index/'
);
.should('have.attr', 'href')
.and((href) => {
expect(href).to.match(
/^https:\/\/opensearch.org\/docs\/(latest|(\d.)+)\/dashboards\/dashboard\/index\/$/
);
});
});
});
}

0 comments on commit a744f86

Please sign in to comment.