Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract duplicate e2e test setup to jest config #2846

Merged
merged 14 commits into from Dec 16, 2020
3 changes: 3 additions & 0 deletions __device-tests__/.eslintrc.js
@@ -0,0 +1,3 @@
module.exports = {
extends: '../gutenberg/packages/react-native-editor/__device-tests__/.eslintrc.js',
};
36 changes: 0 additions & 36 deletions __device-tests__/gutenberg-editor-contact-info.test.js
@@ -1,48 +1,12 @@
/**
* Internal dependencies
*/
import EditorPage from '../gutenberg/packages/react-native-editor/__device-tests__/pages/editor-page';
import {
setupDriver,
isLocalEnvironment,
stopDriver,
} from '../gutenberg/packages/react-native-editor/__device-tests__/helpers/utils';

jest.setTimeout( 1000000 );

describe( 'Gutenberg Editor Contact Info Block tests', () => {
let driver;
let editorPage;
let allPassed = true;
// const contactInfoBlockName = 'Contact Info';

// Use reporter for setting status for saucelabs Job
if ( ! isLocalEnvironment() ) {
const reporter = {
specDone: async ( result ) => {
allPassed = allPassed && result.status !== 'failed';
},
};

// eslint-disable-next-line jest/no-jasmine-globals
jasmine.getEnv().addReporter( reporter );
}

beforeAll( async () => {
driver = await setupDriver();
editorPage = new EditorPage( driver );
} );

it( 'should be able to see visual editor', async () => {
await expect( editorPage.getBlockList() ).resolves.toBe( true );
} );

//TODO: Add tests

afterAll( async () => {
if ( ! isLocalEnvironment() ) {
driver.sauceJobStatus( allPassed );
}
await stopDriver( driver );
} );
} );
2 changes: 1 addition & 1 deletion gutenberg
Submodule gutenberg updated 426 files
14 changes: 6 additions & 8 deletions jest_ui.config.js
@@ -1,12 +1,10 @@
const main = require( './jest.config.js' );
const gutenbergJestUIConfig = require( './gutenberg/packages/react-native-editor/jest_ui.config.js' );

module.exports = {
...main,
timers: 'real',
setupFiles: [],
testMatch: [
'<rootDir>/__device-tests__/**/*.test.[jt]s?(x)',
'<rootDir>/gutenberg/packages/react-native-editor/__device-tests__/**/*.test.[jt]s?(x)',
...gutenbergJestUIConfig,
setupFilesAfterEnv: [
'./gutenberg/packages/react-native-editor/jest_ui_setup_after_env.js',
],
testPathIgnorePatterns: [ '/node_modules/', '<rootDir>/jetpack/' ],
testEnvironment:
'./gutenberg/packages/react-native-editor/jest_ui_test_environment.js',
};