Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x]: Codeception Acceptance testing - Javascript must be enabled to access control panel #15457

Open
KarlBishop opened this issue Aug 1, 2024 · 1 comment
Assignees

Comments

@KarlBishop
Copy link

KarlBishop commented Aug 1, 2024

What happened?

I've been trying to get Acceptance testing working with Codeception v5.1.2.

I followed the setup guide:
https://craftcms.com/docs/4.x/testing/testing-craft/setup.html

Then got past various issues:

 - Output path is not defined by key "paths: output"
     - # Added "paths: output: tests/_output" in Codeception.yml
 - PHP Fatal error:  Uncaught Error: Class "Codeception\Module\Yii2" not found
     - # composer require codeception/module-yii2 --dev
 - Suite 'unit' could not be found
     - # Unit should be capitalised 
 - No primary site exists
     - # Set dbSetup:clean and dbSetup:setupCraft to false in Codeception.yml and use a copy of the production db

But I'm stuck now on a basic Acceptance test for the control panel login page.

In my test class, I have:

public function loginpageWorks(AcceptanceTester $I)
    {
        $I->amOnPage('/admin/login');
        $I->see('Forgot your password?');
    }

And output says "JavaScript must be enabled to access the Craft CMS control panel":

1) FirstCest: Loginpage works
 Test  tests/Acceptance/FirstCest.php:loginpageWorks
 Step  See "Forgot your password?"
 Fail  Failed asserting that on page /admin/login
-->  Sign In - MyCraftCMS body:not(.userlevel-admin) #nav-assets { display: none !important; } #nav-dashboard {display: none !important;} JavaScript must be enabled to access the Craft CMS control panel.
--> contains "Forgot your password?".

How can I get JS to run?

Craft CMS version

4.10.7

PHP version

8.1.29

Operating system and version

Linux 5.15.133.1-microsoft-standard-WSL2

Database type and version

MySQL 8.0.36

Image driver and version

No response

Installed plugins and versions

No response

@KarlBishop
Copy link
Author

I tried briefly adding WebDriver as an enabled module in Acceptance.suite.yml but that gave the following error:

Codeception PHP Testing Framework v5.1.2 https://stand-with-ukraine.pp.ua

In ModuleContainer.php line 486:

  craft\test\Craft module conflicts with WebDriver

  --
  This usually happens when you enable two modules with the same actions but with different backends.
  For instance, you can't run PhpBrowser, WebDriver, Laravel5 modules in one suite,
  as they implement similar methods but use different drivers to execute them.
  You can load a part of module (like: ORM) to avoid conflict.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants