Skip to content

Commit

Permalink
Try final cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Ho <dxho@amazon.com>
  • Loading branch information
derek-ho committed Mar 18, 2024
1 parent d5522d0 commit 3f577d5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
*/

const createDataSource = () => {
cy.visit('http://localhost:5601/app/management/opensearch-dashboards/dataSources/create');
cy.visit('http://localhost:5601/app/management/opensearch-dashboards/dataSources/create', {
failOnStatusCode: false,
});
cy.get('[data-test-subj="createDataSourceFormTitleField"]').focus().type('9202');
cy.get('[data-test-subj="createDataSourceFormEndpointField"]')
.focus()
Expand Down
15 changes: 9 additions & 6 deletions test/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,15 @@ Cypress.Commands.add('loginWithSamlMultiauth', () => {
cy.get('button[id=btn-sign-in]').should('be.visible').click();
});

Cypress.Commands.overwrite('visit', (orig, url, options = {}) => {
if (Cypress.env('LOGIN_AS_ADMIN')) {
options.auth = ADMIN_AUTH;
}
orig(url, options);
});
if (Cypress.env('LOGIN_AS_ADMIN')) {
// Define custom cy.visit() only if LOGIN_AS_ADMIN is true
Cypress.Commands.overwrite('visit', (orig, url, options = {}) => {
if (Cypress.env('LOGIN_AS_ADMIN')) {
options.auth = ADMIN_AUTH;
}
orig(url, options);
});
}

Cypress.Commands.add('shortenUrl', (data, tenant) => {
cy.request({
Expand Down

0 comments on commit 3f577d5

Please sign in to comment.