generated from EyeSeeTea/dhis2-app-skeleton
-
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.
Merge pull request #1 from EyeSeeTea/release/0.1.0
[Merge] Release 0.1.0
- Loading branch information
Showing
95 changed files
with
63,139 additions
and
1,784 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
BROWSER=false | ||
PORT=8081 | ||
SKIP_PREFLIGHT_CHECK=true | ||
REACT_APP_DHIS2_BASE_URL=http://dev2.eyeseetea.com:8085/ | ||
REACT_APP_DHIS2_BASE_URL=https://dev.eyeseetea.com/play | ||
|
||
CYPRESS_DHIS2_AUTH='admin:district' | ||
CYPRESS_EXTERNAL_API="https://dev.eyeseetea.com/play" | ||
CYPRESS_ROOT_URL=http://localhost:8081 |
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,5 +1,3 @@ | ||
module.exports = process.env.CYPRESS_E2E | ||
? {} | ||
: { | ||
presets: ["@babel/typescript", ["babel-preset-react-app", { runtime: "automatic" }]], | ||
}; | ||
module.exports = { | ||
presets: ["@babel/typescript", ["babel-preset-react-app", { runtime: "automatic" }]], | ||
}; |
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,30 @@ | ||
/* Required for CRA 4, see https://github.com/welldone-software/why-did-you-render/issues/154#issuecomment-773905769 */ | ||
|
||
module.exports = { | ||
babel: { | ||
loaderOptions: babelLoaderOptions => { | ||
const origBabelPresetCRAIndex = babelLoaderOptions.presets.findIndex(preset => { | ||
return preset[0].includes("babel-preset-react-app"); | ||
}); | ||
|
||
const origBabelPresetCRA = babelLoaderOptions.presets[origBabelPresetCRAIndex]; | ||
|
||
babelLoaderOptions.presets[origBabelPresetCRAIndex] = function overridenPresetCRA(api, opts, env) { | ||
const babelPresetCRAResult = require(origBabelPresetCRA[0])(api, origBabelPresetCRA[1], env); | ||
|
||
babelPresetCRAResult.presets.forEach(preset => { | ||
// detect @babel/preset-react with {development: true, runtime: 'automatic'} | ||
const isReactPreset = | ||
preset && preset[1] && preset[1].runtime === "automatic" && preset[1].development === true; | ||
if (isReactPreset) { | ||
preset[1].importSource = "@welldone-software/why-did-you-render"; | ||
} | ||
}); | ||
|
||
return babelPresetCRAResult; | ||
}; | ||
|
||
return babelLoaderOptions; | ||
}, | ||
}, | ||
}; |
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,57 @@ | ||
import { getApiUrl } from "./commands"; | ||
|
||
const users = { | ||
admin: { username: "cypress-admin", password: "Testing123$" }, | ||
basic: { username: "cypress-basic", password: "Testing123$" }, | ||
}; | ||
|
||
export class App { | ||
/* Constructors */ | ||
|
||
static get(options: { user: UserKey }): App { | ||
const app = new App(); | ||
app.load(users[options.user]); | ||
return app; | ||
} | ||
|
||
/* Generic Helpers */ | ||
|
||
load(auth: { username: string; password: string }) { | ||
cy.request({ method: "GET", url: getApiUrl("/api/me"), auth, log: true }).then(res => { | ||
expect(res.status).to.equal(200); | ||
}); | ||
|
||
cy.visit("/"); | ||
} | ||
|
||
shouldContainText(text: string, options?: { clickable: boolean }) { | ||
if (options?.clickable) { | ||
cy.contains(text).should("have.css", "cursor", "pointer"); | ||
} else { | ||
cy.contains(text); | ||
} | ||
} | ||
|
||
shouldNotContainText(text: string) { | ||
cy.findByText(text).should("not.exist"); | ||
} | ||
|
||
shouldNotShowText(text: string) { | ||
cy.findByText(text).should("not.be.visible"); | ||
} | ||
|
||
clickOnText(text: string) { | ||
cy.contains(text).click(); | ||
} | ||
|
||
/* MUI helpers */ | ||
|
||
selectOptionSelector(options: { label: string; select: string }) { | ||
const { label, select } = options; | ||
this.shouldContainText(label); | ||
this.clickOnText(label); | ||
cy.findByRole("presentation").findByText(select).click(); | ||
} | ||
} | ||
|
||
type UserKey = keyof typeof users; |
This file was deleted.
Oops, something went wrong.
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,28 @@ | ||
import "@testing-library/cypress/add-commands"; | ||
import * as qs from "qs"; | ||
|
||
const appUrl: string = Cypress.env("ROOT_URL") || ""; | ||
|
||
const dhis2Url: string = appUrl + "/dhis2"; | ||
|
||
function setup() { | ||
Cypress.config("baseUrl", appUrl); | ||
|
||
Cypress.Cookies.defaults({ preserve: "JSESSIONID" }); | ||
|
||
Cypress.on("uncaught:exception", (err, runnable) => { | ||
console.error("uncaught:exception", { err, runnable }); | ||
// returning false here prevents Cypress from failing the test | ||
return false; | ||
}); | ||
} | ||
|
||
setup(); | ||
|
||
/* Public interface */ | ||
|
||
export function getApiUrl(path: string, params?: Record<string, number | boolean | string | string[]>) { | ||
const baseUrl = dhis2Url.replace(/\/$/, "") + "/" + path.replace(/^\//, ""); | ||
const queryString = qs.stringify(params || {}, { arrayFormat: "repeat", addQueryPrefix: true }); | ||
return baseUrl + queryString; | ||
} |
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,18 +1,2 @@ | ||
// *********************************************************** | ||
// This example support/index.js 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.js using ES2015 syntax: | ||
import "./commands"; | ||
import "cypress-xpath"; |
Oops, something went wrong.