Skip to content

Commit

Permalink
fix: Updated Select Preview, Popup and Modal spec
Browse files Browse the repository at this point in the history
  • Loading branch information
josh-bagwell committed Nov 22, 2024
1 parent 1eaf803 commit 724be9b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
5 changes: 3 additions & 2 deletions cypress/component/Modal.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ context(`given the [Testing/Popups/Modal, With Tooltips] story is rendered`, ()
});
it(`should open the 'OK' tooltip`, () => {
cy.findByRole('button', {name: 'OK'}).should('have.focus');
cy.findByRole('button', {name: 'OK'}).should('exist');
cy.findByRole('tooltip', {name: 'Really, Really, Really, Really, Really sure'}).should(
'be.visible'
);
Expand Down Expand Up @@ -463,11 +464,11 @@ context(`given the [Components/Popups/Modal, Custom focus] story is rendered`, (
});
});

context('when the target button is clicked', () => {
context.only('when the target button is clicked', () => {
beforeEach(() => {
cy.findByRole('button', {name: 'Acknowledge License'}).should('exist');
cy.findByRole('button', {name: 'Acknowledge License'}).focus();
cy.focused().click();
cy.findByRole('button', {name: 'Acknowledge License'}).should('have.focus').click();
});

it('should open the modal', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/component/Popup.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ describe('Popup', () => {
});
});

context.only(
context(
`given the [Testing/Popups/Popup, PopupWithFallbackPlacements] example is rendered`,
() => {
beforeEach(() => {
Expand Down
15 changes: 10 additions & 5 deletions cypress/component/SelectPreview.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ describe('Select', () => {
beforeEach(() => {
cy.findByRole('button', {name: 'Label'})
.pipe(h.selectPreview.getMenu)
.realPress('{enter}');
.type('{enter}');
});

context('the select button', () => {
Expand Down Expand Up @@ -412,7 +412,7 @@ describe('Select', () => {
'when the menu is closed WITHOUT selecting the newly focused option ("Phone")',
() => {
beforeEach(() => {
cy.findByRole('button', {name: 'Label'}).type('{esc}');
cy.findByRole('button', {name: 'Label'}).realPress('{esc}');
});

context('when the menu is re-opened AFTER it has fully closed', () => {
Expand Down Expand Up @@ -528,8 +528,12 @@ describe('Select', () => {

context('when the down arrow key is pressed 2 more times', () => {
beforeEach(() => {
cy.realPress('{downarrow}');
cy.realPress('{downarrow}');
cy.findByRole('button', {name: 'Label (Disabled Options)'})
.pipe(h.selectPreview.getMenu)
.realPress('{downarrow}');
cy.findByRole('button', {name: 'Label (Disabled Options)'})
.pipe(h.selectPreview.getMenu)
.realPress('{downarrow}');
});

context('the menu', () => {
Expand Down Expand Up @@ -629,7 +633,8 @@ describe('Select', () => {

context('when "s{500ms delay}s" is typed', () => {
beforeEach(() => {
cy.findByRole('button', {name: 'Label'}).realType('ss', {delay: 500});
cy.findByRole('button', {name: 'Label'}).realType('s', {delay: 500});
cy.findByRole('button', {name: 'Label'}).realType('s', {delay: 500});
});

context('the select button', () => {
Expand Down

0 comments on commit 724be9b

Please sign in to comment.