Skip to content

Commit

Permalink
test: fix testcases after package bump IV
Browse files Browse the repository at this point in the history
  • Loading branch information
herleraja committed Apr 23, 2024
1 parent 01903e3 commit 413fe77
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion packages/react/src/components/Card/Card.test.e2e.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ describe('Card', () => {
/>
);

cy.findByRole('button', { name: 'open and close list of options' }).click();
cy.findByRole('button', { name: 'Open and close list of options' }).click();
cy.findByRole('menu').then(($el) => {
const menu = $el[0].getBoundingClientRect();
expect(menu.width).to.be.greaterThan(160);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ export const I18NLabels = () => {
monthlyLabel: text('monthlyLabel', 'Monthly'),
overflowMenuDescription: text(
'overflowMenuDescription',
'open and close list of options'
'Open and close list of options'
),
// card actions
expandLabel: text('expandLabel', 'Expand to fullscreen'),
Expand Down
20 changes: 10 additions & 10 deletions packages/react/src/components/Header/Header.test.e2e.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ describe(
cy.findByLabelText('HiddenButton').should('not.be.visible');
cy.findByLabelText('Announcements').should('be.visible');
cy.findByRole('button', { name: 'help' }).should('be.visible');
cy.findByRole('button', { name: 'open and close list of options' }).should('not.exist');
cy.findByRole('button', { name: 'Open and close list of options' }).should('not.exist');
cy.findByRole('button', { name: 'user', label: 'user' }).should('be.visible');
});

Expand All @@ -210,18 +210,18 @@ describe(

cy.findByLabelText('Announcements').should('not.exist');
cy.findByRole('button', { name: 'help' }).should('not.exist');
cy.findByRole('button', { name: 'open and close list of options' }).click();
cy.findByRole('button', { name: 'Open and close list of options' }).click();
cy.findByRole('menuitem', { name: 'Announcements' })
.should('be.visible')
.click()
.should(() => {
expect(onClick).to.have.been.called;
});
cy.findByRole('button', { name: 'open and close list of options' })
cy.findByRole('button', { name: 'Open and close list of options' })
.find('svg')
.invoke('attr', 'description')
.should('eq', 'Open menu');
cy.findByRole('button', { name: 'open and close list of options' }).click();
cy.findByRole('button', { name: 'Open and close list of options' }).click();
cy.findByRole('menuitem', { name: 'help' }).should('be.visible').click();
cy.findByRole('button', { name: 'help' })
.find('svg')
Expand All @@ -236,19 +236,19 @@ describe(
.findByTestId('action-btn__panel')
.should('not.exist');

cy.findByRole('button', { name: 'open and close list of options' }).click();
cy.findByRole('button', { name: 'Open and close list of options' }).click();
cy.findByRole('menuitem', { name: 'user' }).click();
cy.findByText('[email protected]').should('be.visible');
cy.findByTestId('menuitem', { name: 'user' })
.find('svg')
.invoke('attr', 'description')
.should('eq', 'Close menu');
cy.findByTestId('menuitem', { name: 'user' }).click();
cy.findByRole('button', { name: 'open and close list of options' }).should('be.visible');
cy.findByRole('button', { name: 'Open and close list of options' }).should('be.visible');

// click the left side specifically to _not_ click the svg element right in the center
// to ensure overflow also opens when clicking the button element.
cy.findByRole('button', { name: 'open and close list of options' }).click(5, 5, {
cy.findByRole('button', { name: 'Open and close list of options' }).click(5, 5, {
force: true,
});
cy.findByRole('menuitem', { name: 'Announcements' }).should('be.visible');
Expand Down Expand Up @@ -278,7 +278,7 @@ describe(

cy.findByLabelText('Announcements').should('not.exist');
cy.findByRole('button', { name: 'help' }).should('not.exist');
cy.findByRole('button', { name: 'open and close list of options' }).click();
cy.findByRole('button', { name: 'Open and close list of options' }).click();
cy.findByRole('menuitem', { name: 'Announcements' })
.should('be.visible')
.click()
Expand All @@ -303,7 +303,7 @@ describe(

mount(<Header {...commonProps} isActionItemVisible={isActionItemVisible} />);

cy.findByRole('button', { name: 'open and close list of options' }).click();
cy.findByRole('button', { name: 'Open and close list of options' }).click();
cy.findByRole('menuitem', { name: 'Announcements' }).should('be.visible');
cy.findByRole('button', { name: 'Custom icon 1', label: 'Custom icon 1' }).should(
'not.exist'
Expand All @@ -324,7 +324,7 @@ describe(

mount(<Header {...commonProps} />);

cy.findByRole('button', { name: 'open and close list of options' }).click();
cy.findByRole('button', { name: 'Open and close list of options' }).click();
cy.findByRole('menuitem', { name: 'Announcements' }).should('be.visible');
// I don't know if this is actually necessary in cypress, but just to be safe.
cy.window().then((win) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -796,8 +796,8 @@ describe('HierarchyList', () => {

const listItems = screen.queryAllByRole('listitem');

expect(within(listItems[2]).queryAllByText('Luke Voit').length).toBeGreaterThanOrEqual(1);
expect(within(listItems[3]).queryAllByText('Gary Sanchez').length).toBeGreaterThanOrEqual(1);
expect(within(listItems[1]).queryAllByText('Luke Voit').length).toBeGreaterThanOrEqual(1);
expect(within(listItems[2]).queryAllByText('Gary Sanchez').length).toBeGreaterThanOrEqual(1);
});

it('should clear selected ids in bulk mode when cancelled.', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/OverflowMenu/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class IotOverflowMenu extends Component {
static contextType = PrefixContext;

static defaultProps = {
ariaLabel: 'open and close list of options',
ariaLabel: 'Open and close list of options',
children: [],
className: '',
direction: DIRECTION_BOTTOM,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ describe('StatefulTable', () => {
cy.get('tr').should('have.length', 17);
cy.get('tr').eq(1).find('td').eq(0).should('have.text', 'bottle toyota bottle 5');

cy.findAllByLabelText('open and close list of options').eq(2).click();
cy.findAllByLabelText('Open and close list of options').eq(2).click();
cy.findAllByText('Multi-sort').eq(0).click();
cy.findByRole('button', { name: 'Add column' }).click();
cy.findByRole('button', { name: 'Sort' }).click();
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/Table/Table.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const i18nTest = {

const i18nDefault = defaultProps({}).i18n;

const OVERFLOW_BUTTON_LABEL = 'open and close list of options';
const OVERFLOW_BUTTON_LABEL = 'Open and close list of options';

describe('Table', () => {
beforeAll(() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/TableCard/TableCard.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ describe('TableCard', () => {
);

const firstRow = container.querySelectorAll('tbody > tr')[0];
expect(within(firstRow).queryByLabelText('open and close list of options')).toBeNull();
expect(within(firstRow).queryByLabelText('Open and close list of options')).toBeNull();
});

it('should render an action icon that is a node.', () => {
Expand Down

0 comments on commit 413fe77

Please sign in to comment.