[4.x]: Codeception Acceptance testing - Javascript must be enabled to access control panel
Open
@angrybrad is already working on this.
Since Aug 2, 2024.
bug
craft4
- Dominant language
- PHP
- Stars
- 3.6k
- Forks
- 705
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 134
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.