Skip to content

Commit f467b74

Browse files
authored
Verify request links (#40934)
* Verify request links to user are correct * removed console logs * Fixed linting errors * removed unnecessary line of code
1 parent 32149dd commit f467b74

File tree

1 file changed

+40
-0
lines changed
  • tests/System/integration/site/components/com_privacy

1 file changed

+40
-0
lines changed

tests/System/integration/site/components/com_privacy/Request.cy.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,44 @@ describe('Test in frontend that the privacy request view', () => {
6868
});
6969
});
7070
});
71+
72+
it('can verify link sent to user is valid', () => {
73+
cy.visit('/index.php?option=com_privacy&view=request');
74+
cy.get('#jform_request_type').select('Export');
75+
cy.get('.controls > .btn').click();
76+
77+
cy.task('getMails').then((mails) => {
78+
const str = mails[1].body;
79+
80+
const firstSplit = str.split('URL: ')[1];
81+
const link = firstSplit.split('\n')[0];
82+
83+
cy.visit(link);
84+
cy.get('.controls > .btn').click();
85+
86+
cy.get('.alert-message').should('have.text', 'Your information request has been confirmed. We will process your request as soon as possible and the export will be sent to your email.');
87+
});
88+
});
89+
90+
it('can verify the individual link and password to copy/paste to the user is valid', () => {
91+
cy.visit('/index.php?option=com_privacy&view=request');
92+
cy.get('#jform_request_type').select('Export');
93+
cy.get('.controls > .btn').click();
94+
95+
cy.task('getMails').then((mails) => {
96+
const str = mails[1].body;
97+
98+
const firstSplitURL = str.split('paste your token into the form.\n')[1];
99+
const secondSplitURL = firstSplitURL.split('URL: ')[1];
100+
const link = secondSplitURL.split('\n')[0];
101+
102+
const firstSplitToken = str.split('Token: ')[1];
103+
const token = firstSplitToken.split('\n')[0];
104+
105+
cy.visit(link);
106+
cy.get('#jform_confirm_token').type(token);
107+
cy.get('.controls > .btn').click();
108+
cy.get('.alert-message').should('have.text', 'Your information request has been confirmed. We will process your request as soon as possible and the export will be sent to your email.');
109+
});
110+
});
71111
});

0 commit comments

Comments
 (0)