Skip to content

Commit

Permalink
Integration tests for broken safari link (#940)
Browse files Browse the repository at this point in the history
* copy link lint fix

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

* testing visit to copyed link works

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

* copy from clipboard and visit copied link

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

* Update copy_link.js

Signed-off-by: leanneeliatra <[email protected]>

* renamed copy_link and moved file location

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

---------

Signed-off-by: [email protected] <[email protected]>
Signed-off-by: leanneeliatra <[email protected]>
  • Loading branch information
leanneeliatra authored Nov 29, 2023
1 parent c875187 commit a6e67f9
Showing 1 changed file with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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
});
});
});
});
});
}

0 comments on commit a6e67f9

Please sign in to comment.