HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/shop.komma.nl/tests/Cypress/integration/kms/kms_users_spec.js
import faker from 'faker'

/// <reference types="Cypress" />
describe('KMS Users', function() {
    it('Cannot create a user without entering data', () =>{
     cy.kms_login('kms');
        cy.get('[data-test="Gebruikers"]').click();
        cy.get('[data-test="KMS gebruikers"]').click();
        cy.get('[data-test="add_button"]').click();

        cy.get('[data-test="save_button"]').click();
        cy.get('[data-test=flash_message]').should('have.attr', 'data-type', '1'); //Data type 1 means error.
    });

    it('Should be possible to search for a user', () => {
        cy.kms_login('kms');
        cy.get('[data-test="Gebruikers"]').click();
        cy.get('[data-test="KMS gebruikers"]').click();

        //Get a user to search for first
        cy.getCsrfToken((csrfToken) => {
            cy.request(
                'testapi/v1/kms_users/show/',
            ).then((response) => {
                let user = response.body.data;
                cy.get('[data-test="entity_search_input"]').type(user.email);
                cy.get('[data-test="search-result-counter"]').contains('1').should('exist');
            });
        });
    });
});