From a6e67f96d75fa76a74a4912c9cbc28544f952562 Mon Sep 17 00:00:00 2001 From: leanneeliatra <131779422+leanneeliatra@users.noreply.github.com> Date: Wed, 29 Nov 2023 09:38:17 +0000 Subject: [PATCH] Integration tests for broken safari link (#940) * copy link lint fix Signed-off-by: leanne.laceybyrne@eliatra.com * testing visit to copyed link works Signed-off-by: leanne.laceybyrne@eliatra.com * copy from clipboard and visit copied link Signed-off-by: leanne.laceybyrne@eliatra.com * Update copy_link.js Signed-off-by: leanneeliatra <131779422+leanneeliatra@users.noreply.github.com> * renamed copy_link and moved file location Signed-off-by: leanne.laceybyrne@eliatra.com --------- Signed-off-by: leanne.laceybyrne@eliatra.com Signed-off-by: leanneeliatra <131779422+leanneeliatra@users.noreply.github.com> --- .../dashboard_share_copy_link_test.js | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 cypress/integration/core-opensearch-dashboards/opensearch-dashboards/dashboard_share_copy_link_test.js diff --git a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/dashboard_share_copy_link_test.js b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/dashboard_share_copy_link_test.js new file mode 100644 index 000000000..b955145c5 --- /dev/null +++ b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/dashboard_share_copy_link_test.js @@ -0,0 +1,40 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ +import { STACK_MANAGEMENT_PATH } from '../../../utils/dashboards/constants'; + +if (Cypress.env('SECURITY_ENABLED')) { + describe('Copy Link functionality working', () => { + it('Tests the link copys and can be routed to in Safari', () => { + cy.visit(STACK_MANAGEMENT_PATH); + cy.waitForLoader(); + cy.getElementByTestId('toggleNavButton').click(); + cy.get('span[title="Discover"]').click(); + cy.getElementByTestId('shareTopNavButton').click(); + cy.getElementByTestId('copyShareUrlButton').click(); + + // Capture the copied content + cy.window().then((win) => { + // Access the clipboard contents + cy.document().then(() => { + cy.wait(1000); // Wait for clipboard data to be available + cy.log('Trying to read clipboard data...'); + + // Read the clipboard text + cy.wrap(win.navigator.clipboard.readText()).then((clipboardData) => { + cy.log('url copied:', clipboardData); + + // Assert that the clipboard has data + expect(clipboardData).to.have.length.greaterThan(0); + + cy.visit(clipboardData); + cy.waitForLoader(); + + // Now on copied URL page + }); + }); + }); + }); + }); +}