diff --git a/packages/manager/cypress/e2e/core/firewalls/migrate-linode-with-firewall.spec.ts b/packages/manager/cypress/e2e/core/firewalls/migrate-linode-with-firewall.spec.ts index b20e44d9b1f..7c56b10b32f 100644 --- a/packages/manager/cypress/e2e/core/firewalls/migrate-linode-with-firewall.spec.ts +++ b/packages/manager/cypress/e2e/core/firewalls/migrate-linode-with-firewall.spec.ts @@ -218,23 +218,16 @@ describe('Migrate Linode With Firewall', () => { fbtClick('Create Firewall'); }); - cy.get('[data-testid="textfield-input"]:first') - .should('be.visible') - .type(firewallLabel); + cy.findByLabelText('Label').should('be.visible').type(firewallLabel); - cy.get('[data-testid="textfield-input"]:last') - .should('be.visible') - .click() - .type(linode.label); + cy.findByLabelText('Linodes').should('be.visible').type(linode.label); - cy.get('[data-qa-autocomplete-popper]') - .findByText(linode.label) + ui.autocompletePopper + .findByTitle(linode.label) .should('be.visible') .click(); - cy.get('[data-testid="textfield-input"]:last') - .should('be.visible') - .click(); + cy.findByLabelText('Linodes').should('be.visible').click(); cy.findByText(linode.label).should('be.visible'); @@ -284,23 +277,16 @@ describe('Migrate Linode With Firewall', () => { fbtClick('Create Firewall'); }); - cy.get('[data-testid="textfield-input"]:first') - .should('be.visible') - .type(firewallLabel); + cy.findByLabelText('Label').should('be.visible').type(firewallLabel); - cy.get('[data-testid="textfield-input"]:last') - .should('be.visible') - .click() - .type(linodeLabel); + cy.findByLabelText('Linodes').should('be.visible').type(linodeLabel); cy.get('[data-qa-autocomplete-popper]') .findByText(linode.label) .should('be.visible') .click(); - cy.get('[data-testid="textfield-input"]:last') - .should('be.visible') - .click(); + cy.findByLabelText('Linodes').should('be.visible').click(); cy.findByText(linodeLabel).should('be.visible'); diff --git a/packages/manager/cypress/e2e/core/firewalls/update-firewall.spec.ts b/packages/manager/cypress/e2e/core/firewalls/update-firewall.spec.ts index 1f2af011634..34dbcec3266 100644 --- a/packages/manager/cypress/e2e/core/firewalls/update-firewall.spec.ts +++ b/packages/manager/cypress/e2e/core/firewalls/update-firewall.spec.ts @@ -128,7 +128,10 @@ const removeFirewallRules = (ruleLabel: string) => { */ const addLinodesToFirewall = (firewall: Firewall, linode: Linode) => { // Go to Linodes tab - ui.tabList.findTabByTitle('Linodes').should('be.visible').click(); + ui.tabList + .findTabByTitle('Linodes', { exact: false }) + .should('be.visible') + .click(); ui.button.findByTitle('Add Linodes to Firewall').should('be.visible').click(); diff --git a/packages/manager/cypress/support/ui/tab-list.ts b/packages/manager/cypress/support/ui/tab-list.ts index ae3ac1bbd1a..dd4816696dd 100644 --- a/packages/manager/cypress/support/ui/tab-list.ts +++ b/packages/manager/cypress/support/ui/tab-list.ts @@ -1,3 +1,5 @@ +import type { SelectorMatcherOptions } from '@testing-library/cypress'; + /** * Tab list UI element. */ @@ -15,10 +17,14 @@ export const tabList = { * Finds a tab within a tab list by its title. * * @param tabTitle - Title of tab to find. + * @param options - Selector matcher options. * * @returns Cypress chainable. */ - findTabByTitle: (tabTitle: string): Cypress.Chainable => { - return cy.get('[data-reach-tab-list]').findByText(tabTitle); + findTabByTitle: ( + tabTitle: string, + options?: SelectorMatcherOptions + ): Cypress.Chainable => { + return cy.get('[data-reach-tab-list]').findByText(tabTitle, options); }, };