-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added package-lock file chore: version bump fix: ci workflow chore: fix workflow chore: fix workflow chore: workflow fix chore: workflow fix chore: workflow test chore: workflow fix chore: fix workflow chore: fix workflow chore: workflow fix chore: fix workflow chore: workflow fix chore: workflow fix chore: fix workflow chore: fix workflow chore: workflow fix chore: workflow fix chore: workflow fix chore: fix workflow chore: fix workflow chore: fix workflow chore: workflow fix chore: workflow fix chore: workflow fix chore: workflow fix chore: workflow fix chore: workflow fix chore: workflow fix chore: workflow fix chore: workflow fix chore: workflow fix chore: workflow fix chore: workflow fix chore: workflow fix chore: workflow fix chore: workflow fix chore: workflow fix chore: workflow fix chore: workflow fix chore: workflow fix chore: workflow fix chore: workflow fix chore: workflow fix chore: workflow fix chore: fix workflow chore: fix workflow chore: fix workflow chore: fix workflow chore: workflow fix chore: workflow fix chore: workflow fix chore: fix workflow chore: fix workflow chore: workflow fix chore: workflow fix chore: fix workflow chore: workflow fix chore: workflow fix fix: broken tests chore: workflow fix chore: workflow fix chore: fix workflow chore: workflow fix chore: fix error checking on click chore: trigger CI on every push fix: added line break at the EOF
- Loading branch information
Showing
12 changed files
with
3,450 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,59 @@ | ||
name: Cypress Tests using Cypress Docker Image | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
cypress-run: | ||
runs-on: ubuntu-latest | ||
container: cypress/browsers:node16.14.0-slim-chrome99-ff97 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: install pip | ||
run: | | ||
apt update -qq | ||
apt install -y python3-pip | ||
pip3 --version | ||
- name: Checkout xblock-sdk repo | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: openedx/xblock-sdk | ||
path: xblock-sdk | ||
|
||
- name: Setup xblock-sdk | ||
working-directory: xblock-sdk | ||
run: | | ||
pwd | ||
pip install -qr requirements/dev.txt | ||
pip install -qr requirements/local.txt | ||
- name: setup h5p xblock | ||
run: | | ||
pip install . | ||
- name: Run xblock workbench | ||
working-directory: xblock-sdk | ||
env: | ||
EXCLUDE_SAMPLE_XBLOCKS: yes | ||
run: | | ||
python3 manage.py migrate --noinput | ||
python3 ./manage.py runserver & | ||
- name: Sleep for 5s to wait for django server getting up and running | ||
uses: juliangruber/sleep-action@v1 | ||
with: | ||
time: 5s | ||
|
||
- name: Cypress run | ||
uses: cypress-io/github-action@v4 | ||
with: | ||
start: python3 ../../xblock-sdk/manage.py runserver | ||
browser: chrome | ||
working-directory: tests/cypress |
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,14 @@ | ||
const { defineConfig } = require("cypress"); | ||
|
||
module.exports = defineConfig({ | ||
projectId: 'h5pxblock_cypress', | ||
e2e: { | ||
setupNodeEvents(on, config) { | ||
// implement node event listeners here | ||
}, | ||
env: { | ||
STUDIO_URL: "http://localhost:8000/scenario/h5pxblock.0/studio_view/", | ||
LMS_URL: "http://localhost:8000/scenario/h5pxblock.0/" | ||
} | ||
}, | ||
}); |
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,27 @@ | ||
/// <reference types="cypress" /> | ||
|
||
// H5P XBlock studio_view tests | ||
|
||
describe('H5P Studio View', () => { | ||
|
||
it('displays h5p xblock in lms view', () => { | ||
|
||
// Save data on studio first | ||
cy.intercept('POST', '/handler/h5pplayerxblock.h5pxblock.d0.u0/studio_submit/*').as('studioSubmit') | ||
cy.studioSubmit() | ||
cy.wait('@studioSubmit') | ||
|
||
// Now access LMS | ||
cy.intercept('GET', '/h5pxblockmedia/h5pplayerxblock.h5pxblock.d0.u0/h5p.json').as('rootJson') | ||
cy.visit(Cypress.env('LMS_URL')) | ||
cy.wait('@rootJson') | ||
|
||
// Make sure H5P content iframe is loaded and relevant buttons are visible | ||
cy.getIframe(".h5p-iframe").find('.h5p-drag-dropzone-container').should('have.length', 3) | ||
cy.getIframe(".h5p-iframe").find('a.h5p-link').should('be.visible') | ||
cy.getIframe(".h5p-iframe").find('.h5p-enable-fullscreen').should('be.visible') | ||
cy.getIframe(".h5p-iframe").find('.h5p-question-check-answer').click({force: true}) | ||
|
||
}) | ||
|
||
}) |
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,84 @@ | ||
/// <reference types="cypress" /> | ||
|
||
// H5P XBlock studio_view tests | ||
|
||
describe('H5P Studio View', () => { | ||
beforeEach(() => { | ||
cy.visit(Cypress.env('STUDIO_URL')) | ||
}) | ||
|
||
it('displays h5p xblock in studio view and verify fist, last and file fields', () => { | ||
|
||
// h5p xblock should display file input field to display content. | ||
cy.get('.settings-list li #xb_h5p_file').should('have.length', 1) | ||
|
||
// First field should be Display name. | ||
cy.get('.settings-list li label').first().should('have.text', 'Display Name') | ||
cy.get('.settings-list li span').first().should('have.text', 'Display name for this module') | ||
|
||
// Last field should be Display name. | ||
cy.get('.settings-list li label').last().should('have.text', 'User content state save frequency') | ||
cy.get('.settings-list li span').last().should('to.contain', 'How often current user content state should be autosaved') | ||
|
||
}) | ||
|
||
it('sets values in studio view fields and saves them', () => { | ||
// Fill all fields and submit | ||
cy.intercept('POST', '/handler/h5pplayerxblock.h5pxblock.d0.u0/studio_submit/*').as('studioSubmit') | ||
cy.studioSubmit() | ||
cy.wait('@studioSubmit') | ||
// Make sure progress bar updated after content is uploaded | ||
cy.get('.progress-bar-container').should('be.visible') | ||
cy.get('.progress-bar-container .progress-bar').should('have.text', 'Uploaded(100%)') | ||
|
||
cy.visit(Cypress.env('STUDIO_URL')) | ||
|
||
cy.fixture('sampledata').then((data) => { | ||
cy.contains('Display Name') | ||
.parent() | ||
.find('input[id=xb_display_name]') | ||
.should('have.value', data.xb_display_name) | ||
|
||
cy.contains('Currently:') | ||
.parent() | ||
.should('to.contain', data.h5p_file_upload) | ||
cy.contains('Reuse Existing H5P Content') | ||
.parent() | ||
.find('input[id=xb_existing_content_path]') | ||
.should('have.value', '/h5pxblockmedia/h5pplayerxblock.h5pxblock.d0.u0') | ||
|
||
cy.contains('Show H5P player frame') | ||
.parent() | ||
.find('select[id=xb_field_edit_show_frame]') | ||
.should('have.value', data.xb_field_edit_show_frame) | ||
|
||
cy.contains('Show copyright button') | ||
.parent() | ||
.find('select[id=xb_field_edit_show_copyright]') | ||
.should('have.value', data.xb_field_edit_show_copyright) | ||
|
||
cy.contains('Show h5p icon') | ||
.parent() | ||
.find('select[id=xb_field_edit_show_h5p]') | ||
.should('have.value', data.xb_field_edit_show_h5p) | ||
|
||
cy.contains('Show fullscreen button') | ||
.parent() | ||
.find('select[id=xb_field_edit_show_fullscreen]') | ||
.should('have.value', data.xb_field_edit_show_fullscreen) | ||
|
||
cy.contains('Is Scorable') | ||
.parent() | ||
.find('select[id=xb_field_edit_is_scorable]') | ||
.should('have.value', data.xb_field_edit_is_scorable) | ||
|
||
cy.contains('User content state save frequency') | ||
.parent() | ||
.find('input[id=xb_field_edit_save_freq]') | ||
.should('have.value', data.xb_field_edit_save_freq) | ||
|
||
}) | ||
|
||
}) | ||
|
||
}) |
Binary file not shown.
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,10 @@ | ||
{ | ||
"xb_display_name": "H5P Test Content for Cypress", | ||
"xb_field_edit_show_frame": "1", | ||
"xb_field_edit_show_copyright": "1", | ||
"xb_field_edit_show_h5p": "1", | ||
"xb_field_edit_show_fullscreen": "1", | ||
"xb_field_edit_is_scorable": "1", | ||
"xb_field_edit_save_freq": "5", | ||
"h5p_file_upload": "drag-the-words-1399.h5p" | ||
} |
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 @@ | ||
Cypress.Commands.add('studioSubmit', () => { | ||
cy.visit(Cypress.env('STUDIO_URL')) | ||
cy.fixture('sampledata').then((data) => { | ||
cy.contains('Display Name') | ||
.parent() | ||
.find('input[id=xb_display_name]') | ||
.clear().type(data.xb_display_name) | ||
|
||
cy.contains('Reuse Existing H5P Content') | ||
.parent() | ||
.find('input[id=xb_existing_content_path]') | ||
.clear() | ||
|
||
cy.contains('Show H5P player frame') | ||
.parent() | ||
.find('select[id=xb_field_edit_show_frame]') | ||
.select(data.xb_field_edit_show_frame) | ||
|
||
cy.contains('Show copyright button') | ||
.parent() | ||
.find('select[id=xb_field_edit_show_copyright]') | ||
.select(data.xb_field_edit_show_copyright) | ||
|
||
cy.contains('Show h5p icon') | ||
.parent() | ||
.find('select[id=xb_field_edit_show_h5p]') | ||
.select(data.xb_field_edit_show_h5p) | ||
|
||
cy.contains('Show fullscreen button') | ||
.parent() | ||
.find('select[id=xb_field_edit_show_fullscreen]') | ||
.select(data.xb_field_edit_show_fullscreen) | ||
|
||
cy.contains('Is Scorable') | ||
.parent() | ||
.find('select[id=xb_field_edit_is_scorable]') | ||
.select(data.xb_field_edit_is_scorable) | ||
|
||
cy.contains('User content state save frequency') | ||
.parent() | ||
.find('input[id=xb_field_edit_save_freq]') | ||
.clear().type(data.xb_field_edit_save_freq) | ||
|
||
cy.get('input[id=xb_h5p_file]').selectFile('cypress/fixtures/' + data.h5p_file_upload) | ||
|
||
}) | ||
cy.get('a.save-button').click() | ||
}) | ||
|
||
Cypress.Commands.add('getIframe', (iframe) => { | ||
return cy.get(iframe).first() | ||
.its('0.contentDocument.body', {timeout: 10000}) | ||
.should('not.be.empty') | ||
.then(cy.wrap); | ||
}) |
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 @@ | ||
// *********************************************************** | ||
// This example support/e2e.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' | ||
|
||
// Alternatively you can use CommonJS syntax: | ||
// require('./commands') |
Oops, something went wrong.