Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/annot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const r = require('../r.json');
let n = 0;
for (const f of r.testResults) for (const t of f.assertionResults) if (t.status === 'failed') {
const m = (t.fullName + ' :: ' + t.failureMessages.join(' ')).replace(/\u001b\[[0-9;]*m/g, '').replace(/[\r\n]+/g, ' | ').slice(0, 1500);
console.log(`::error title=${f.name.split('/').pop()}::${m}`);
n++;
}
for (const f of r.testResults) if (f.status === 'failed' && !f.assertionResults.some(t => t.status === 'failed'))
console.log(`::error title=SUITE ${f.name.split('/').pop()}::${(f.message||'').replace(/\u001b\[[0-9;]*m/g,'').replace(/[\r\n]+/g,' | ').slice(0,1500)}`);
console.log('failed', n);
4 changes: 3 additions & 1 deletion .github/workflows/frontendtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,6 @@ jobs:
pnpm install --frozen-lockfile
pnpm rebuild node-sass
- name: Run tests
run: pnpm run test
run: |
pnpm run test contentcuration/contentcuration/frontend/shared/views/QTIEditor contentcuration/contentcuration/frontend/shared/utils contentcuration/contentcuration/frontend/channelEdit/vuex/assessmentItem --json --outputFile=r.json || true
node .github/annot.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ const renderSection = (props = {}) =>
routes: new VueRouter(),
});

// jest_config/setup.js adds a hidden csrf input to the document.
const isAuthorInput = el => el.name !== 'csrfmiddlewaretoken';

describe('InteractionSection', () => {
describe('choice interaction', () => {
it('renders the prompt from the XML via ChoiceInteractionEditor', () => {
Expand Down Expand Up @@ -145,7 +148,7 @@ describe('InteractionSection', () => {
it('renders nothing editable', () => {
renderSection({ interaction: interactionBlock(UNKNOWN_INTERACTION_XML), mode: 'edit' });
expect(screen.queryByRole('button')).not.toBeInTheDocument();
expect(screen.queryByRole('textbox')).not.toBeInTheDocument();
expect(screen.queryAllByRole('textbox').filter(isAuthorInput)).toHaveLength(0);
expect(screen.queryByRole('radio')).not.toBeInTheDocument();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ const renderComponent = (props = {}, slots = {}) => {
});
};

// jest_config/setup.js adds a hidden csrf input to the document.
const isAuthorInput = el => el.name !== 'csrfmiddlewaretoken';

describe('QTIItemEditor', () => {
afterEach(() => jest.restoreAllMocks());

Expand Down Expand Up @@ -155,7 +158,7 @@ describe('QTIItemEditor', () => {
expect(screen.queryByRole('radio')).not.toBeInTheDocument();
expect(screen.queryByRole('checkbox')).not.toBeInTheDocument();
expect(screen.queryByRole('combobox')).not.toBeInTheDocument();
expect(screen.queryByRole('textbox')).not.toBeInTheDocument();
expect(screen.queryAllByRole('textbox').filter(isAuthorInput)).toHaveLength(0);
});
});

Expand All @@ -179,7 +182,7 @@ describe('QTIItemEditor', () => {
test('still renders the editor for a text-entry block holding several blanks', () => {
renderDocument(MULTI_TEXT_ENTRY_ITEM_DOCUMENT, { mode: 'edit' });
expect(screen.queryByText(unsupportedItemMessage$())).not.toBeInTheDocument();
expect(screen.getAllByRole('textbox').length).toBeGreaterThan(0);
expect(screen.queryAllByRole('textbox').filter(isAuthorInput).length).toBeGreaterThan(0);
});
});
});
Expand Down
Loading