-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OCLOMRS-790:Automated Test: Editing an Organization (#727)
* OCLOMRS-790:Automated Test: Editing an Organization * updated formatting * Add line at the end of the file * Add line * Add line at the end of the file Co-authored-by: kyampeire Hadijah <30952856+hadijahkyampeire@users.noreply.github.com>
- Loading branch information
1 parent
266b6ee
commit 2a29e87
Showing
3 changed files
with
78 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Feature: Editing a organisation | ||
Background: | ||
Given the user is logged in | ||
|
||
@organisation | ||
Scenario: The user should be able to make a public organization private | ||
Given a public organization exists | ||
And the user is on the edit organization page | ||
When the user selects "None" Public Access | ||
And the user submits the form | ||
Then the organization should not be publicly visible | ||
|
||
@organisation | ||
Scenario: The user should be able to make a private organization public | ||
Given a private organization exists | ||
And the user is on the edit organization page | ||
When the user selects "View" Public Access | ||
And the user submits the form | ||
Then the organization 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
43 changes: 43 additions & 0 deletions
43
cypress/support/step_definitions/organisation/edit/edit.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,43 @@ | ||
import { Given, Then, When } from "cypress-cucumber-preprocessor/steps"; | ||
import { getOrganisationId } from "../../../utils"; | ||
|
||
Given(/a (public|private) organization exists/, type => { | ||
const organisationId = getOrganisationId(); | ||
cy.createOrganisation(organisationId, type === "public"); | ||
}); | ||
|
||
Given("the user is on the edit organization page", () => | ||
cy.visit(`/orgs/${getOrganisationId()}/edit/`) | ||
); | ||
|
||
When(/the user selects "(.+)" Public Access/, public_access => { | ||
switch (public_access) { | ||
case "View": | ||
cy.get("#public_access").type("{uparrow}{uparrow}{enter}"); | ||
break; | ||
case "None": | ||
cy.get("#public_access").type("{downarrow}{downarrow}{enter}"); | ||
break; | ||
default: | ||
throw `Unknown Public Access ${public_access}. I only know how to handle "View" and "None".`; | ||
} | ||
}); | ||
|
||
When("the user submits the form", () => { | ||
cy.get("form").submit(); | ||
cy.url().should("not.contain", `/edit/`); | ||
}); | ||
|
||
Then("the organization should not be publicly visible", () => | ||
cy | ||
.getOrganisation(getOrganisationId()) | ||
.its("public_access") | ||
.should("eq", "None") | ||
); | ||
|
||
Then("the organization should be publicly visible", () => | ||
cy | ||
.getOrganisation(getOrganisationId()) | ||
.its("public_access") | ||
.should("eq", "View") | ||
); |