We are going to run through the initial setup for CodeceptJS, begin by writing some simple tests and get them up and running with a few different testing frameworks.
So to get started let’s create our CodeceptJS directory and install the relevant npm packages.
npm install -g codeceptjs
Next we will initialize CodeceptJS, which will create our codecept.json config file. We will be asked a few questions based on the frameworks and setup we would like to use.
For this example I’ve selected WebDriverIO (use the space-bar to select multiple options from the command line), and for all of the other options we will be using the default selections. The baseurl I selected was https://www.google.com, so we can start writing some tests for that page.
Before we start writing tests, I would suggest installing a code editor if you don’t already have one installed. My personal preference is Visual Studio Code which has some nice intellisense options, file explorer and command line all in one, so we don’t need to leave the application when writing tests.
If we open up our initial directory in VS Code, we should have something which looks like this.
Now we have everything installed and the initial project setup, we can start writing tests. See part 2, where we will run through the commands needed to generate tests, explore the project structure, and run our tests with multiple frameworks.