generated from graasp/graasp-repo
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(tests): cypress tests for builder (#615)
- Loading branch information
Showing
369 changed files
with
7,656 additions
and
8,589 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 |
---|---|---|
@@ -1,24 +1,37 @@ | ||
import setupCoverage from '@cypress/code-coverage/task.js'; | ||
import { defineConfig } from 'cypress'; | ||
|
||
const ENV = { | ||
VITE_GRAASP_REDIRECTION_HOST: process.env.VITE_GRAASP_REDIRECTION_HOST, | ||
VITE_GRAASP_DOMAIN: process.env.VITE_GRAASP_DOMAIN, | ||
VITE_GRAASP_API_HOST: process.env.VITE_GRAASP_API_HOST, | ||
VITE_SHOW_NOTIFICATIONS: false, | ||
VITE_GRAASP_LIBRARY_HOST: process.env.VITE_GRAASP_LIBRARY_HOST, | ||
}; | ||
|
||
export default defineConfig({ | ||
e2e: { | ||
retries: { | ||
openMode: 0, | ||
runMode: 1, | ||
}, | ||
// needed for redirection tests to pass | ||
chromeWebSecurity: false, | ||
env: { | ||
VITE_GRAASP_DOMAIN: process.env.VITE_GRAASP_DOMAIN, | ||
VITE_GRAASP_API_HOST: process.env.VITE_GRAASP_API_HOST, | ||
VITE_SHOW_NOTIFICATIONS: false, | ||
VITE_GRAASP_PLAYER_HOST: process.env.VITE_GRAASP_PLAYER_HOST, | ||
VITE_GRAASP_ANALYZER_HOST: process.env.VITE_GRAASP_ANALYZER_HOST, | ||
VITE_GRAASP_LIBRARY_HOST: process.env.VITE_GRAASP_LIBRARY_HOST, | ||
VITE_GRAASP_ACCOUNT_HOST: process.env.VITE_GRAASP_ACCOUNT_HOST, | ||
}, | ||
env: ENV, | ||
setupNodeEvents(on, config) { | ||
// implement node event listeners here | ||
setupCoverage(on, config); | ||
return config; | ||
}, | ||
baseUrl: `http://localhost:${process.env.VITE_PORT || 3333}`, | ||
baseUrl: `http://localhost:${process.env.VITE_PORT ?? 3333}`, | ||
defaultCommandTimeout: 7000, | ||
requestTimeout: 8000, | ||
}, | ||
component: { | ||
devServer: { | ||
framework: 'react', | ||
bundler: 'vite', | ||
}, | ||
env: ENV, | ||
}, | ||
}); |
4 changes: 2 additions & 2 deletions
4
...mponents/common/DebouncedTextField.cy.tsx → ...mponents/common/DebouncedTextField.cy.tsx
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
7 changes: 3 additions & 4 deletions
7
...ss/components/common/ThumbnailCrop.cy.tsx → ...ss/components/common/ThumbnailCrop.cy.tsx
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,38 @@ | ||
import { PackedFolderItemFactory } from '@graasp/sdk'; | ||
|
||
import { | ||
HEADER_APP_BAR_ID, | ||
ITEM_MAIN_CLASS, | ||
} from '../../../src/config/selectors'; | ||
|
||
describe('Authentication', () => { | ||
describe('Signed Off > Redirect to sign in route', () => { | ||
beforeEach(() => { | ||
cy.setUpApi({ currentMember: null }); | ||
}); | ||
it('Home', () => { | ||
cy.visit('/builder'); | ||
cy.url().should('include', '/auth/login'); | ||
}); | ||
}); | ||
|
||
describe('Signed In', () => { | ||
const ENV = { items: [PackedFolderItemFactory()] }; | ||
|
||
beforeEach(() => { | ||
cy.setUpApi(ENV); | ||
}); | ||
|
||
describe('Load page correctly', () => { | ||
it('Home', () => { | ||
cy.visit('/builder'); | ||
cy.get(`#${HEADER_APP_BAR_ID}`).should('be.visible'); | ||
}); | ||
it('Item', () => { | ||
cy.visit(`/builder/items/${ENV.items[0].id}`); | ||
cy.get(`#${HEADER_APP_BAR_ID}`).should('be.visible'); | ||
cy.get(`.${ITEM_MAIN_CLASS}`).should('be.visible'); | ||
}); | ||
}); | ||
}); | ||
}); |
11 changes: 5 additions & 6 deletions
11
...modules/builder/cypress/e2e/banners.cy.ts → cypress/e2e/builder/banners.cy.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 |
---|---|---|
@@ -1,31 +1,30 @@ | ||
import { | ||
MEMBER_VALIDATION_BANNER_CLOSE_BUTTON_ID, | ||
MEMBER_VALIDATION_BANNER_ID, | ||
} from '@/config/selectors'; | ||
|
||
} from '../../../src/config/selectors'; | ||
import { | ||
LEGACY_NOT_VALIDATED_MEMBER, | ||
NOT_VALIDATED_MEMBER, | ||
VALIDATED_MEMBER, | ||
} from '../fixtures/members'; | ||
} from '../../fixtures/members'; | ||
|
||
describe('Member validation banner', () => { | ||
it('Shows banner when member is not validated', () => { | ||
cy.setUpApi({ currentMember: NOT_VALIDATED_MEMBER }); | ||
cy.visit('/'); | ||
cy.visit('/builder'); | ||
cy.get(`#${MEMBER_VALIDATION_BANNER_ID}`).should('be.visible'); | ||
cy.get(`#${MEMBER_VALIDATION_BANNER_CLOSE_BUTTON_ID}`).click(); | ||
}); | ||
|
||
it('Does not show banner when member is validated', () => { | ||
cy.setUpApi({ currentMember: VALIDATED_MEMBER }); | ||
cy.visit('/'); | ||
cy.visit('/builder'); | ||
cy.get(`#${MEMBER_VALIDATION_BANNER_ID}`).should('not.exist'); | ||
}); | ||
|
||
it('Does not show banner when member is legacy', () => { | ||
cy.setUpApi({ currentMember: LEGACY_NOT_VALIDATED_MEMBER }); | ||
cy.visit('/'); | ||
cy.visit('/builder'); | ||
cy.get(`#${MEMBER_VALIDATION_BANNER_ID}`).should('not.exist'); | ||
}); | ||
}); |
Oops, something went wrong.