-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into chore/useQueryCacheProvider
- Loading branch information
Showing
28 changed files
with
451 additions
and
128 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
const { chromeAllowXSiteCookies } = require('@dhis2/cypress-plugins') | ||
const { defineConfig } = require('cypress') | ||
const { | ||
downloadedFileTasks, | ||
} = require('./cypress/plugins/downloadedFileTasks.js') | ||
const { | ||
excludeByVersionTags, | ||
} = require('./cypress/plugins/excludeByVersionTags.js') | ||
|
||
async function setupNodeEvents(on, config) { | ||
chromeAllowXSiteCookies(on, config) | ||
excludeByVersionTags(on, config) | ||
downloadedFileTasks(on) | ||
|
||
if (!config.env.dhis2InstanceVersion) { | ||
throw new Error( | ||
'dhis2InstanceVersion is missing. Check the README for more information.' | ||
) | ||
} | ||
|
||
return config | ||
} | ||
|
||
module.exports = defineConfig({ | ||
projectId: 'r5jduj', | ||
e2e: { | ||
setupNodeEvents, | ||
baseUrl: 'http://localhost:3000', | ||
specPattern: 'cypress/integration/**/*.cy.js', | ||
viewportWidth: 1280, | ||
viewportHeight: 800, | ||
defaultCommandTimeout: 15000, | ||
// Record video | ||
video: true, | ||
/* Only compress and upload videos for failures. | ||
* This will save execution time and reduce the risk | ||
* out-of-memory issues on the CI machine */ | ||
videoUploadOnPasses: false, | ||
// Enabled to reduce the risk of out-of-memory issues | ||
experimentalMemoryManagement: true, | ||
// Set to a low number to reduce the risk of out-of-memory issues | ||
numTestsKeptInMemory: 5, | ||
/* When allowing 1 retry on CI, the test suite will pass if | ||
* it's flaky. And/but we also get to identify flaky tests on the | ||
* Cypress Dashboard. */ | ||
retries: { | ||
runMode: 1, | ||
openMode: 0, | ||
}, | ||
}, | ||
env: { | ||
dhis2DatatestPrefix: 'dhis2-maps', | ||
networkMode: 'live', | ||
}, | ||
}) |
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,3 @@ | ||
import { EXTENDED_TIMEOUT } from '../support/util.js' | ||
|
||
export const getMaps = () => cy.get('.dhis2-map canvas', EXTENDED_TIMEOUT) |
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,49 @@ | ||
import { getMaps } from './map_canvas.js' | ||
|
||
export const DRILL_UP = 'context-menu-drill-up' | ||
export const DRILL_DOWN = 'context-menu-drill-down' | ||
export const VIEW_PROFILE = 'context-menu-view-profile' | ||
export const SHOW_LONG_LAT = 'context-menu-show-long-lat' | ||
|
||
const ALL_OPTIONS = [DRILL_UP, DRILL_DOWN, VIEW_PROFILE, SHOW_LONG_LAT] | ||
|
||
export const expectContextMenuOptions = (availableOptions) => { | ||
getMaps() | ||
.first() | ||
.then(($el) => { | ||
const xpos = $el.width() / 2 | ||
const ypos = $el.height() / 2 | ||
|
||
// right clicking on the center of the map should hit an OU | ||
getMaps().first().rightclick(xpos, ypos) | ||
|
||
// menu has correct number of items | ||
cy.getByDataTest('context-menu') | ||
.find('li') | ||
.should('have.length', availableOptions.length) | ||
|
||
const unavailableOptions = ALL_OPTIONS.filter( | ||
(opt) => !availableOptions.map((opt) => opt.name).includes(opt) | ||
) | ||
|
||
unavailableOptions.forEach((name) => | ||
cy.getByDataTest(name).should('not.exist') | ||
) | ||
|
||
availableOptions.forEach((option) => { | ||
// check the menu items | ||
cy.getByDataTest(option.name).should('be.visible') | ||
if (option.disabled) { | ||
cy.getByDataTest(option.name).should( | ||
'have.class', | ||
'disabled' | ||
) | ||
} else { | ||
cy.getByDataTest(option.name).should( | ||
'not.have.class', | ||
'disabled' | ||
) | ||
} | ||
}) | ||
}) | ||
} |
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
Oops, something went wrong.