diff --git a/modules/salesforce_jwt/tests/src/FunctionalJavascript/SalesforceJwtTest.php b/modules/salesforce_jwt/tests/src/FunctionalJavascript/SalesforceJwtTest.php deleted file mode 100644 index e4effd71f549a195ecd087856a590933076ee385..0000000000000000000000000000000000000000 --- a/modules/salesforce_jwt/tests/src/FunctionalJavascript/SalesforceJwtTest.php +++ /dev/null @@ -1,130 +0,0 @@ -<?php - -namespace Drupal\Tests\salesforce_jwt\FunctionalJavascript; - -use Drupal\FunctionalJavascriptTests\WebDriverTestBase; -use Drupal\key\Entity\Key; - -/** - * Test JWT Auth. - * - * @group salesforce_jwt - */ -class SalesforceJwtTest extends WebDriverTestBase { - - /** - * Default theme required for D9. - * - * @var string - */ - protected $defaultTheme = 'stark'; - - /** - * A key entity to use for testing. - * - * @var \Drupal\key\KeyInterface - */ - protected $testKey; - - /** - * Modules. - * - * @var array - */ - protected static $modules = [ - 'key', - 'typed_data', - 'dynamic_entity_reference', - 'salesforce', - 'salesforce_test_rest_client', - 'salesforce_jwt', - ]; - - /** - * Admin user to test form. - * - * @var \Drupal\user\Entity\User - */ - protected $adminUser; - - /** - * Id of shared cert key. - */ - const KEY_ID = 'salesforce_jwt_test_key'; - - /** - * {@inheritdoc} - */ - protected function setUp(): void { - parent::setUp(); - $this->adminUser = $this->drupalCreateUser(['authorize salesforce']); - $this->drupalLogin($this->adminUser); - $this->createTestKey(self::KEY_ID, 'authentication', 'file'); - Key::load(self::KEY_ID) - ->set('key_provider_settings', [ - 'file_location' => __DIR__ . '/testKey.pem', - 'strip_line_breaks' => FALSE, - ])->save(); - } - - /** - * Test adding a jwt provider plugin. - */ - public function testJwtAuth() { - $assert_session = $this->assertSession(); - $page = $this->getSession()->getPage(); - $this->drupalGet('admin/config/salesforce/authorize/add'); - $labelField = $page->findField('label'); - $label = $this->randomString(); - $labelField->setValue($label); - $page->findField('provider')->setValue('jwt'); - $assert_session->assertWaitOnAjaxRequest(); - $edit = [ - 'provider_settings[consumer_key]' => 'foo', - 'provider_settings[login_user]' => 'bar', - 'provider_settings[login_url]' => 'https://login.salesforce.com', - 'provider_settings[encrypt_key]' => self::KEY_ID, - ]; - foreach ($edit as $key => $value) { - $assert_session->fieldExists($key); - $page->fillField($key, $value); - } - $this->createScreenshot(\Drupal::root() . '/sites/default/files/simpletest/sfjwt-1.png'); - $page->pressButton('Save'); - - // Weird behavior from testbot: machine name field doesn't seem to work - // as expected. Machine name field doesn't appear until after clicking - // "save", so we fill it and have to click save again. IDKWTF. - if ($page->findField('id')) { - $page->fillField('id', strtolower($this->randomMachineName())); - $this->createScreenshot(\Drupal::root() . '/sites/default/files/simpletest/sfjwt-2.png'); - $page->pressButton('Save'); - } - $assert_session->assertWaitOnAjaxRequest(); - $this->createScreenshot(\Drupal::root() . '/sites/default/files/simpletest/sfjwt-3.png'); - $assert_session->addressEquals('admin/config/salesforce/authorize/list'); - $assert_session->pageTextContainsOnce($label); - $assert_session->pageTextContainsOnce('Authorized'); - $assert_session->pageTextContainsOnce('Salesforce JWT OAuth'); - } - - /** - * Make a key for testing operations that require a key. - */ - protected function createTestKey($id, $type = NULL, $provider = NULL) { - $keyArgs = [ - 'id' => $id, - 'label' => 'Test key', - ]; - if ($type != NULL) { - $keyArgs['key_type'] = $type; - } - if ($provider != NULL) { - $keyArgs['key_provider'] = $provider; - } - $this->testKey = Key::create($keyArgs); - $this->testKey->save(); - return $this->testKey; - } - -} diff --git a/modules/salesforce_jwt/tests/src/FunctionalJavascript/testKey.pem b/modules/salesforce_jwt/tests/src/FunctionalJavascript/testKey.pem deleted file mode 100644 index 7283b4b2c31096c72b3148bfedc4c4232aa5e427..0000000000000000000000000000000000000000 --- a/modules/salesforce_jwt/tests/src/FunctionalJavascript/testKey.pem +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEpAIBAAKCAQEAwbdIBfVH1gNVjEPkB3yzCFBG+3pWTGbkFvi0/5p/sf9j6ah6 -tjxnHr/GcN1L66SqNh6OUN/OmCILXARCK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mrfO4NeZ1Qg -RhZqoIlHuIKzMZDUweALV4nMQVbzf2XtGIeNP3IYXa8gk8c4VoUGCcSiAloJKMTm -tuB09JQa+kGSWNUOLduePwKBgQDMyS+gwAs3OgyobVZBrOVOkhCcmZVMKb/G/unW -gieml9Fx6WBOX5q3PBw6u87EbEPaKv0yKy1m1ZD8+rIkZEJuvdDq9Epyd94dn2DK -22acik1PaqVmMyQvIPvhTf958m62xC4IKxpLWbytA4Rx6PoZ1sVyS/V8uHmc2isw -z/ZYXQKBgQCIYFCXfj0eVgR+CzvE7ZBjBitNKRbhE/FUhxHxklmnPaYZsZEiE3rJ -ON3H5RjMlTKbHWpAsjMj7rwQpzjTsnnepBUSX66Iv17XaP8IpGPstSerYvgsjQ2P -cVniC5Y0cUU7vJVVVuUpoTYONxY5O1djlzASWD26M+5AbeWE1ENnxQ== ------END RSA PRIVATE KEY----- diff --git a/modules/salesforce_oauth/tests/src/FunctionalJavascript/SalesforceOAuthTest.php b/modules/salesforce_oauth/tests/src/FunctionalJavascript/SalesforceOAuthTest.php deleted file mode 100644 index 3559d7eee9a6a4b6d73b11024f66b83f670a997c..0000000000000000000000000000000000000000 --- a/modules/salesforce_oauth/tests/src/FunctionalJavascript/SalesforceOAuthTest.php +++ /dev/null @@ -1,96 +0,0 @@ -<?php - -namespace Drupal\Tests\salesforce_oauth\FunctionalJavascript; - -use Drupal\FunctionalJavascriptTests\WebDriverTestBase; - -/** - * Test OAuth. - * - * @group salesforce_oauth - */ -class SalesforceOAuthTest extends WebDriverTestBase { - - /** - * Default theme required for D9. - * - * @var string - */ - protected $defaultTheme = 'stark'; - - /** - * Required modules. - * - * @var array - */ - protected static $modules = [ - 'key', - 'typed_data', - 'dynamic_entity_reference', - 'salesforce', - 'salesforce_test_rest_client', - 'salesforce_oauth', - ]; - - /** - * Admin user to test form. - * - * @var \Drupal\user\Entity\User - */ - protected $adminUser; - - /** - * {@inheritdoc} - */ - protected function setUp(): void { - parent::setUp(); - $this->adminUser = $this->drupalCreateUser(['authorize salesforce']); - $this->drupalLogin($this->adminUser); - } - - /** - * Test adding an oauth provider plugin. - */ - public function testOAuth() { - $assert_session = $this->assertSession(); - $page = $this->getSession()->getPage(); - $this->drupalGet('admin/config/salesforce/authorize/add'); - $labelField = $page->findField('label'); - $label = $this->randomString(); - $labelField->setValue($label); - $page->findField('provider')->setValue('oauth'); - $assert_session->assertWaitOnAjaxRequest(); - $edit = [ - 'provider_settings[consumer_key]' => 'foo', - 'provider_settings[consumer_secret]' => 'bar', - 'provider_settings[login_url]' => 'https://login.salesforce.com', - ]; - foreach ($edit as $key => $value) { - $assert_session->fieldExists($key); - $page->fillField($key, $value); - } - $this->createScreenshot(\Drupal::root() . '/sites/default/files/simpletest/sfoauth-1.png'); - $page->pressButton('Save'); - - // Weird behavior from testbot: machine name field doesn't seem to work - // as expected. Machine name field doesn't appear until after clicking - // "save", so we fill it and have to click save again. IDKWTF. - if ($page->findField('id')) { - $page->fillField('id', strtolower($this->randomMachineName())); - $this->createScreenshot(\Drupal::root() . '/sites/default/files/simpletest/sfoauth-2.png'); - $page->pressButton('Save'); - } - $assert_session->assertWaitOnAjaxRequest(); - $this->createScreenshot(\Drupal::root() . '/sites/default/files/simpletest/sfoauth-3.png'); - // We will have been redirected to a failed salesforce oauth page. - $assert_session->pageTextContainsOnce('error=invalid_client_id'); - } - - /** - * Test the oauth provider plugin callback. - */ - public function testOAuthCallback() { - // @todo - } - -}