forked from patternfly/patternfly-react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclipboardcopy.spec.ts
41 lines (36 loc) · 1.76 KB
/
clipboardcopy.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
describe('Clipboard Copy Demo Test', () => {
it('Navigate to demo section', () => {
cy.visit('http://localhost:3000/clipboard-copy-demo-nav-link');
});
it('Verify form input', () => {
cy.get('.pf-v6-c-form-control > input').should('exist');
});
it('Verify content expands', () => {
cy.get('.pf-v6-c-clipboard-copy__group [id*="toggle-"]').click();
cy.get('.pf-v6-c-clipboard-copy__expandable-content').should('exist');
});
it('Verify inline clipboard copy', () => {
cy.get('#inline-copy').should('have.class', 'pf-m-inline');
cy.get('#inline-copy').should('have.class', 'pf-m-block');
});
it('Verify hoverTip and clickTip render', () => {
cy.get('#tooltip-test .pf-v6-c-button.pf-m-control').focus();
cy.get('.pf-v6-c-tooltip').should('have.text', 'Copy button not clicked');
// Wait for defaulty entryDelay
cy.wait(500);
cy.get('#tooltip-test .pf-v6-c-button.pf-m-control').click();
cy.get('.pf-v6-c-tooltip').should('have.text', 'Copy button clicked');
});
it('Verify onTooltipHidden callback is called', () => {
cy.get('#onTooltipHidden-test .pf-v6-c-button.pf-m-control').focus();
cy.get('.pf-v6-c-tooltip').should('have.text', 'onTooltipHidden not clicked');
cy.get('#onTooltipHidden-test .pf-v6-c-button.pf-m-control').click();
cy.get('.pf-v6-c-tooltip').should('have.text', 'onTooltipHidden clicked');
cy.get('#onTooltipHidden-test input').focus();
cy.wait(500);
cy.get('#onTooltipHidden-test .pf-v6-c-button.pf-m-control').focus();
// By default onTooltipHidden is called within ClipboardCopy to set internal copied state,
// which will reset the tooltip content to the hoverTip prop value
cy.get('.pf-v6-c-tooltip').should('have.text', 'onTooltipHidden not clicked');
});
});