Sails (Part 1)

Neil HaddleyOctober 12, 2021

Azure DevOps and Sails.

Sails.js (or Sails) is a web framework that makes it easy to build custom, enterprise-grade Node.js apps.

It is designed to resemble the MVC architecture from frameworks like Ruby on Rails.

The Azure DevOps Starter includes support for Sails.

DevOps Starter

DevOps Starter

Create DevOps starter

Create DevOps starter

Setting up Node.js web app with GitHub

Setting up Node.js web app with GitHub

Select Sails.js and add a database

Select Sails.js and add a database

Web App for Containers

Web App for Containers

Connect to GitHub

Connect to GitHub

Web App, Container Registry and Database settings

Web App, Container Registry and Database settings

Review and Create

Review and Create

Deployment in progress

Deployment in progress

Deployment is complete

Deployment is complete

GitHub action is running

GitHub action is running

Authorise

Authorise

Build and push Application to Container Repository

Build and push Application to Container Repository

Run functional tests (Connect to web site using Selenium and check site title)

Run functional tests (Connect to web site using Selenium and check site title)

set up test environment and run tests

set up test environment and run tests

GitHub action/job complete

GitHub action/job complete

web site has been published

web site has been published

Open GitHub repository using GitHub Desktop

Open GitHub repository using GitHub Desktop

Clone

Clone

Open in Visual Studio Code

Open in Visual Studio Code

Sample Functional Tests

Sample Functional Tests

local development environment

Open Visual Studio Code terminal

Navigate to the Application folder

BASH
1% cd Application

Start the application on the laptop

BASH
1% sails lift
sails lift

sails lift

http://localhost:1337

http://localhost:1337

Testing testing

Updating the default page title (in the layout file) results in a failed test.

Updating the web page title (without updating the web page title test)

Updating the web page title (without updating the web page title test)

pushing update

pushing update

code is deployed and functional test fails (as expected)

code is deployed and functional test fails (as expected)

References