diff --git a/.env.dusk b/.env.dusk deleted file mode 100644 index 237f61d32..000000000 --- a/.env.dusk +++ /dev/null @@ -1,26 +0,0 @@ -APP_ENV=local -APP_DEBUG=false -APP_KEY=NDWgIKKi9ovNK1PXZpzfNVSBdfCXGb5i -APP_JWT_KEY=test1234 -APP_TIMEZONE=America/Los_Angeles -APP_URL=http://pterodactyl.local - -CACHE_DRIVER=file -SESSION_DRIVER=file - -HASHIDS_SALT=IqRr0g82tCTeuyxGs8RV -HASHIDS_LENGTH=8 - -MAIL_DRIVER=log -MAIL_FROM=support@pterodactyl.io -QUEUE_DRIVER=array - -APP_SERVICE_AUTHOR=testing@pterodactyl.io -MAIL_FROM_NAME="Pterodactyl Panel" -RECAPTCHA_ENABLED=false - -DB_CONNECTION=testing -TESTING_DB_HOST=192.168.1.202 -TESTING_DB_DATABASE=panel_test -TESTING_DB_USERNAME=panel_test -TESTING_DB_PASSWORD=Test1234 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f872744cf..64e5e6849 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,7 +33,7 @@ jobs: - name: Create release archive run: | - rm -rf node_modules/ test/ codecov.yml CODE_OF_CONDUCT.md CONTRIBUTING.md phpunit.dusk.xml phpunit.xml Vagrantfile + rm -rf node_modules/ test/ codecov.yml CODE_OF_CONDUCT.md CONTRIBUTING.md phpunit.xml Vagrantfile tar -czf panel.tar.gz * .env.example .eslintignore .eslintrc.yml .babel-plugin-macrosrc.js - name: Extract changelog diff --git a/.gitignore b/.gitignore index 2ffab7529..cf911a1de 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ /vendor *.DS_Store* !.env.ci -!.env.dusk !.env.example .env* .vagrant/* diff --git a/composer.json b/composer.json index e6b48d080..fa5db6eb0 100644 --- a/composer.json +++ b/composer.json @@ -47,7 +47,6 @@ "fakerphp/faker": "^1.19", "friendsofphp/php-cs-fixer": "^3.8", "itsgoingd/clockwork": "^5.1", - "laravel/dusk": "^6.23", "mockery/mockery": "^1.5", "nunomaduro/collision": "^5.11", "php-mock/php-mock-phpunit": "^2.6", diff --git a/composer.lock b/composer.lock index 31f205afa..8fecedfe9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "75eb69604c51a9ac2dcdf4da1f6d24cb", + "content-hash": "966e12710f76fb744c32e90103b9f823", "packages": [ { "name": "aws/aws-crt-php", @@ -8218,79 +8218,6 @@ ], "time": "2022-04-12T21:35:47+00:00" }, - { - "name": "laravel/dusk", - "version": "v6.23.1", - "source": { - "type": "git", - "url": "https://github.com/laravel/dusk.git", - "reference": "41f6deb42ae42b9b7dae1c32c03cb35d365d3118" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laravel/dusk/zipball/41f6deb42ae42b9b7dae1c32c03cb35d365d3118", - "reference": "41f6deb42ae42b9b7dae1c32c03cb35d365d3118", - "shasum": "" - }, - "require": { - "ext-json": "*", - "ext-zip": "*", - "illuminate/console": "^6.0|^7.0|^8.0|^9.0", - "illuminate/support": "^6.0|^7.0|^8.0|^9.0", - "nesbot/carbon": "^2.0", - "php": "^7.2|^8.0", - "php-webdriver/webdriver": "^1.9.0", - "symfony/console": "^4.3|^5.0|^6.0", - "symfony/finder": "^4.3|^5.0|^6.0", - "symfony/process": "^4.3|^5.0|^6.0", - "vlucas/phpdotenv": "^3.0|^4.0|^5.2" - }, - "require-dev": { - "mockery/mockery": "^1.0", - "orchestra/testbench": "^4.16|^5.17.1|^6.12.1|^7.0", - "phpunit/phpunit": "^7.5.15|^8.4|^9.0" - }, - "suggest": { - "ext-pcntl": "Used to gracefully terminate Dusk when tests are running." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.x-dev" - }, - "laravel": { - "providers": [ - "Laravel\\Dusk\\DuskServiceProvider" - ] - } - }, - "autoload": { - "psr-4": { - "Laravel\\Dusk\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "description": "Laravel Dusk provides simple end-to-end testing and browser automation.", - "keywords": [ - "laravel", - "testing", - "webdriver" - ], - "support": { - "issues": "https://github.com/laravel/dusk/issues", - "source": "https://github.com/laravel/dusk/tree/v6.23.1" - }, - "time": "2022-05-02T14:01:47+00:00" - }, { "name": "mockery/mockery", "version": "1.5.0", @@ -8862,71 +8789,6 @@ }, "time": "2020-02-08T15:44:47+00:00" }, - { - "name": "php-webdriver/webdriver", - "version": "1.12.1", - "source": { - "type": "git", - "url": "https://github.com/php-webdriver/php-webdriver.git", - "reference": "b27ddf458d273c7d4602106fcaf978aa0b7fe15a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-webdriver/php-webdriver/zipball/b27ddf458d273c7d4602106fcaf978aa0b7fe15a", - "reference": "b27ddf458d273c7d4602106fcaf978aa0b7fe15a", - "shasum": "" - }, - "require": { - "ext-curl": "*", - "ext-json": "*", - "ext-zip": "*", - "php": "^5.6 || ~7.0 || ^8.0", - "symfony/polyfill-mbstring": "^1.12", - "symfony/process": "^2.8 || ^3.1 || ^4.0 || ^5.0 || ^6.0" - }, - "replace": { - "facebook/webdriver": "*" - }, - "require-dev": { - "ondram/ci-detector": "^2.1 || ^3.5 || ^4.0", - "php-coveralls/php-coveralls": "^2.4", - "php-mock/php-mock-phpunit": "^1.1 || ^2.0", - "php-parallel-lint/php-parallel-lint": "^1.2", - "phpunit/phpunit": "^5.7 || ^7 || ^8 || ^9", - "squizlabs/php_codesniffer": "^3.5", - "symfony/var-dumper": "^3.3 || ^4.0 || ^5.0 || ^6.0" - }, - "suggest": { - "ext-SimpleXML": "For Firefox profile creation" - }, - "type": "library", - "autoload": { - "files": [ - "lib/Exception/TimeoutException.php" - ], - "psr-4": { - "Facebook\\WebDriver\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "A PHP client for Selenium WebDriver. Previously facebook/webdriver.", - "homepage": "https://github.com/php-webdriver/php-webdriver", - "keywords": [ - "Chromedriver", - "geckodriver", - "php", - "selenium", - "webdriver" - ], - "support": { - "issues": "https://github.com/php-webdriver/php-webdriver/issues", - "source": "https://github.com/php-webdriver/php-webdriver/tree/1.12.1" - }, - "time": "2022-05-03T12:16:34+00:00" - }, { "name": "phpdocumentor/reflection-common", "version": "2.2.0", diff --git a/phpunit.dusk.xml b/phpunit.dusk.xml deleted file mode 100644 index 60392c932..000000000 --- a/phpunit.dusk.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - ./tests/Browser - - - - - ./app - - - diff --git a/tests/Browser/BrowserTestCase.php b/tests/Browser/BrowserTestCase.php deleted file mode 100644 index 68a6ddc1b..000000000 --- a/tests/Browser/BrowserTestCase.php +++ /dev/null @@ -1,122 +0,0 @@ -make(Kernel::class); - - $kernel->bootstrap(); - $kernel->call('migrate:fresh'); - } - - /** - * Setup tests. - */ - protected function setUp(): void - { - // Don't accidentally run the migrations aganist the non-testing database. Ask me - // how many times I've accidentally dropped my database... - if (env('DB_CONNECTION') !== 'testing') { - throw new BadMethodCallException('Cannot call browser tests using the non-testing database connection.'); - } - - parent::setUp(); - - // Gotta unset this to continue avoiding issues with the validation. - Model::unsetEventDispatcher(); - } - - /** - * Create the RemoteWebDriver instance. - * - * @return \Facebook\WebDriver\Remote\RemoteWebDriver - */ - protected function driver() - { - $options = (new ChromeOptions())->addArguments([ - '--disable-gpu', - '--disable-infobars', - ]); - - return RemoteWebDriver::create( - 'http://host.pterodactyl.local:4444/wd/hub', - DesiredCapabilities::chrome()->setCapability( - ChromeOptions::CAPABILITY, - $options - ) - ); - } - - /** - * Return an instance of the browser to be used for tests. - * - * @param \Facebook\WebDriver\Remote\RemoteWebDriver $driver - * - * @return \Pterodactyl\Tests\Browser\PterodactylBrowser - */ - protected function newBrowser($driver): PterodactylBrowser - { - return new PterodactylBrowser($driver); - } - - /** - * Tear down the test and delete all cookies from the browser instance to address - * instances where the test would be kicked over to the login page. - */ - protected function tearDown(): void - { - /** @var \Pterodactyl\Tests\Browser\PterodactylBrowser $browser */ - foreach (static::$browsers as $browser) { - $browser->driver->manage()->deleteAllCookies(); - } - - parent::tearDown(); - } - - /** - * Return a user model to authenticate aganist and use in the tests. - */ - protected function user(array $attributes = []): User - { - return User::factory()->create(array_merge([ - 'password' => Hash::make(static::$userPassword), - ], $attributes)); - } -} diff --git a/tests/Browser/Pages/BasePage.php b/tests/Browser/Pages/BasePage.php deleted file mode 100644 index c2e451a3d..000000000 --- a/tests/Browser/Pages/BasePage.php +++ /dev/null @@ -1,19 +0,0 @@ - '.alert.success[role="alert"]', - '@@error' => '.alert.error[role="alert"]', - ]; - } -} diff --git a/tests/Browser/Pages/Dashboard/AccountPage.php b/tests/Browser/Pages/Dashboard/AccountPage.php deleted file mode 100644 index e1aef4c2a..000000000 --- a/tests/Browser/Pages/Dashboard/AccountPage.php +++ /dev/null @@ -1,41 +0,0 @@ - '#update-email-container #grid-email', - '@password' => '#update-email-container #grid-password[type="password"]', - '@submit' => '#update-email-container button[type="submit"]', - - '@current_password' => '#change-password-container #grid-password-current[type="password"]', - '@new_password' => '#change-password-container #grid-password-new[type="password"]', - '@confirm_password' => '#change-password-container #grid-password-new-confirm[type="password"]', - '@submit_password' => '#change-password-container button[type="submit"]', - - '@2fa_button' => '#grid-open-two-factor-modal', - '@2fa_modal' => '.modal-mask #configure-two-factor', - '@2fa_token' => '#configure-two-factor #container-enable-two-factor #grid-two-factor-token[type="number"]', - '@2fa_token_disable' => '#configure-two-factor #container-disable-two-factor #grid-two-factor-token-disable', - '@2fa_enable' => '#configure-two-factor #container-enable-two-factor button[type="submit"]', - '@2fa_disable' => '#configure-two-factor #container-disable-two-factor button.btn-red[type="submit"]', - '@2fa_cancel' => '#configure-two-factor #container-disable-two-factor button.btn-secondary', - ]); - } -} diff --git a/tests/Browser/Pages/LoginPage.php b/tests/Browser/Pages/LoginPage.php deleted file mode 100644 index ea60b0580..000000000 --- a/tests/Browser/Pages/LoginPage.php +++ /dev/null @@ -1,26 +0,0 @@ - '#grid-email', - '@username' => '#grid-username', - '@password' => '#grid-password', - '@loginButton' => '#grid-login-button', - '@submitButton' => 'button.btn.btn-jumbo[type="submit"]', - '@forgotPassword' => 'a[href="/auth/password"][aria-label="Forgot password"]', - '@goToLogin' => 'a[href="/auth/login"][aria-label="Go to login"]', - '@alertSuccess' => 'div[role="alert"].success > span.message', - '@alertDanger' => 'div[role="alert"].danger > span.message', - ]; - } -} diff --git a/tests/Browser/Processes/Authentication/ForgotPasswordProcessTest.php b/tests/Browser/Processes/Authentication/ForgotPasswordProcessTest.php deleted file mode 100644 index f6cef86c4..000000000 --- a/tests/Browser/Processes/Authentication/ForgotPasswordProcessTest.php +++ /dev/null @@ -1,50 +0,0 @@ -browse(function (PterodactylBrowser $browser) { - $browser->visit(new LoginPage()) - ->assertSee(trans('auth.forgot_password.label')) - ->click('@forgotPassword') - ->waitForLocation('/auth/password') - ->assertFocused('@email') - ->assertSeeIn('.input-open > p.text-xs', trans('auth.forgot_password.label_help')) - ->assertSeeIn('@submitButton', trans('auth.forgot_password.button')) - ->type('@email', 'unassociated@example.com') - ->assertSeeIn('@goToLogin', trans('auth.go_to_login')) - ->press('@submitButton') - ->waitForLocation('/auth/login') - ->assertSeeIn('div[role="alert"].success > span.message', 'We have e-mailed your password reset link!') - ->assertFocused('@username') - ->assertValue('@username', 'unassociated@example.com'); - }); - } - - /** - * Test that you can type in your email address and then click forgot password and have - * the email maintained on the new page. - */ - public function testEmailCarryover() - { - $this->browse(function (PterodactylBrowser $browser) { - $browser->visit(new LoginPage()) - ->type('@username', 'dane@example.com') - ->click('@forgotPassword') - ->waitForLocation('/auth/password') - ->assertFocused('@email') - ->assertValue('@email', 'dane@example.com'); - }); - } -} diff --git a/tests/Browser/Processes/Authentication/LoginProcessTest.php b/tests/Browser/Processes/Authentication/LoginProcessTest.php deleted file mode 100644 index 0806cd789..000000000 --- a/tests/Browser/Processes/Authentication/LoginProcessTest.php +++ /dev/null @@ -1,83 +0,0 @@ -user = $this->user(); - } - - /** - * Test that a user can login successfully using their email address. - */ - public function testLoginUsingEmail() - { - $this->browse(function (PterodactylBrowser $browser) { - $browser->visit(new LoginPage()) - ->waitFor('@username') - ->type('@username', $this->user->email) - ->type('@password', self::$userPassword) - ->click('@loginButton') - ->waitForReload() - ->assertPathIs('/') - ->assertAuthenticatedAs($this->user); - }); - } - - /** - * Test that a user can login successfully using their username. - */ - public function testLoginUsingUsername() - { - $this->browse(function (PterodactylBrowser $browser) { - $browser->visit(new LoginPage()) - ->waitFor('@username') - ->type('@username', $this->user->username) - ->type('@password', self::$userPassword) - ->click('@loginButton') - ->waitForReload() - ->assertPathIs('/') - ->assertAuthenticatedAs($this->user); - }); - } - - /** - * Test that entering the wrong password shows the expected error and then allows - * us to login without clearing the username field. - */ - public function testLoginWithErrors() - { - $this->browse(function (PterodactylBrowser $browser) { - $browser->logout() - ->visit(new LoginPage()) - ->waitFor('@username') - ->type('@username', $this->user->email) - ->type('@password', 'invalid') - ->click('@loginButton') - ->waitFor('.alert.error') - ->assertSeeIn('.alert.error', trans('auth.failed')) - ->assertValue('@username', $this->user->email) - ->assertValue('@password', '') - ->assertFocused('@password') - ->type('@password', self::$userPassword) - ->keys('@password', [WebDriverKeys::ENTER]) - ->waitForReload() - ->assertPathIs('/') - ->assertAuthenticatedAs($this->user); - }); - } -} diff --git a/tests/Browser/Processes/Dashboard/AccountEmailProcessTest.php b/tests/Browser/Processes/Dashboard/AccountEmailProcessTest.php deleted file mode 100644 index 6efe4ee03..000000000 --- a/tests/Browser/Processes/Dashboard/AccountEmailProcessTest.php +++ /dev/null @@ -1,67 +0,0 @@ -browse(function (PterodactylBrowser $browser) { - $browser->loginAs($this->user) - ->visit(new AccountPage()) - ->assertValue('@email', $this->user->email) - ->type('@email', 'new.email@example.com') - ->type('@password', 'Password123') - ->click('@submit') - ->waitFor('@@success') - ->assertSeeIn('@@success', trans('dashboard/account.email.updated')) - ->assertValue('@email', 'new.email@example.com'); - - $this->assertDatabaseHas('users', ['id' => $this->user->id, 'email' => 'new.email@example.com']); - }); - } - - /** - * Test that the validation error message shows up when an invalid email is entered. - */ - public function testInvalidEmailShowsErrors() - { - $this->browse(function (PterodactylBrowser $browser) { - $browser->loginAs($this->user) - ->visit(new AccountPage()) - ->assertMissing('@email ~ .input-help.error') - ->type('@email', 'admin') - ->assertVisible('@email ~ .input-help.error') - ->assertSeeIn('@email ~ .input-help.error', 'The email field must be a valid email.') - ->type('@email', 'admin@example.com') - ->assertMissing('@email ~ .input-help.error'); - }); - } - - /** - * Test that entering the wrong password for an account returns an error. - */ - public function testInvalidPasswordShowsError() - { - $this->browse(function (PterodactylBrowser $browser) { - $browser->loginAs($this->user) - ->visit(new AccountPage()) - ->type('@email', 'new.email@example.com') - ->click('@submit') - ->assertFocused('@password') - ->type('@password', 'test1234') - ->click('@submit') - ->waitFor('@@error') - ->assertSeeIn('@@error', trans('validation.internal.invalid_password')) - ->assertValue('@email', 'new.email@example.com'); - - $this->assertDatabaseMissing('users', ['id' => $this->user->id, 'email' => 'new.email@example.com']); - }); - } -} diff --git a/tests/Browser/Processes/Dashboard/AccountPasswordProcessTest.php b/tests/Browser/Processes/Dashboard/AccountPasswordProcessTest.php deleted file mode 100644 index 4b8a5a3b6..000000000 --- a/tests/Browser/Processes/Dashboard/AccountPasswordProcessTest.php +++ /dev/null @@ -1,55 +0,0 @@ -browse(function (PterodactylBrowser $browser) { - $browser->loginAs($this->user) - ->visit(new AccountPage()) - ->type('@current_password', self::$userPassword) - ->assertMissing('@new_password ~ .input-help.error') - ->type('@new_password', 'test') - ->assertSeeIn('@new_password ~ .input-help.error', 'The password field must be at least 8 characters.') - ->type('@new_password', 'Test1234') - ->assertMissing('@new_password ~ .input-help.error') - ->assertMissing('@confirm_password ~ .input-help.error') - ->type('@confirm_password', 'test') - ->assertSeeIn('@confirm_password ~ .input-help.error', 'The password value is not valid.') - ->type('@confirm_password', 'Test1234') - ->assertMissing('@confirm_password ~ .input-help.error') - ->click('@submit_password') - ->waitFor('@@success') - ->assertSeeIn('@@success', 'Your password has been updated.') - ->assertInputValue('@current_password', '') - ->assertInputValue('@new_password', '') - ->assertInputValue('@confirm_password', ''); - }); - } - - /** - * Test that invalid passwords result in the expected error message. - */ - public function testInvalidPassword() - { - $this->browse(function (PterodactylBrowser $browser) { - $browser->loginAs($this->user) - ->visit(new AccountPage()) - ->type('@current_password', 'badpassword') - ->type('@new_password', 'testtest') - ->type('@confirm_password', 'testtest') - ->click('@submit_password') - ->waitFor('@@error') - ->assertSeeIn('@@error', trans('validation.internal.invalid_password')) - ->assertInputValue('@current_password', ''); - }); - } -} diff --git a/tests/Browser/Processes/Dashboard/DashboardTestCase.php b/tests/Browser/Processes/Dashboard/DashboardTestCase.php deleted file mode 100644 index efbeb13b4..000000000 --- a/tests/Browser/Processes/Dashboard/DashboardTestCase.php +++ /dev/null @@ -1,23 +0,0 @@ -user = $this->user(); - } -} diff --git a/tests/Browser/Processes/Dashboard/TwoFactorAuthenticationProcessTest.php b/tests/Browser/Processes/Dashboard/TwoFactorAuthenticationProcessTest.php deleted file mode 100644 index 463286ddb..000000000 --- a/tests/Browser/Processes/Dashboard/TwoFactorAuthenticationProcessTest.php +++ /dev/null @@ -1,111 +0,0 @@ -browse(function (PterodactylBrowser $browser) { - $browser->loginAs($this->user) - ->visit(new AccountPage()) - ->assertMissing('.modal-mask') - ->click('@2fa_button') - ->waitFor('@2fa_modal') - ->pause(500)// seems to fix fragile test - ->clickPosition(100, 100) - ->waitUntilMissing('@2fa_modal') - ->click('@2fa_button') - ->waitFor('@2fa_modal') - ->click('svg[role="button"][aria-label="Close modal"]') - ->waitUntilMissing('@2fa_modal') - ->click('@2fa_button') - ->waitFor('@2fa_modal') - ->keys('', [WebDriverKeys::ESCAPE]) - ->waitUntilMissing('@2fa_modal'); - }); - } - - /** - * Test that a user that does not have two-factor enabled can enable it on their account. - */ - public function testTwoFactorCanBeEnabled() - { - $this->browse(function (PterodactylBrowser $browser) { - $browser->loginAs($this->user) - ->visit(new AccountPage()) - ->click('@2fa_button') - ->waitForText(trans('dashboard/account.two_factor.setup.title')) - ->assertFocused('@2fa_token') - ->waitFor('#grid-qr-code') - ->assertSee(trans('dashboard/account.two_factor.setup.help')); - - // Grab information from the database so we can ensure the correct things are showing up. - // Also because we need to generate a code to send through and activate it with. - $updated = $this->user->fresh(); - - $secret = Crypt::decrypt($updated->totp_secret); - $code = (new Google2FA())->getCurrentOtp($secret); - - $browser->assertSeeIn('code', $secret) - ->assertVisible('@2fa_enable[disabled="disabled"]') - ->assertMissing('@2fa_token ~ .input-help.error') - ->type('@2fa_token', '12') - ->assertSeeIn('@2fa_token ~ .input-help.error', 'The token length must be 6.') - ->type('@2fa_token', $code) - ->assertMissing('@2fa_token ~ .input-help.error') - ->click('@2fa_enable') - ->waitUntilMissing('@2fa_modal') - ->assertSeeIn('@@success', trans('dashboard/account.two_factor.enabled')); - - $this->assertDatabaseHas('users', ['id' => $this->user->id, 'use_totp' => 1]); - }); - } - - /** - * Test that a user can disable two-factor authentication on thier account. - */ - public function testTwoFactorCanBeDisabled() - { - $secret = (new Google2FA())->generateSecretKey(16); - - $this->user->update([ - 'use_totp' => true, - 'totp_secret' => Crypt::encrypt($secret), - ]); - - $this->browse(function (PterodactylBrowser $browser) use ($secret) { - $browser->loginAs($this->user) - ->visit(new AccountPage()) - ->click('@2fa_button') - ->waitForText(trans('dashboard/account.two_factor.disable.title')) - ->click('@2fa_cancel') - ->waitUntilMissing('@2fa_modal') - ->click('@2fa_button') - ->waitForText(trans('dashboard/account.two_factor.disable.title')) - ->assertVisible('@2fa_disable[disabled="disabled"]') - ->assertVisible('@2fa_cancel') - ->assertFocused('@2fa_token_disable') - ->assertMissing('@2fa_token_disable ~ .input-help.error') - ->type('@2fa_token_disable', '12') - ->assertSeeIn('@2fa_token_disable ~ .input-help.error', 'The token length must be 6.'); - - $token = (new Google2FA())->getCurrentOtp($secret); - - $browser->type('@2fa_token_disable', $token) - ->assertMissing('@2fa_token_disable ~ .input-help.error') - ->click('@2fa_disable') - ->waitUntilMissing('@2fa_modal') - ->assertSeeIn('@@success', trans('dashboard/account.two_factor.disabled')); - }); - } -} diff --git a/tests/Browser/PterodactylBrowser.php b/tests/Browser/PterodactylBrowser.php deleted file mode 100644 index 9136a6a65..000000000 --- a/tests/Browser/PterodactylBrowser.php +++ /dev/null @@ -1,55 +0,0 @@ -driver->getMouse()->mouseMove(null, $x, $y)->click(); - - return $this; - } - - /** - * Perform a case insensitive search for a string in the body. - * - * @param string $text - * - * @return \Pterodactyl\Tests\Browser\PterodactylBrowser - */ - public function assertSee($text) - { - return $this->assertSeeIn('', $text); - } - - /** - * Perform a case insensitive search for a string in a given selector. - * - * @param string $selector - * @param string $text - * - * @return \Pterodactyl\Tests\Browser\PterodactylBrowser - */ - public function assertSeeIn($selector, $text) - { - $fullSelector = $this->resolver->format($selector); - $element = $this->resolver->findOrFail($selector); - - PHPUnit::assertTrue( - Str::contains(mb_strtolower($element->getText()), mb_strtolower($text)), - "Did not see expected text [{$text}] within element [{$fullSelector}] using case-insensitive search." - ); - - return $this; - } -} diff --git a/tests/Browser/console/.gitignore b/tests/Browser/console/.gitignore deleted file mode 100644 index d6b7ef32c..000000000 --- a/tests/Browser/console/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/tests/Browser/screenshots/.gitignore b/tests/Browser/screenshots/.gitignore deleted file mode 100644 index d6b7ef32c..000000000 --- a/tests/Browser/screenshots/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore