Skip to content

Commit 23d4e6f

Browse files
committed
first commit
1 parent 72354e3 commit 23d4e6f

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tests/cypress/integration/performance.cy.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,39 @@ describe( 'Performance Page', { testIsolation: true }, () => {
8484
data.requestCount
8585
);
8686
} );
87+
88+
it( 'hasLinkPrefetchClick capability', () => {
89+
cy.exec(
90+
`npx wp-env run cli wp option update nfd_link_prefetch_settings '{"activeOnDesktop": true, "behavior": "mouseDown"}' --format=json`
91+
);
92+
cy.exec(
93+
`npx wp-env run cli wp option update _transient_nfd_site_capabilities '{"hasLinkPrefetchClick": true, "hasLinkPrefetchHover": false}' --format=json`
94+
);
95+
cy.reload();
96+
performanceLocators.verifyIfLinkPreFetchIsDisplayed();
97+
performanceLocators.verifyIfToggleIsEnabled();
98+
performanceLocators.linkPrefetchCapabilityCheck('onlyMouseDown');
99+
} );
100+
101+
it( 'hasLinkPrefetchHover capability', () => {
102+
cy.exec(
103+
`npx wp-env run cli wp option update nfd_link_prefetch_settings '{"activeOnDesktop": true, "behavior": "mouseHover"}' --format=json`
104+
);
105+
cy.exec(
106+
`npx wp-env run cli wp option update _transient_nfd_site_capabilities '{"hasLinkPrefetchClick": true, "hasLinkPrefetchHover": true}' --format=json`
107+
);
108+
cy.reload();
109+
performanceLocators.verifyIfLinkPreFetchIsDisplayed();
110+
performanceLocators.verifyIfToggleIsEnabled();
111+
performanceLocators.linkPrefetchCapabilityCheck('both');
112+
} );
113+
114+
it( 'LinkPrefetch Capabilities to false', () => {
115+
cy.exec(
116+
`npx wp-env run cli wp option update _transient_nfd_site_capabilities '{"hasLinkPrefetchClick": false, "hasLinkPrefetchHover": false}' --format=json`
117+
);
118+
cy.reload();
119+
cy.get( performanceLocators._linkPrefetchText ).should( 'not.exist' );
120+
} );
121+
87122
} );

0 commit comments

Comments
 (0)