'Scenario: On the Certificates tab of the Instructor Dashboard,
Error message appears if username/email does not exists in the system while clicking "Add Exception" button
Given that I am on the Certificates tab on the Instructor Dashboard
When I click on \'Add Exception\' button
AND student username/email does not exists
Then Error Message should say
\'Student username/email field is required and can not be empty. \'
\'Kindly fill in username/email and then press "Add Exception" button.'

def test_error_on_non_existing_user(self):

    invalid_user = 'test_user_non_existent'
    self.certificates_section.wait_for_certificate_exceptions_section()
    self.certificates_section.fill_user_name_field(invalid_user)
    self.certificates_section.click_add_exception_button()
    self.certificates_section.wait_for_ajax()
    self.assertIn('{user}    does    not    exist    in    the    LMS.    Please    check    your    spelling    and    retry.'.format(user=invalid_user), self.certificates_section.message.text)
