https://github.com/mailslurp/examples
const assert = require('assert');
const MailSlurp = require('mailslurp-client').default;
const mailslurp = new MailSlurp({ apiKey: process.env.API_KEY });
describe('sign-up process', () => {
it('can load oauth demo site', async () => {
await page.goto('https://playground.mailslurp.com')
await expect(page).toMatch('Sign in to your account')
})
it('can click sign up link', async () => {
await expect(page).toClick('[data-test="sign-in-create-account-link"]')
await expect(page).toMatch('Testable Sign Up Form')
})
const password = "test-password";
let inbox;
let code;
it('can sign-up with a new email address', async () => {
// create a new email address for the test run
inbox = await mailslurp.createInbox();
// fill out the new user form with generating email address
await expect(page).toFillForm('[data-test="sign-up-body-section"]', {
email: inbox.emailAddress,
password: password
})
// submit the new user form (which will send a confirmation email)
await expect(page).toClick('[data-test="sign-up-create-account-button"]')
});
it('can fetch confirmation code', async () => {
// fetch the email from mailslurp
const email = await mailslurp.waitForLatestEmail(inbox.id)
// verify that it contains the code
assert.strictEqual(/verification code is/.test(email.body), true);
// extract the confirmation code
code = /([0-9]{6})$/.exec(email.body)[1]
});
it('can enter confirmation code and confirm user', async () => {
await expect(page).toFillForm('[data-test="confirm-sign-up-body-section"]', {
code: code
})
await expect(page).toClick('[data-test="confirm-sign-up-confirm-button"]')
});
it('can log in with confirmed account', async () => {
await expect(page).toMatch('Sign in to your account')
// fill out username (email) and password
await expect(page).toFillForm('#root', {
username: inbox.emailAddress,
password: password
})
// submit
await expect(page).toClick('[data-test="sign-in-sign-in-button"]')
});
it('shows the successful greeting', async () => {
await page.waitForFunction('document.body.innerText.includes("Welcome")');
await expect(page).toMatchElement('h1', { text: 'Welcome' })
});
})
{
"name": "mailslurp-jest-puppeteer-example",
"version": "1.0.0",
"description": "Example use of MailSlurp and Jest Puppeteer",
"scripts": {
"test": "jest"
},
"jest": {
"preset": "jest-puppeteer",
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.[jt]sx?$"
},
"devDependencies": {
"jest": "^27.2.5",
"jest-puppeteer": "^6.0.0",
"puppeteer": "^10.4.0"
},
"dependencies": {
"mailslurp-client": "^15.0.1"
}
}
�PNG
IHDR X �v�p sRGB ��� IDATx���wX�����ׁsKp*�8p��p�J�̝��M+mi�Ԭ4K[6-��д2��p�9J͑�"�8����� O��
o�����ι��s=���|>7&��� ��� ��A ` �@ � �0 �!� 0 �a C ` �@ � �0 �!� 0 �a C ` �@ � �0 �!� 0 �a C ` �@ � �0 �!� 0 �a C ` Ø�� �j9���. ��d2w �!��_���A �����ߋ��d�x~C=���tx ����a2�
<��7BPR@P��5|8�N���x��� (�·777W qss+����� ���#//Oyyy�X,2�ͲX,�7[ �K�rrrd�ە��-www9�N����B�DA�d��l|u���C���zxyy�j�se ����JKK�$�����ݽ@!����%ڟ�Z����b�wI �(����I�� JƯ�D����î ���Cr8�!��1O%
%��� ����)��!��Q�n�@IC A�u����t�lf� �b�Z]= �
�4�xyyy��
��pwww��?�J>աD� ����x�� p�z��� �0 �!� 0 �a C ` �@ � �0 �!� 0 �a C ` �@ � �0 �!� 0 �a C ` �@ � �0 �!� 0 �a C `P����g��U���֬�u襑�&j���]�de�ձ�p�w�Y��S�m���q�
z�������mz���z������+��PR�� �5PD��ܣ}�i���:�tRU*(-ݦ%��*��;��6IR�ͦ�G�u41I���V��_)#3K{~��+-ݦ��ьw�(/�Yա�� \k��. (-&OKY�vEvl�Y3&�������z����z�ٗ���/�_���|�2��ՠnm�����ئ�Z�71��699��Xx[ �Z�("1q�I����Se|�%I�V��>T,���lK:��\���C���Rb�I���Ϥ��'&�v�HՌ�{�M�{/P`��zx�TIҾؠ�Z�������[�R�f�Ԫ�@�]u��������&�x�뮇�V����5i���>�z���#�롧U�mUo�I=�ܣ�ћ.z�l�]�ZtU`���KK�)�I{6h�]{H�Φ��驯�i羪ڴ���4Xo~8W�õ��s>S`���m��3�Gؠ�f�[(I�h�b6h�;|R>��B�;k´7.Zg���zdjԡ��5��{���|^�ܒ�����V���Pզԩ�}���6�Yz��wu]כԤ�»ެg�/{NN����Z��Q6h�Y�|^`ypӎ
l�V�$�6� 6h������(��M
m�M#F?��'NI��k @Q � E$��ތy��n�p-�X^�7���M+T�j�B������{��e_+-ݦ���f�w�<��B�?v���zDgR����K��G5v�4�ؽ����c�ku��t���|`��ض�$i�Ͽ���{����2��U�R�~�i�n�>Z����yX����������p�n�6��:TY��)ݖ������_�\�M�C�+.ᘞ����sW���V�ݨKV*/�)77S�ۤ�K�MCGj�W�����V�5�oG�̴7�ʻ���.��i��?}�|��N�BkT��c4������U�$�áa�=���?թ�3�W��N'��k�}�Ǟ}�u��s-�Ąi3�٢�*��+[F��^��~&?�^� ��@�"�ɷ���ݴU�u�YOO}M;v��y�q�W}�}�������#m��K�^��j�*�n�k�?��.��
�Ԯe�$i�7���=��C�'t=���5�A���&�,[F���=룴m���>�qIҤ�g*9�l���{cI��
[\�k�-��^��$I���:��au�;z�6F������S�W~���\uۥ� ���)a�zM?��m���V'O%�e��ڲb�~8S��3]�4{ޗ������N�>��[]���Gi�ҹ��F����_���V|���w*п���X�u�?ц����[F������t-/�v�j�i]����\�������g�ȼ�k @Q!� E�QX]E/�X�o�T�ͦ�s�Tϡ����AZ���K��� ���P㰺���e�Թm�B����Ԡ�=$I�Y��K�p��U�]TNJ?��]{���M��/7������S�К����ڍ��o��[ɷ��N�>��{~���T�w[%I��w�$-^�V�4T��W�Դa}
�w�$i��뮪���D4S�v�.��m���O�|�,����lj����f�MMs������$=<�vyzX%��az�M��JK���P
�����*K�jV��G�K}{t��si��Z^N��"U�l��k��:ל��ī�� ���lK��iɚ�:N˾�֗Q��m��3nB�-zG�V�~�~�r��˱X,����ܿWx+�����JU�|���կ�c��}��z��A_D���뿓���N�>�ʁ��h�H��;~B҅רQ�:��#�~��1�
v�W�ߡ���H;��WV���:�á��,W�]�Z���=���qBbR���{�`���[�K�{��j�L&Y�f���*7��� �J����<eeەm��`Z���n�O����3�9:��^��n�6�ݍ)�8�V���mp���$.u���=��|����~�n�e2�
c��5r8~?���}��ݶ5��ǟ���;�飙����i��� s%���k @IF ��ƭ?�z�N�Ӫ�rs��^�%�ϵ��hb��W�}(��;�լVU��x�Φ�Xw�`L�6Ճ/����T��W��E�%I}����ZU9п��\�>T����{p�rG���%+�t:u�����覮ԱmD�m�<=�_���?z���j��]%[F���~#���`|��G�]�#� Wu-Ϸ��w� ��"� E �i#�+뫬l�&�<S�Yْ�{F>�"��Ennn
�R����th#IZ�x�+����Ӻ�����y{y��9�?�fH���������굘�h������K]oga,�n��AR�0�@�
�fI�����瞤���K�oq{~"��y������~�H�v���o��|���S�e���`��$�9{��7l��t���j�e�Xuc��;~}�h�����O�ҽ�=����\Z�U]��������\�tշ;��� P����@o͜��~d�f��Rs�\�*�t��9����<�a�P��=$�Ի[g�7i��{~V����VH5%&�PFf��M�"����j�J:v�����m[�W��˓Ӏ;�'_,���M*��#� ��)O="?�2�<n��h�������\��%����Қu�i��jڹ��W��C����uh`���&�G�}�T,�S�)��6@��u8��+������KVꋨUڶ�'9��t����d����x�}�a��mަ����r��+PN{�,����U�Z���w�u���]��b�~SfV����f��$銯�^�4�ϵ~�v5��_�Y�;~�е+u�� ��BPDn���6,�TC���
:z��<�V�o��ߜ�g��w�}�����{�h`�������Խs{
���$ɤ+�_`�7�>�К!���vͿhѬ��ϛ�.�(#3S'N�V��&��:��e�ٱM��z�>���e����5��>���PL\�j�T��O>��Sǻ������Y��e��������s����Ы��nk�v���+�+�N-�<��2��zk���}��/���Uf�枑r:���KP�����St���?����y���wW�
����#���߫��Mt��J�e�Faz��gU�V��Ϝ��l�S�_�o�\��^[ ���f�����k��t��t��p(''G����]�5�p8���I�#�MԒUk5������b��8��5l�K^��ڷq�� piqqq�Z��Z��X,rww��d��e F�(!F=6��ײ%iZ��FIR�͋�,�8�N���'���R��>