Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(cypress): upgrade cypress to v8 and turn on tests #2063

Closed
wants to merge 9 commits into from
336 changes: 207 additions & 129 deletions .github/workflows/on_pull_request.yml

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"runMode": 2,
"openMode": 0
},
"blockHosts": "*.google-analytics.com"
"blockHosts": "*.google-analytics.com",
"nodeVersion": "system"
Copy link
Contributor Author

@andioneto andioneto Nov 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ The default sets the node version to the package that is bundled with Cypress. See here for more info

This means that we were not necessarily running our tests with Node v12 as specified in our workflow. This instructs Cypress to use the version on the CI machine(s) (or local machine).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those docs state the default value for nodeVersion is system. You're just resetting the value to be the default value. You can remove it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also states its deprecated and will be removed
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SiTaggart I'm going to remove this for now, but FWIW added this line to print the node version cypress is using it printed out the version that is bundled with the cypress version.

I wonder if the above snippet from the docs is true for more recent versions of cypress, but we are currently a few major version behind.

}
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/alert.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Alert component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('alert');
cy.visit('/components/alert');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/anchor.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Anchor component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('anchor');
cy.visit('/components/anchor');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/avatar.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Avatar component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('avatar');
cy.visit('/components/avatar');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/badge.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Badge component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('badge');
cy.visit('/components/badge');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/breadcrumb.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Breadcrumb component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('breadcrumb');
cy.visit('/components/breadcrumb');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/button.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Button component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('button');
cy.visit('/components/button');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/card.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Card component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('card');
cy.visit('/components/card');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/checkbox.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Checkbox component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('checkbox');
cy.visit('/components/checkbox');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/combobox.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Combobox component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('combobox');
cy.visit('/components/combobox');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/data-grid.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Data-grid component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('data-grid');
cy.visit('/components/data-grid');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/date-picker.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Date-picker component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('date-picker');
cy.visit('/components/date-picker');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/disclosure.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Disclosure component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('disclosure');
cy.visit('/components/disclosure');
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Display-pill-group component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('display-pill-group');
cy.visit('/components/display-pill-group');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/form-pill-group.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Form-pill-group component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('form-pill-group');
cy.visit('/components/form-pill-group');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/heading.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Heading component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('heading');
cy.visit('/components/heading');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/help-text.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Help-text component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('help-text');
cy.visit('/components/help-text');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/input.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Input component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('input');
cy.visit('/components/input');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/label.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Label component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('label');
cy.visit('/components/label');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/list.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('List component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('list');
cy.visit('/components/list');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/menu.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Menu component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('menu');
cy.visit('/components/menu');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/modal.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Modal component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('modal');
cy.visit('/components/modal');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/pagination.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Pagination component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('pagination');
cy.visit('/components/pagination');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/paragraph.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Paragraph component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('paragraph');
cy.visit('/components/paragraph');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/popover.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Popover component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('popover');
cy.visit('/components/popover');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/radio-group.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Radio-group component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('radio-group');
cy.visit('/components/radio-group');
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Screen-reader-only component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('screen-reader-only');
cy.visit('/components/screen-reader-only');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/select.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Select component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('select');
cy.visit('/components/select');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/separator.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Separator component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('separator');
cy.visit('/components/separator');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/skeleton-loader.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Skeleton-loader component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('skeleton-loader');
cy.visit('/components/skeleton-loader');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/spinner.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Spinner component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('spinner');
cy.visit('/components/spinner');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/table.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Table component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('table');
cy.visit('/components/table');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/tabs.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Tabs component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('tabs');
cy.visit('/components/tabs');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/textarea.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Textarea component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('textarea');
cy.visit('/components/textarea');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/time-picker.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Time-picker component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('time-picker');
cy.visit('/components/time-picker');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/toast.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Toast component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('toast');
cy.visit('/components/toast');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/tooltip.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Tooltip component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('tooltip');
cy.visit('/components/tooltip');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/integration/e2e/components/truncate.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Truncate component documentation page', () => {
beforeEach(() => {
cy.abortPrefetchRequests('truncate');
cy.visit('/components/truncate');
});

Expand Down
1 change: 0 additions & 1 deletion cypress/integration/e2e/patterns/create.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ describe('Create patterns documentation page', () => {

cy.checkInPageNavigationLinks();
cy.checkPageAside();
cy.checkLivePreviews();
});
});
1 change: 0 additions & 1 deletion cypress/integration/e2e/patterns/data-export.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ describe('Data-export patterns documentation page', () => {

cy.checkInPageNavigationLinks();
cy.checkPageAside();
cy.checkLivePreviews();
});
});
1 change: 0 additions & 1 deletion cypress/integration/e2e/patterns/delete.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ describe('Delete patterns documentation page', () => {

cy.checkInPageNavigationLinks();
cy.checkPageAside();
cy.checkLivePreviews();
});
});
1 change: 0 additions & 1 deletion cypress/integration/e2e/patterns/empty-states.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ describe('Empty-states patterns documentation page', () => {

cy.checkInPageNavigationLinks();
cy.checkPageAside();
cy.checkLivePreviews();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ describe('Notifications-and-feedback patterns documentation page', () => {
});

it('should render the notifications-and-feedback patterns page correctly', () => {
cy.pageHeaderShouldBeVisible('Notifications And Feedback');
cy.pageHeaderShouldBeVisible('Notification and feedback patterns');

cy.checkInPageNavigationLinks();
cy.checkPageAside();
cy.checkLivePreviews();
});
});
1 change: 0 additions & 1 deletion cypress/integration/e2e/patterns/object-details.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ describe('Object-details patterns documentation page', () => {

cy.checkInPageNavigationLinks();
cy.checkPageAside();
cy.checkLivePreviews();
});
});
1 change: 0 additions & 1 deletion cypress/integration/e2e/patterns/status.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ describe('Status patterns documentation page', () => {

cy.checkInPageNavigationLinks();
cy.checkPageAside();
cy.checkLivePreviews();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ describe('Modal-dialog-primitive primitives documentation page', () => {

cy.checkInPageNavigationLinks();
cy.checkPageAside();
cy.checkLivePreviews();
cy.checkChangelogRevealer();
});
});
41 changes: 23 additions & 18 deletions cypress/integration/sidebar-navigation/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
describe('Sidebar navigation', () => {
it('opens the sidebar disclosures', () => {
beforeEach(() => {
// The sidebar navigation requires this endpoint's data to load in order for the expected behavior to be functional.
cy.intercept('/page-data/index/page-data.json').as('indexPageData');
cy.visit('/');
cy.wait(2500);
// waiting for the data to load ensures that our tests only run when the page is ready to be interacted with.
cy.wait('@indexPageData');
});

cy.get('[data-cy=getting-started-button]').click({force: true}).should('have.attr', 'aria-expanded', 'true');
cy.get('[data-cy=getting-started-list]').should('be.visible');
it('opens the sidebar disclosures', () => {
cy.get('[data-cy="getting-started-button"]').click().shouldHaveAttribute('aria-expanded', 'true');
cy.getInFixedContainer('[data-cy="getting-started-list"]').should('be.visible');

cy.get('[data-cy=design-tokens-button]').click({force: true}).should('have.attr', 'aria-expanded', 'true');
cy.get('[data-cy=design-tokens-list]').should('be.visible');
cy.get('[data-cy="design-tokens-button"]').click().shouldHaveAttribute('aria-expanded', 'true');
cy.getInFixedContainer('[data-cy="design-tokens-list"]').should('be.visible');

cy.get('[data-cy=components-button]').click({force: true}).should('have.attr', 'aria-expanded', 'true');
cy.get('[data-cy=components-list]').should('be.visible');
cy.get('[data-cy="components-button"]').click().shouldHaveAttribute('aria-expanded', 'true');
cy.getInFixedContainer('[data-cy="components-list"]').should('be.visible');

cy.get('[data-cy=primitives-button]').click({force: true}).should('have.attr', 'aria-expanded', 'true');
cy.get('[data-cy=primitives-list]').should('be.visible');
cy.get('[data-cy="primitives-button"]').click().shouldHaveAttribute('aria-expanded', 'true');
cy.getInFixedContainer('[data-cy="primitives-list"]').should('be.visible');

cy.get('[data-cy=layout-button]').click({force: true}).should('have.attr', 'aria-expanded', 'true');
cy.get('[data-cy=layout-list]').should('be.visible');
cy.get('[data-cy="layout-button"]').click().shouldHaveAttribute('aria-expanded', 'true');
cy.getInFixedContainer('[data-cy="layout-list"]').should('be.visible');

cy.get('[data-cy=icons-button]').click({force: true}).should('have.attr', 'aria-expanded', 'true');
cy.get('[data-cy=icons-list]').should('be.visible');
cy.get('[data-cy="icons-button"]').click().shouldHaveAttribute('aria-expanded', 'true');
cy.getInFixedContainer('[data-cy="icons-list"]').should('be.visible');

cy.get('[data-cy=content-button]').click({force: true}).should('have.attr', 'aria-expanded', 'true');
cy.get('[data-cy=content-list]').should('be.visible');
cy.get('[data-cy="content-button"]').click().shouldHaveAttribute('aria-expanded', 'true');
cy.getInFixedContainer('[data-cy="content-list"]').should('be.visible');

cy.get('[data-cy=patterns-button]').click({force: true}).should('have.attr', 'aria-expanded', 'true');
cy.get('[data-cy=patterns-list]').should('be.visible');
cy.get('[data-cy="patterns-button"]').click().shouldHaveAttribute('aria-expanded', 'true');
cy.getInFixedContainer('[data-cy="patterns-list"]').should('be.visible');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't recall these ever being flakey, and now they are. This leads me to wonder if this getInFixedContainer is the cause of flakiness.

});
});
Loading