-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OCLOMRS-791: Automated Test: New organization creation form (#716)
- Loading branch information
Showing
7 changed files
with
221 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Feature: Creating an organisation | ||
Background: | ||
Given the user is logged in | ||
|
||
Scenario: The user should be able to click the button to create a new organisation | ||
Given the user is on the organisations page | ||
When the user clicks on the create new organisation button | ||
Then the user should be on the create new organisation page | ||
|
||
@organisation | ||
Scenario: The user should be able to create a new organisation | ||
Given the user is on the create new organisation page | ||
When the user enters the organisation information | ||
And the user submits the form | ||
Then the new organisation should be created | ||
|
||
@organisation | ||
Scenario: The user should be able to create a public organisation | ||
Given the user is on the create new organisation page | ||
When the user enters the organisation information | ||
And the user selects "View" view | ||
And the user submits the form | ||
Then the new organisation should be created | ||
And the organisation should be publicly visible |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,24 @@ | ||
// *********************************************************** | ||
// This example support/index.ts is processed and | ||
// loaded automatically before your test files. | ||
// | ||
// This is a great place to put global configuration and | ||
// behavior that modifies Cypress. | ||
// | ||
// You can change the location of this file or turn off | ||
// automatically serving support files with the | ||
// 'supportFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/configuration | ||
// *********************************************************** | ||
|
||
// Import commands.ts using ES2015 syntax: | ||
import "./commands"; | ||
|
||
Cypress.on("uncaught:exception", err => { | ||
console.debug("Uncaught exception", err); | ||
// returning false here prevents Cypress from | ||
// failing the test | ||
return false; | ||
}); |
81 changes: 81 additions & 0 deletions
81
cypress/support/step_definitions/organisation/create/create.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/// <reference types="cypress" /> | ||
/// <reference types="../../../" /> | ||
import { | ||
After, | ||
Before, | ||
Given, | ||
Then, | ||
When | ||
} from "cypress-cucumber-preprocessor/steps"; | ||
import { customAlphabet } from "nanoid"; | ||
import { getOrganisationId, isLoggedIn } from "../../../utils"; | ||
|
||
let organisationID = ""; | ||
const nanoid = customAlphabet("abcdefghijklmnopqrstuvwxyz", 4); | ||
|
||
Given("the user is on the organisations page", () => cy.visit("/orgs/")); | ||
|
||
Given("the user is on the create new organisation page", () => | ||
cy.visit("/orgs/new/") | ||
); | ||
|
||
When("the user clicks on the create new organisation button", () => | ||
cy.findByTitle(/Create new organisation/i).click() | ||
); | ||
|
||
When("the user enters the organisation information", () => { | ||
cy.findByLabelText(/Organisation ID/i).type(organisationID); | ||
cy.findByLabelText(/Organisation Name/i).type(organisationID); | ||
cy.get("#public_access").type("{enter}"); | ||
}); | ||
|
||
When(/the user selects "(.+)" view/, public_access => { | ||
switch (public_access) { | ||
case "View": | ||
cy.get("#public_access").type("{downarrow}{uparrow}{enter}"); | ||
break; | ||
case "None": | ||
cy.get("#public_access").type("{downarrow}{downarrow}{enter}"); | ||
break; | ||
default: | ||
} | ||
}); | ||
|
||
When("the user submits the form", () => { | ||
cy.get("form").submit(); | ||
cy.url().should("contain", `/orgs/${organisationID}/`); | ||
}); | ||
|
||
Then("the user should be on the create new organisation page", () => | ||
cy.url().should("contain", "/orgs/new/") | ||
); | ||
|
||
Then("the new organisation should be created", () => | ||
cy.getOrganisation(organisationID).should("exist") | ||
); | ||
|
||
Then("the organisation should be publicly visible", () => | ||
cy | ||
.getOrganisation(organisationID) | ||
.its("public_access") | ||
.should("eq", "View") | ||
); | ||
|
||
Then("the organisation should be viewed publicly accessed", () => | ||
cy | ||
.getOrganisation(organisationID) | ||
.its("public_access") | ||
.should("eq", "None") | ||
); | ||
|
||
Before({ tags: "@organisation" }, () => { | ||
organisationID = `Org-${nanoid()}`; | ||
}); | ||
|
||
After({ tags: "@organisation" }, () => { | ||
isLoggedIn().then(loggedIn => { | ||
if (loggedIn) { | ||
cy.deleteOrganisation(organisationID, true); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters