Skip to content

Automated Testing #3

@ebuckley

Description

@ebuckley

Currently we are testing this plugin as part of a larger selenium test suite used in another project. It makes sense for this project to own it's own unit tests.

Here are the automated feature tests we have currently.

@protected-resource
Feature: Sysadmins can mark resources as protected to avoid acidental deletion
  Background: There is a user with editor permissions in an organiation
    Given an Organisation "Ministry of Silly Walks"
    And a admin User "admin" "developers@mediasuite.co.nz"
    And a User "sfry" "stephan.fry@mosw.govt.nz"
    And "sfry" has Admin Permission in Organisation "Ministry of Silly Walks"
    And A dataset with two resources
    
  @fixture.cleanup_datasets
  Scenario: As a sysadmin I can't delete a protected dataset
    Given A protected resource "abalone_data.csv" on the "Abalone data" dataset
    And I login with the user "admin"
    And I am on the Dataset Page for "Abalone Data"
    When I press "Manage"
    And I wait for "1" seconds
    Then I should see the text on the page "This dataset contains a protected resource"


  @fixture.cleanup_datasets
  Scenario: As a sysadmin I can delete a non-protected resource
    Given A protected resource "abalone_data.csv" on the "Abalone data" dataset
    And I login with the user "admin"
    And I am on the Dataset Page for "Abalone Data"
    And I press "data.json"
    And I wait for "1" seconds
    When I press "Manage"
    Then I should see
      """
      Delete
     """

  @fixture.cleanup_datasets
  Scenario: As an admin I can't delete a protected dataset
    Given A protected resource "abalone_data.csv" on the "Abalone data" dataset
    And I login with the user "sfry"
    And I am on the Dataset Page for "Abalone Data"
    When I press "Manage"
    And I wait for "1" seconds
    Then I should see the text on the page "This dataset contains a protected resource"

  @fixture.cleanup_datasets
  Scenario: As an admin I can't delete a protected dataset
    Given A protected resource "abalone_data.csv" on the "Abalone data" dataset
    And I login with the user "sfry"
    And I am on the Dataset Page for "Abalone Data"
    And I press "abalone_data.csv"
    And I wait for "1" seconds
    When I press "Manage"
    And I wait for "1" seconds
    Then I should see the text on the page "This resource is protected"

  @fixture.cleanup_datasets
  Scenario: As a sysadmin I can lock a non-protected resource
    Given I login with the user "admin"
    And I am on the Dataset Page for "Abalone Data"
    When I press "data.json"
    And I wait for "1" seconds
    Then I should see the text on the page "Lock Resource"

  @fixture.cleanup_datasets
  Scenario: As a sysadmin I can unlock a protected resource
    Given A protected resource "abalone_data.csv" on the "Abalone data" dataset
    And I login with the user "admin"
    And I am on the Dataset Page for "Abalone Data"
    When I press "abalone_data.csv"
    And I wait for "1" seconds
    Then I should see the text on the page "Unlock Resource"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions