Automation Testing

Using software (separate to software being tested) to execute tests that verify program is running as expected.

Generate keystrokes / mouse clicks

Observe changes in User Interface

Testing individual methods in code

Responses from external services

Write tests with different granularity

Fewer high-level tests

Save time over manual regression testing

Brings testing earlier in development cycle

Test cases written before development

Faster feedback

Earlier detection of errors

Potential benefits

Less time spent on repetitive tasks

Javascript E2E testing framework

Real time reloading of test files

Automatic waiting - no explicit waits

Not Selenium

Automatically take screenshots / videos

Time travel

As an IT user

I want to use integrated authentication

So that it works seamlessly with my existing Windows/Okta account 

  • App authenticates against a service which integrates with existing StepChange accounts
  • On initial load an unauthorised user is shown a login screen
  • The login screen has a button which redirects the user to Okta when clicked
  • Once logged in the user is redirected to the homepage
  • Authorised users are allowed to search, view results and record details
  • If a user is no longer logged in to Okta then the user will be;- 
    • redirected to the Okta login page if not on the homepage
    • shown the login screen if on the homepage

It shows search on home page when logging in with a valid username and password

It does not show search on home page when logging in with a valid username and password

Test cases

Cypress scripting

cy.visit(route)

Visit a route (defined in Angular code)

cy.get(element)

Focus on a particular DOM element

cy.get(element).type(text)

Type into the element (if it's a text box)

cy.get(element).click()

Click the element (if it's a button)

Cypress scripting

cy.get(element).should('exist')

Cypress scripting


Assertions

cy.get(element).should('not.exist')

Gherkin scripting

With Cucumber preprocessor

describe ('Login tests', function() {
  it('Shows search on home page when logging in with valid username / password', function() {

    cy.server();
    cy.route('POST', 'api/v1/authn').as('login');
    cy.route('GET', 'oauth2/default/v1/keys').as('authorise');
    cy.visit('login');
    cy.get('[id="okta-signin-username"]').type('davek@cccs.co.uk');
    cy.get('[id="okta-signin-password"]').type('t3mppassw0rd!');
    cy.get('[id="okta-signin-submit"]').click();
    cy.wait('@login');
    cy.wait('@authorise');
    cy.visit('/');
    cy.get('app-search').should('exist');
 })
Feature: Authorisation

  Background:
    Given Im on the login screen

  Scenario: I log in
    When I enter the username "dave.kane@cccs.co.uk"
    When I enter the password "t3mppassw0rd!"
    When I press the login button
    Then I log in

  Scenario: I dont log in
    When I enter the username "dave.kane@cccs.co.uk"
    When I enter the password "bollocks!"
    When I press the login button
    Then I dont log in

Given('I'm on a page', () => {

      cy.visit('page')

});

When('I enter the text {string}', (text) => {

      cy.get('box').type(text)

});

Doesn't currently support IE

Currently doesn't play nice with Okta

Paid version

Less support than Protractor, etc.

deck

By dgkane

deck

  • 590