| import {it} from 'mocha'; |
| import {assertNoConsoleOutput, stubConsoleOutput} from '../support/utils'; |
| |
| const PANE_DATA_MAP = { |
| executor: {name: 'Executor', selector: 'create-executor'}, |
| opt: {name: 'Opt Viewer', selector: 'view-optimization'}, |
| preprocessor: {name: 'Preprocessor', selector: 'view-pp'}, |
| ast: {name: 'Ast Viewer', selector: 'view-ast'}, |
| llvmir: {name: 'LLVM IR', selector: 'view-ir'}, |
| pipeline: {name: 'Pipeline', selector: 'view-llvm-opt-pipeline'}, |
| device: {name: 'Device', selector: 'view-device'}, |
| mir: {name: 'MIR', selector: 'view-rustmir'}, |
| hir: {name: 'HIR', selector: 'view-rusthir'}, |
| macro: {name: 'Macro', selector: 'view-rustmacroexp'}, |
| core: {name: 'Core', selector: 'view-haskellCore'}, |
| stg: {name: 'STG', selector: 'view-haskellStg'}, |
| cmm: {name: 'Cmm', selector: 'view-haskellCmm'}, |
| dump: {name: 'Tree/RTL', selector: 'view-gccdump'}, |
| tree: {name: 'Tree', selector: 'view-gnatdebugtree'}, |
| debug: {name: 'Debug', selector: 'view-gnatdebug'}, |
| cfg: {name: 'Graph', selector: 'view-cfg'}, |
| }; |
| |
| describe('Individual pane testing', () => { |
| beforeEach(() => { |
| cy.visit('/', { |
| onBeforeLoad: win => { |
| stubConsoleOutput(win); |
| win.localStorage.clear(); |
| }, |
| }); |
| cy.get('[data-cy="new-compiler-dropdown-btn"]:visible').click(); |
| // Shows every pane button even if the compiler does not support it |
| cy.get('[data-cy="new-compiler-pane-dropdown"]:visible button').each($btn => { |
| $btn.prop('disabled', false).show(); |
| }); |
| }); |
| |
| afterEach('Ensure no output in console', () => { |
| cy.window().then(win => { |
| assertNoConsoleOutput(); |
| win.localStorage.clear(); |
| }); |
| }); |
| |
| function addPaneOpenTest(paneData) { |
| it(paneData.name + ' pane', () => { |
| cy.get(`[data-cy="new-${paneData.selector}-btn"]:visible`).click(); |
| // Not the most consistent way, but the easiest one! |
| cy.get('span.lm_title:visible').contains(paneData.name); |
| }); |
| } |
| |
| addPaneOpenTest(PANE_DATA_MAP.executor); |
| addPaneOpenTest(PANE_DATA_MAP.opt); |
| addPaneOpenTest(PANE_DATA_MAP.preprocessor); |
| addPaneOpenTest(PANE_DATA_MAP.ast); |
| addPaneOpenTest(PANE_DATA_MAP.llvmir); |
| addPaneOpenTest(PANE_DATA_MAP.pipeline); |
| // TODO: re-enable this when fixed addPaneOpenTest(PANE_DATA_MAP.device); |
| addPaneOpenTest(PANE_DATA_MAP.mir); |
| addPaneOpenTest(PANE_DATA_MAP.hir); |
| addPaneOpenTest(PANE_DATA_MAP.macro); |
| addPaneOpenTest(PANE_DATA_MAP.core); |
| addPaneOpenTest(PANE_DATA_MAP.stg); |
| addPaneOpenTest(PANE_DATA_MAP.cmm); |
| addPaneOpenTest(PANE_DATA_MAP.dump); |
| addPaneOpenTest(PANE_DATA_MAP.tree); |
| addPaneOpenTest(PANE_DATA_MAP.debug); |
| // TODO: Bring back once #3899 lands |
| // addPaneOpenTest(PaneDataMap.cfg); |
| |
| it('Output pane', () => { |
| // Hide the dropdown |
| cy.get('[data-cy="new-compiler-dropdown-btn"]:visible').click(); |
| cy.get(`[data-cy="new-output-pane-btn"]:visible`).click(); |
| cy.get('span.lm_title:visible').contains('Output'); |
| }); |
| |
| it('Conformance view pane', () => { |
| // First, hide the dropdown |
| cy.get('[data-cy="new-compiler-dropdown-btn"]:visible').click(); |
| cy.get('[data-cy="new-editor-dropdown-btn"]:visible').click(); |
| cy.get('[data-cy="new-conformance-btn"]:visible').click(); |
| // TODO: re-enable this when fixed cy.get('span.lm_title:visible').contains('Conformance'); |
| }); |
| }); |
| |
| describe('Known good state test', () => { |
| beforeEach(() => { |
| cy.visit( |
| '/#z:OYLghAFBqd5TB8IAsQGMD2ATApgUWwEsAXTAJwBoiQIAzIgG1wDsBDAW1xAHIBGHpTqYWJAMro2zEHwAsQkSQCqAZ1wAFAB68ADIIBWMyozYtQ6AKQAmAELWblNc3QkiI2q2wBhTIwCuHCw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AA', |
| { |
| onBeforeLoad: win => { |
| stubConsoleOutput(win); |
| win.localStorage.clear(); |
| }, |
| }, |
| ); |
| }); |
| |
| afterEach('Ensure no output in console', () => { |
| cy.window().then(win => { |
| assertNoConsoleOutput(); |
| win.localStorage.clear(); |
| }); |
| }); |
| |
| it('Correctly loads the page for a state with every pane active', () => { |
| for (const paneId in PANE_DATA_MAP) { |
| const pane = PANE_DATA_MAP[paneId]; |
| cy.get('span.lm_title:visible').contains(pane.name); |
| } |
| |
| cy.get('span.lm_title:visible').contains('Output'); |
| cy.get('span.lm_title:visible').contains('Conformance'); |
| }); |
| }); |