Skip to content

Commit

Permalink
Update firewall e2e tests for NodeBalancer UI improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe D'Amore committed Sep 6, 2023
1 parent 07e38f2 commit d9ebf81
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -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');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
10 changes: 8 additions & 2 deletions packages/manager/cypress/support/ui/tab-list.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { SelectorMatcherOptions } from '@testing-library/cypress';

/**
* Tab list UI element.
*/
Expand All @@ -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);
},
};

0 comments on commit d9ebf81

Please sign in to comment.