- Issue created by @ressa
- πΊπΈUnited States aangel
@ressa I had always thought that eventually we would have a test for both since both are highly used. I started with XML Sitemap simply because that's what I was using my company website.
Have you modified the XML Sitemap test to use Simple Sitemap? If so, would you be willing to contribute it back to ATK?
- π©π°Denmark ressa Copenhagen
Thanks for a fast answer @aangel, and I also in the meantime thought that -- maybe adding, rather than removing, may be the way, since many sites still use XML sitemap.
I have limited experience with testing, so with the help from @jaypan, we created this page a while ago: Browser testing using Cypress β .
Based on that page and https://performantlabs.com/automated-testing-kit/installation, I tried to get it up and running in Debian 12, but get an error:
The commands:
$ mkdir ./test $ export ATK_HOME=./test $ web/modules/contrib/automated_testing_kit/module_support/atk_setup cypress $ cd test/ $ npm init -y $ npm install cypress --save-dev $ npx cypress open DevTools listening on ws://127.0.0.1:39061/devtools/browser/5e7be6c8-ab09-4037-b213-1d757f94c845 [48396:0610/113148.012941:ERROR:atom_cache.cc(229)] Add _NET_WM_WINDOW_TYPE_INDEX to kAtomsToCache Couldn't find tsconfig.json. tsconfig-paths will be skipped
The error:
cypress testE2E Testing v14.4.1 Docs Log in
Cypress configuration error Try again
Error
Your project does not contain a default supportFile. We expect a file matching cypress/support/e2e.{js,jsx,ts,tsx} to exist.
If a support file is not necessary for your project, set supportFile to false.
https://on.cypress.io/support-file-missing-or-invalidStack trace
Error: Your project does not contain a default supportFile. We expect a file matching cypress/support/e2e.{js,jsx,ts,tsx} to exist.If a support file is not necessary for your project, set supportFile to false.
https://on.cypress.io/support-file-missing-or-invalid
at M (:2309:9303)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async T.buildBaseFullConfig (:2526:57706)
at async T.getFullInitialConfig (:2526:59155)
at async T.setupNodeEvents (:2526:53170)PS. It looks like there is no dev-release, which I believe is the recommended structure, so that MR's can be made against that under "Version" ...
Hi ressa. Could you switch to version 2.0.0 of Automated Testing Kit? It brings support file. And Merge Request can be done to release/2.1 branch.
- π©π°Denmark ressa Copenhagen
Thanks for a fast answer @ilyaukin, that got me a bit further.
I now get this warning on the "Choose a browser Choose your preferred browser for E2E testing." page:
Warning: Cannot Connect Base Url Warning
Cypress could not verify that this server is running:
http://automated-testing-kit-d10:8888/
This server has been configured as your baseUrl, and tests will likely fail if it is not running.When I select a browser and run a test, I get this error:
atk_register_login.cy.js394ms User registration and login tasks. (ATK-CY-1000) Register with form.failed before all (failed) 1 readFilecypress/data/atk_prerequisites.yml 2 execdrush pm:list --forma... 3 thenfunction(){} SyntaxError JSON.parse: unexpected end of data at line 1 column 1 of the JSON data Because this error occurred during a before all hook we are skipping all of the remaining tests. cypress/support/e2e.js:28:37 26 | cy.execDrush(prerequisite.command).then((output) => { 27 | if (prerequisite.json) { > 28 | const outputJson = JSON.parse(output) | ^ 29 | // Each property of prerequisite.json is a condition. 30 | // eslint-disable-next-line no-restricted-syntax,prefer-const 31 | for (let [key, condition] of Object.entries(prerequisite.json)) { View stack trace Print to console at <unknown> (webpack://automated-testing-kit/./cypress/support/e2e.js:28:36) at getRet (http://automated-testing-kit-d10:8888/__cypress/runner/cypress_runner.js:120941:20) at tryCatcher (http://automated-testing-kit-d10:8888/__cypress/runner/cypress_runner.js:1777:23) at __webpack_modules__</module.exports/Promise.try (http://automated-testing-kit-d10:8888/__cypress/runner/cypress_runner.js:4285:29) at thenFn (http://automated-testing-kit-d10:8888/__cypress/runner/cypress_runner.js:120952:60) at then (http://automated-testing-kit-d10:8888/__cypress/runner/cypress_runner.js:121203:21) at wrapped (http://automated-testing-kit-d10:8888/__cypress/runner/cypress_runner.js:141524:19) at __webpack_modules__</runCommand (http://automated-testing-kit-d10:8888/__cypress/runner/cypress_runner.js:147469:15) at tryCatcher (http://automated-testing-kit-d10:8888/__cypress/runner/cypress_runner.js:1777:23) at __webpack_modules__</module.exports/Promise.prototype._settlePromiseFromHandler (http://automated-testing-kit-d10:8888/__cypress/runner/cypress_runner.js:1489:31) at __webpack_modules__</module.exports/Promise.prototype._settlePromise (http://automated-testing-kit-d10:8888/__cypress/runner/cypress_runner.js:1546:18) at __webpack_modules__</module.exports/Promise.prototype._settlePromiseCtx (http://automated-testing-kit-d10:8888/__cypress/runner/cypress_runner.js:1583:10) at _drainQueueStep (http://automated-testing-kit-d10:8888/__cypress/runner/cypress_runner.js:2381:12) at _drainQueue (http://automated-testing-kit-d10:8888/__cypress/runner/cypress_runner.js:2370:24) at __webpack_modules__</Async.prototype._drainQueues (http://automated-testing-kit-d10:8888/__cypress/runner/cypress_runner.js:2386:16) at __webpack_modules__</Async/this.drainQueues (http://automated-testing-kit-d10:8888/__cypress/runner/cypress_runner.js:2256:14) From previous event: at captureStackTrace (http://automated-testing-kit-d10:8888/__cypress/runner/cypress_runner.js:3889:23) at CapturedTrace (http://automated-testing-kit-d10:8888/__cypress/runner/cypress_runner.js:3781:22) at longStackTracesCaptureStackTrace (http://automated-testing-kit-d10:8888/__cypress/runner/cypress_runner.js:3456:19) at __webpack_modules__</module.exports/Promise.prototype._then (http://automated-testing-kit-d10:8888/__cypress/runner/cypress_runner.js:1209:17) at __webpack_modules__</module.exports/Promise.prototype._passThrough (http://automated-testing-kit-d10:8888/__cypress/runner/cypress_runner.js:4080:17) at __webpack_modules__</module.exports/Promise.prototype.finally (http://automated-testing-kit-d10:8888/__cypress/runner/cypress_runner.js:4089:17) at onRunnableRun (http://automated-testing-kit-d10:8888/__cypress/runner/cypress_runner.js:166911:46) at action (http://automated-testing-kit-d10:8888/__cypress/runner/cypress_runner.js:41560:28) at __webpack_modules__</patchRunnableRun/Runnable.prototype.run (http://automated-testing-kit-d10:8888/__cypress/runner/cypress_runner.js:148873:13) at next (http://automated-testing-kit-d10:8888/__cypress/runner/cypress_runner.js:159136:10) at __webpack_modules__</Runner.prototype.hook (http://automated-testing-kit-d10:8888/__cypress/runner/cypress_runner.js:159180:9) at timeslice (http://automated-testing-kit-d10:8888/__cypress/runner/cypress_runner.js:149224:27) (ATK-CY-1010) Log in with form.processing (ATK-CY-1011) Log in with POST.processing (ATK-CY-1012) Log in via ULI.processing (ATK-CY-1020) Create user with Drush, delete by email.processing (ATK-CY-1021) Create user with Drush, delete by UID.processing (ATK-CY-1030) Reset password.
If I try to comment out this line in
cypress.config.js
, I don't get the first error about "Warning: Cannot Connect Base Url Warning" but still get the same error, if I try to run a test:baseUrl: 'http://automated-testing-kit-d10:8888/',
- πΊπΈUnited States aangel
@ressa the test is failing on the pre-flight checks. Looking through the output, because I'm seeing "drush: command not found," please ensure that Drush is installed locally and on the target server. Drush is used in the tests and for the pre-flight checks.
[Checks if the requirements mention Drush.]
Yes, Drush is properly mentioned as a requirement.
ATK is a the ultimate in white-box testing: it actually communicates with the destination site. That enables the Kit to do fancy things it normally would not be able to. In this XML test, it allows us to run a custom Drush command that confirms the page was regenerated by comparing file timestamps.
If you are just trying to target your local dev box, ensure Drupal is running and the baseUrl is pointing to the actual URL of your installation. We ship with this URL ("http://automated-testing-kit-d10:8888/') but it's almost certainly wrong for your setup.
The Configuration page explains how to get ready to run tests.
- π©π°Denmark ressa Copenhagen
Thanks @aangel, your comment gave me the missing pieces, especially the https://performantlabs.com/automated-testing-kit/installation page. After updating the Drush command and the test URL, I got it working.
I have created a test for Simple XML Sitemap, and look forward to feedback about it.
PS. I hope I created the MR target correctly ... it would have been slightly easier, if there was a 2.x dev branch, though you probably have good reasons for the current set up :)
- πΊπΈUnited States aangel
Thanks for this, @ressa. We will work with you on it and when it's ready convert it to Playwright.
There probably should be a 2.x dev branch to be consistent but I was also trying to work out having a 2.1 branch earlier in the process. It's probably best just to leave things in 2.x-dev and cherry pick whatever is ready into 2.1 when the time comes. I had a vision of something else but maybe it's not better after all.