Skip to content

Commit 76683d4

Browse files
Add cypress tests for checking rel
1 parent 396dca0 commit 76683d4

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tests/cypress/integration/site/components/com_weblinks/Weblinks.cy.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,36 @@ describe('Test in frontend that the weblinks', () => {
9797
});
9898
});
9999
});
100+
it('should show correct rel attribute for follow', () => {
101+
// Set follow parameter to 'follow'
102+
cy.db_updateExtensionParameter('follow', 'follow', 'com_weblinks');
103+
// Create test weblink with title and URL
104+
cy.db_createWeblink({
105+
title: 'Follow Test',
106+
url: 'https://follow.example',
107+
}).then((weblink) => {
108+
// Visit weblink category page
109+
cy.visit(`/index.php?option=com_weblinks&view=category&id=${weblink.catid}`);
110+
// Verify rel attribute is 'follow'
111+
cy.contains('a', 'Follow Test')
112+
.should('have.attr', 'rel', 'follow');
113+
});
114+
});
115+
116+
it('should show correct rel attribute for nofollow', () => {
117+
// Set follow parameter to 'nofollow'
118+
cy.db_updateExtensionParameter('follow', 'nofollow', 'com_weblinks');
119+
// Create test weblink with title and URL
120+
cy.db_createWeblink({
121+
title: 'Nofollow Test',
122+
url: 'https://nofollow.example',
123+
}).then((weblink) => {
124+
// Visit weblink category page
125+
cy.visit(`/index.php?option=com_weblinks&view=category&id=${weblink.catid}`);
126+
// Verify rel attribute is 'nofollow'
127+
cy.contains('a', 'Nofollow Test')
128+
.should('have.attr', 'rel', 'nofollow');
129+
});
130+
});
100131
});
101132

0 commit comments

Comments
 (0)