You are here

function TMGMTUiTest::testPageTitles in Translation Management Tool 8

Test titles of various TMGMT pages.

@todo Miro wants to split this test to specific tests (check)

File

tests/src/Functional/TMGMTUiTest.php, line 698

Class

TMGMTUiTest
Verifies basic functionality of the user interface

Namespace

Drupal\Tests\tmgmt\Functional

Code

function testPageTitles() {
  $this
    ->loginAsAdmin();
  $translator = $this
    ->createTranslator();
  $job = $this
    ->createJob();
  $job->translator = $translator;
  $job->settings = array();
  $job
    ->save();
  $item = $job
    ->addItem('test_source', 'test', 1);

  // Tmgtm settings.
  $this
    ->drupalGet('/admin/tmgmt/settings');
  $this
    ->assertTitle(t('Settings | Drupal'));

  // Manage translators.
  $this
    ->drupalGet('/admin/tmgmt/translators');
  $this
    ->assertTitle(t('Providers | Drupal'));

  // Add Translator.
  $this
    ->drupalGet('/admin/tmgmt/translators/add');
  $this
    ->assertTitle(t('Add Provider | Drupal'));

  // Delete Translators.
  $this
    ->drupalGet('/admin/tmgmt/translators/manage/' . $translator
    ->id() . '/delete');
  $this
    ->assertTitle(t('Are you sure you want to delete the provider @label? | Drupal', [
    '@label' => $translator
      ->label(),
  ]));

  // Edit Translators.
  $this
    ->drupalGet('/admin/tmgmt/translators/manage/' . $translator
    ->id());
  $this
    ->assertTitle(t('Edit provider | Drupal'));

  // Delete Job.
  $this
    ->drupalGet('/admin/tmgmt/jobs/' . $job
    ->id() . '/delete');
  $this
    ->assertTitle(t('Are you sure you want to delete the translation job @label? | Drupal', [
    '@label' => $job
      ->label(),
  ]));

  // Resubmit Job.
  $this
    ->drupalGet('/admin/tmgmt/jobs/' . $job
    ->id() . '/resubmit');
  $this
    ->assertTitle(t('Resubmit as a new job? | Drupal'));

  // Abort Job.
  $this
    ->drupalGet('/admin/tmgmt/jobs/' . $job
    ->id() . '/abort');
  $this
    ->assertTitle(t('Abort this job? | Drupal'));

  // Edit Job Item.
  $this
    ->drupalGet('/admin/tmgmt/items/' . $job
    ->id());
  $this
    ->assertTitle(t('Job item @label | Drupal', [
    '@label' => $item
      ->label(),
  ]));

  // Assert the breadcrumb.
  $this
    ->assertLink(t('Home'));
  $this
    ->assertLink(t('Administration'));
  $this
    ->assertLink(t('Job overview'));
  $this
    ->assertLink($job
    ->label());

  // Translation Sources.
  $this
    ->drupalGet('admin');
  $this
    ->clickLink(t('Translation'));
  $this
    ->assertTitle(t('Translation | Drupal'));
  $this
    ->clickLink(t('Cart'));
  $this
    ->assertTitle(t('Cart | Drupal'));
  $this
    ->clickLink(t('Jobs'));
  $this
    ->assertTitle(t('Job overview | Drupal'));
  $this
    ->clickLink(t('Sources'));
  $this
    ->assertTitle(t('Translation Sources | Drupal'));
}