Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
73bc4c9
Try travis config for RN e2e tests
Tug May 1, 2020
549f949
fix
Tug May 5, 2020
6bd718c
Create bundle folder for iOS before bundling for e2e
ceyhun May 5, 2020
c3e8ea1
Trigger CI
ceyhun May 5, 2020
e8b3c1e
Fix wrong simulator pick on Travis for e2e tests
ceyhun May 5, 2020
9d10c53
Change iOS simulator version used for e2e test to 13.3
ceyhun May 5, 2020
94a1e41
Try GitHub actions
ceyhun May 12, 2020
da06141
Increase timeout
ceyhun May 12, 2020
ffa949c
Decrease recording resolution
ceyhun May 12, 2020
905fdf5
Add names to react native action workflows
ceyhun May 13, 2020
a092f92
Rename react native action workflows
ceyhun May 13, 2020
7fb121e
Prevent accidental touches to home button on iOS while scrolling
ceyhun May 13, 2020
e6a3536
Merge branch 'feat/import-gutenberg-mobile-no-squash' into try/github…
ceyhun May 13, 2020
08c90a9
Add gradle cache
ceyhun May 13, 2020
eef9ede
Run only subset of tests and in parallel
ceyhun May 14, 2020
f130da3
Merge remote-tracking branch 'origin/feat/import-gutenberg-mobile-no-…
Tug May 14, 2020
1313dd0
Revert any changes to package-lock.json
Tug May 14, 2020
160e9a4
Use v1 for actions/cache
ceyhun May 14, 2020
392d479
Update native e2e tests from gutenberg-mobile/develop
ceyhun May 14, 2020
d4c8b64
bundle js before running ios e2e tests
Tug May 14, 2020
a796690
Exclude e2e tests generated files from git
Tug May 14, 2020
6c417eb
Move js bundle to test:e2e:ios:local instead
Tug May 14, 2020
c67d974
set implicit wait timeout on driver setup instead of EditorPage const…
Tug May 14, 2020
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
45 changes: 45 additions & 0 deletions .github/workflows/rnmobile-android-runner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: React Native E2E Tests (Android)
on: push

jobs:
test:
runs-on: macos-latest
strategy:
matrix:
native-test-name: [
gutenberg-editor-heading,
gutenberg-editor-image,
]

steps:
- name: checkout
uses: actions/checkout@v2

- name: Restore npm cache
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-

- run: npm ci

- name: Restore Gradle cache
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle

- uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 28
profile: pixel_xl
script: npm run native test:e2e:android:local ${{ matrix.native-test-name }}

- uses: actions/upload-artifact@v2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain a bit how this works? Where are the artifacts stored? For how long? How can one access it when looking at a PR?
This could be a nice addition to the mobile doc, otherwise just a comment on this PR so people can find this information using git blame :)

Copy link
Contributor

@Tug Tug May 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, found them here at the top right of the check screen
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case it's useful, there is some more information here about GitHub actions artifacts: https://help.github.com/en/actions/configuring-and-managing-workflows/persisting-workflow-data-using-artifacts.

@ceyhun 👋 😄 nice work on this! I ❤️ seeing these workflows integrated with GitHub!

if: always()
with:
name: android-screen-recordings
path: packages/react-native-editor/android-screen-recordings
71 changes: 71 additions & 0 deletions .github/workflows/rnmobile-ios-runner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: React Native E2E Tests (iOS)
on: push

jobs:
test:
runs-on: macos-latest
strategy:
matrix:
native-test-name: [
gutenberg-editor-heading,
gutenberg-editor-image,
]

steps:
- uses: actions/checkout@v2

- name: Restore npm cache
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-

- name: Install dependencies
run: |
source ~/.nvm/nvm.sh
nvm install
npm ci

- name: Prepare build cache key
run: find package-lock.json packages/react-native-editor/ios packages/react-native-aztec/ios packages/react-native-bridge/ios -type f -print0 | sort -z | xargs -0 shasum | tee ios-checksums.txt

- name: Restore build cache
uses: actions/cache@v1
with:
path: packages/react-native-editor/ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app
key: ${{ runner.os }}-ios-build-${{ hashFiles('ios-checksums.txt') }}

- name: Restore pods cache
uses: actions/cache@v1
with:
path: |
packages/react-native-editor/ios/Pods
~/Library/Caches/CocoaPods
~/.cocoapods/repos/trunk
packages/react-native-editor/ios/vendor
key: ${{ runner.os }}-pods-${{ hashFiles('packages/react-native-editor/ios/Gemfile.lock') }}-${{ hashFiles('packages/react-native-editor/ios/Podfile.lock') }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-pods-${{ hashFiles('packages/react-native-editor/ios/Gemfile.lock') }}-${{ hashFiles('packages/react-native-editor/ios/Podfile.lock') }}-${{ hashFiles('package-lock.json') }}
${{ runner.os }}-pods-${{ hashFiles('packages/react-native-editor/ios/Gemfile.lock') }}-${{ hashFiles('packages/react-native-editor/ios/Podfile.lock') }}-
${{ runner.os }}-pods-${{ hashFiles('packages/react-native-editor/ios/Gemfile.lock') }}-
${{ runner.os }}-pods-

- name: Bundle iOS
run: npm run native test:e2e:bundle:ios

- name: Build (if needed)
run: test -e packages/react-native-editor/ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app/GutenbergDemo || SKIP_BUNDLING=true npm run native test:e2e:build-app:ios

- name: Run iOS Device Tests
run: TEST_RN_PLATFORM=ios npm run native device-tests:local ${{ matrix.native-test-name }}

- name: Prepare build cache
run: rm packages/react-native-editor/ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app/main.jsbundle

- uses: actions/upload-artifact@v2
if: always()
with:
name: ios-screen-recordings
path: packages/react-native-editor/ios-screen-recordings
3 changes: 3 additions & 0 deletions packages/react-native-editor/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ bundle/
*.ap_
.gradle/
android/app/src/main/assets/
android/app/src/main/res/raw/

# iOS builds
*.app.zip
Expand Down Expand Up @@ -105,6 +106,8 @@ buck-out/

# e2e output log
appium-out.log
ios-screen-recordings/
android-screen-recordings/

bin/wp-cli.phar

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ import {
} from './helpers/utils';
import testData from './helpers/test-data';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;
jest.setTimeout( 1000000 );

describe( 'Gutenberg Editor tests for Block insertion', () => {
let driver;
let editorPage;
let allPassed = true;
const paragraphBlockName = 'Paragraph';

// Use reporter for setting status for saucelabs Job
if ( ! isLocalEnvironment() ) {
Expand All @@ -41,33 +42,31 @@ describe( 'Gutenberg Editor tests for Block insertion', () => {
} );

it( 'should be able to insert block into post', async () => {
await editorPage.addNewParagraphBlock();
let paragraphBlockElement = await editorPage.getParagraphBlockAtPosition(
1
await editorPage.addNewBlock( paragraphBlockName );
let paragraphBlockElement = await editorPage.getBlockAtPosition(
paragraphBlockName
);
if ( isAndroid() ) {
await paragraphBlockElement.click();
}
await editorPage.sendTextToParagraphBlockAtPosition(
1,
testData.longText
);

await editorPage.sendTextToParagraphBlock( 1, testData.longText );
// Should have 3 paragraph blocks at this point

paragraphBlockElement = await editorPage.getParagraphBlockAtPosition(
paragraphBlockElement = await editorPage.getBlockAtPosition(
paragraphBlockName,
2
);
await paragraphBlockElement.click();

await editorPage.addNewParagraphBlock();
paragraphBlockElement = await editorPage.getParagraphBlockAtPosition(
await editorPage.addNewBlock( paragraphBlockName );

paragraphBlockElement = await editorPage.getBlockAtPosition(
paragraphBlockName,
3
);
await paragraphBlockElement.click();
await editorPage.sendTextToParagraphBlockAtPosition(
3,
testData.mediumText
);
await editorPage.sendTextToParagraphBlock( 3, testData.mediumText );

await editorPage.verifyHtmlContent( testData.blockInsertionHtml );

Expand All @@ -76,47 +75,52 @@ describe( 'Gutenberg Editor tests for Block insertion', () => {

// Workaround for now since deleting the first element causes a crash on CI for Android
if ( isAndroid() ) {
paragraphBlockElement = await editorPage.getParagraphBlockAtPosition(
paragraphBlockElement = await editorPage.getBlockAtPosition(
paragraphBlockName,
3,
{ autoscroll: true }
{
autoscroll: true,
}
);

await paragraphBlockElement.click();
await editorPage.removeParagraphBlockAtPosition( 3 );
await editorPage.removeBlockAtPosition( paragraphBlockName, 3 );
for ( let i = 3; i > 0; i-- ) {
// wait for accessibility ids to update
await driver.sleep( 1000 );
paragraphBlockElement = await editorPage.getParagraphBlockAtPosition(
paragraphBlockElement = await editorPage.getBlockAtPosition(
paragraphBlockName,
i,
{ autoscroll: true }
{
autoscroll: true,
}
);
await paragraphBlockElement.click();
await editorPage.removeParagraphBlockAtPosition( i );
await editorPage.removeBlockAtPosition( paragraphBlockName, i );
}
} else {
for ( let i = 4; i > 0; i-- ) {
// wait for accessibility ids to update
await driver.sleep( 1000 );
paragraphBlockElement = await editorPage.getParagraphBlockAtPosition(
1
paragraphBlockElement = await editorPage.getBlockAtPosition(
paragraphBlockName
);
await clickMiddleOfElement( driver, paragraphBlockElement );
await editorPage.removeParagraphBlockAtPosition( 1 );
await editorPage.removeBlockAtPosition( paragraphBlockName );
}
}
} );

it( 'should be able to insert block at the beginning of post from the title', async () => {
await editorPage.addNewParagraphBlock();
let paragraphBlockElement = await editorPage.getParagraphBlockAtPosition(
1
await editorPage.addNewBlock( paragraphBlockName );
let paragraphBlockElement = await editorPage.getBlockAtPosition(
paragraphBlockName
);
if ( isAndroid() ) {
await paragraphBlockElement.click();
}
await editorPage.sendTextToParagraphBlockAtPosition(
1,
testData.longText
);

await editorPage.sendTextToParagraphBlock( 1, testData.longText );
// Should have 3 paragraph blocks at this point

if ( isAndroid() ) {
Expand All @@ -130,15 +134,12 @@ describe( 'Gutenberg Editor tests for Block insertion', () => {
await titleElement.click();
await titleElement.click();

await editorPage.addNewParagraphBlock();
paragraphBlockElement = await editorPage.getParagraphBlockAtPosition(
1
await editorPage.addNewBlock( paragraphBlockName );
paragraphBlockElement = await editorPage.getBlockAtPosition(
paragraphBlockName
);
await clickMiddleOfElement( driver, paragraphBlockElement );
await editorPage.sendTextToParagraphBlockAtPosition(
1,
testData.mediumText
);
await editorPage.sendTextToParagraphBlock( 1, testData.mediumText );
await paragraphBlockElement.click();
await editorPage.verifyHtmlContent(
testData.blockInsertionHtmlFromTitle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
import EditorPage from './pages/editor-page';
import { setupDriver, isLocalEnvironment, stopDriver } from './helpers/utils';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;
jest.setTimeout( 1000000 );

describe( 'Gutenberg Editor Gallery Block tests', () => {
let driver;
let editorPage;
let allPassed = true;
const galleryBlockName = 'Gallery';

// Use reporter for setting status for saucelabs Job
if ( ! isLocalEnvironment() ) {
Expand All @@ -32,11 +33,13 @@ describe( 'Gutenberg Editor Gallery Block tests', () => {
} );

it( 'should be able to add a gallery block', async () => {
await editorPage.addNewGalleryBlock();
const galleryBlock = await editorPage.getGalleryBlockAtPosition( 1 );
await editorPage.addNewBlock( galleryBlockName );
const galleryBlock = await editorPage.getBlockAtPosition(
galleryBlockName
);

expect( galleryBlock ).toBeTruthy();
await editorPage.removeGalleryBlockAtPosition( 1 );
await editorPage.removeBlockAtPosition( galleryBlockName );
} );

afterAll( async () => {
Expand Down
Loading