OneBot: Leantime 改造版源码(BOM/Univer 表格/AI 接管/品牌替换等)
This commit is contained in:
81
tests/Support/Page/Acceptance/Install.php
Normal file
81
tests/Support/Page/Acceptance/Install.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Support\Page\Acceptance;
|
||||
|
||||
use Codeception\Util\Fixtures;
|
||||
use Tests\Support\AcceptanceTester;
|
||||
|
||||
class Install
|
||||
{
|
||||
protected AcceptanceTester $I;
|
||||
|
||||
protected $app;
|
||||
|
||||
public function __construct(AcceptanceTester $I)
|
||||
{
|
||||
$this->I = $I;
|
||||
$this->app = $I->getApplication();
|
||||
}
|
||||
|
||||
public function install($email, $password, $firstname, $lastname, $company): void
|
||||
{
|
||||
if (Fixtures::exists('installed')) {
|
||||
$this->suppressModals();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->I->amOnPage('/install');
|
||||
$this->I->fillField(['name' => 'email'], $email);
|
||||
$this->I->fillField(['name' => 'firstname'], $firstname);
|
||||
$this->I->fillField(['name' => 'lastname'], $lastname);
|
||||
$this->I->fillField(['name' => 'company'], $company);
|
||||
$this->I->click('Install');
|
||||
|
||||
// A successful install redirects straight into the onboarding wizard
|
||||
// (auth/userInvite), starting on the "Setting Account Details" step —
|
||||
// there is no longer a standalone success .alert page. Wait for the
|
||||
// jobTitle field (the first field this method fills) to confirm the
|
||||
// step has rendered before continuing.
|
||||
$this->I->waitForElementVisible(['name' => 'jobTitle'], 90);
|
||||
|
||||
$this->I->fillField(['name' => 'jobTitle'], 'CEO');
|
||||
|
||||
$this->I->fillField(['name' => 'password'], $password);
|
||||
|
||||
$this->I->click('Next');
|
||||
$this->I->waitForText('Determining A Visual Experience', 90);
|
||||
|
||||
$this->I->click('Next');
|
||||
$this->I->waitForText('Creating A Comfortable View', 90);
|
||||
|
||||
$this->I->click('Next');
|
||||
$this->I->waitForText('Shaping A Daily Flow', 90);
|
||||
|
||||
$this->I->click('Next');
|
||||
$this->I->waitForText('Your Leantime journey is about to begin', 90);
|
||||
|
||||
$this->I->click('Complete Sign up');
|
||||
|
||||
Fixtures::add('installed', true);
|
||||
$this->suppressModals();
|
||||
}
|
||||
|
||||
/**
|
||||
* Suppress all helper modals for testing
|
||||
*/
|
||||
private function suppressModals(): void
|
||||
{
|
||||
$userService = $this->app->make(\Leantime\Domain\Users\Services\Users::class);
|
||||
session(['userdata.id' => 1]);
|
||||
|
||||
// Suppress all known modals
|
||||
$userService->updateUserSettings('modals', 'projectDashboard', true);
|
||||
$userService->updateUserSettings('modals', 'home', true);
|
||||
$userService->updateUserSettings('modals', 'kanban', true);
|
||||
$userService->updateUserSettings('modals', 'roadmap', true);
|
||||
$userService->updateUserSettings('modals', 'goals', true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user