-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
136 changed files
with
9,043 additions
and
3,889 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
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 |
---|---|---|
|
@@ -35,7 +35,7 @@ public static void SeedTestData(this Context context) | |
context.SeedMandates(); | ||
context.SeedDeliveries(); | ||
context.SeedAssets(); | ||
context.AuthorizeFirstUser(); | ||
context.AddOrganisationsToDefaultUsers(); | ||
|
||
transaction.Commit(); | ||
} | ||
|
@@ -187,15 +187,15 @@ public static void SeedAssets(this Context context) | |
context.SaveChanges(); | ||
} | ||
|
||
public static void AuthorizeFirstUser(this Context context) | ||
public static void AddOrganisationsToDefaultUsers(this Context context) | ||
{ | ||
var user = context.Users.OrderBy(u => u.Id).First(); | ||
var organisation = context.Organisations.OrderBy(o => o.Id).First(); | ||
var mandates = context.Mandates.OrderBy(m => m.Id).Skip(1); | ||
var admin = context.Users.Single(user => user.Email == "[email protected]"); | ||
var adminOrganisations = context.Organisations.OrderBy(o => o.Id).Skip(1); | ||
admin.Organisations.AddRange(adminOrganisations); | ||
|
||
user.IsAdmin = true; | ||
user.Organisations.Add(organisation); | ||
organisation.Mandates.AddRange(mandates); | ||
var user = context.Users.Single(user => user.Email == "[email protected]"); | ||
var userOrganistions = context.Organisations.OrderBy(o => o.Id).Take(2); | ||
user.Organisations.AddRange(userOrganistions); | ||
|
||
context.SaveChanges(); | ||
} | ||
|
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
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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { | ||
isSelectedNavItem, | ||
loadWithoutAuth, | ||
loginAsAdmin, | ||
loginAsNewUser, | ||
loginAsUploader, | ||
logout, | ||
openTool, | ||
selectLanguage, | ||
} from "./helpers/appHelpers.js"; | ||
import { selectAdminNavItem } from "./helpers/adminHelpers.js"; | ||
|
||
describe("General app tests", () => { | ||
it("shows no login button if auth settings could not be loaded", () => { | ||
loadWithoutAuth(); | ||
cy.get('[data-cy="login-button"]').should("not.exist"); | ||
}); | ||
|
||
it.skip("registers new users and logs them in", () => { | ||
loginAsNewUser(); | ||
cy.get('[data-cy="loggedInUser-button"]').should("exist"); | ||
cy.get('[data-cy="loggedInUser-button"]').click(); | ||
cy.contains("Norbert Newuser"); | ||
}); | ||
|
||
it("shows admin tools only for admin users", () => { | ||
loginAsUploader(); | ||
cy.get('[data-cy="loggedInUser-button"]').click(); | ||
cy.get('[data-cy="delivery-nav"]').should("exist"); | ||
cy.get('[data-cy="admin-nav"]').should("not.exist"); | ||
cy.get('[data-cy="stacBrowser-nav"]').should("not.exist"); | ||
logout(); | ||
|
||
loginAsAdmin(); | ||
cy.get('[data-cy="loggedInUser-button"]').click(); | ||
cy.get('[data-cy="delivery-nav"]').should("exist"); | ||
isSelectedNavItem("delivery-nav", "tool-navigation"); | ||
cy.get('[data-cy="admin-nav"]').should("exist"); | ||
cy.get('[data-cy="stacBrowser-nav"]').should("exist"); | ||
|
||
openTool("admin"); | ||
cy.location().should(location => { | ||
expect(location.pathname).to.eq(`/admin/delivery-overview`); | ||
}); | ||
isSelectedNavItem("admin-delivery-overview-nav", "admin-navigation"); | ||
|
||
cy.get('[data-cy="loggedInUser-button"]').click(); | ||
isSelectedNavItem("admin-nav", "tool-navigation"); | ||
cy.get('[data-cy="admin-nav"]').click(); | ||
|
||
selectAdminNavItem("users"); | ||
selectAdminNavItem("mandates"); | ||
selectAdminNavItem("organisations"); | ||
selectAdminNavItem("delivery-overview"); | ||
}); | ||
|
||
it("updates the language when the user selects a different language", () => { | ||
cy.visit("/"); | ||
cy.contains("EN"); | ||
cy.contains("Log In"); | ||
|
||
selectLanguage("de"); | ||
cy.contains("DE"); | ||
cy.contains("Anmelden"); | ||
|
||
selectLanguage("fr"); | ||
cy.contains("FR"); | ||
cy.contains("Se connecter"); | ||
|
||
selectLanguage("it"); | ||
cy.contains("IT"); | ||
cy.contains("Accedi"); | ||
}); | ||
}); |
Oops, something went wrong.