'Scenario: Ensure that the certificates can be created with signatories and edited correctly.
Given I have a course without certificates
When I click button \'Add your first Certificate\'
And I set new the course title override and signatory and click the button \'Create\'
Then I see the new certificate is added and has one signatory inside it
When I click \'Edit\' button of signatory panel
And I set the name and click the button \'Save\' icon
Then I see the signatory name updated with newly set name
When I refresh the certificates page
Then I can see course has one certificate with new signatory name
When I click \'Edit\' button of signatory panel
And click on \'Close\' button
Then I can see no change in signatory detail'

@skip_if_browser('chrome')
def test_can_create_and_edit_signatories_of_certficate(self):

    self.certificates_page.visit()
    certificate = self.create_and_verify_certificate('Course    Title    Override', 0, [self.make_signatory_data('first')])
    self.assertEqual(len(self.certificates_page.certificates), 1)
    signatory = certificate.signatories[0]
    signatory.edit()
    signatory.name = 'Updated    signatory    name'
    signatory.title = 'Update    signatory    title'
    signatory.organization = 'Updated    signatory    organization'
    signatory.save()
    self.assertEqual(len(self.certificates_page.certificates), 1)
    self.certificates_page.refresh()
    self.certificates_page.wait_for_page()
    signatory = self.certificates_page.certificates[0].signatories[0]
    self.assertIn('Updated    signatory    name', signatory.name)
    self.assertIn('Update    signatory    title', signatory.title)
    self.assertIn('Updated    signatory    organization', signatory.organization)
    signatory.edit()
    signatory.close()
    self.assertIn('Updated    signatory    name', signatory.name)
