Skip to content

Conversation

@catehstn
Copy link
Contributor

@catehstn catehstn commented Nov 9, 2017

Fixed the getHTMLContent function - now scrolls the toolbar to tap the appropriate button.
Is whether or not the toolbar is expanded by default a device setting? Would probably enable that by default for the demo as it makes this easier.

Added <p> and </p> tags to get tests to pass. If this behaviour changes, these tests will need to be updated. Comments out two tests that need more change (and are maybe surfacing bugs).

Uncommented out the list tests, minor changes to get those working.

Stripping out all whitespace characters between tags as we should not IMO be testing that. Open to feedback here.

To test: Open example app, and run the tests. Confirm that they pass.

appropriate button, and strips out whitespace between HTML tags.
Comments out two tests which are failing for other reasons and should
be looked into separately.
Copy link
Contributor

@rachelmcr rachelmcr left a comment

Choose a reason for hiding this comment

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

I think it's fine to strip the whitespace characters. Those are useful if we want to test the HTML view layout (proper list indentation there, etc) but they aren't really critical.

The changes I've suggested will fix the More Tag tests, at which point everything is passing and looks good to me.


// Expects the format bar to be expanded.
let elementsQuery = app.scrollViews.otherElements
elementsQuery.buttons[elementStringIDs.mediaButton].swipeLeft()
Copy link
Contributor

Choose a reason for hiding this comment

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

This swipe is causing the blockquote issue in the More Tag tests. Because the toolbar is already swiped all the way to the right edge, when the test tries to perform this swipe it ends up tapping on the blockquote button on the left edge of the toolbar instead.

We can remove this line — the test will swipe as needed to get to the toolbar button it's trying to tap on (in this case, sourcecodeButton). I checked and without this line all the tests (including the More Tag tests) pass.

Copy link
Contributor

@brbrr brbrr Nov 10, 2017

Choose a reason for hiding this comment

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

the test will swipe as needed to get to the toolbar button it's trying to tap on

That is strange, but it isn't working like that on iPhone SE but works fine for iPhone 8

}

/*
Commenting these out because they fails: Why is the more tag wrapped in a blockquote?
Copy link
Contributor

Choose a reason for hiding this comment

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

See my note about the getHTMLContent() helper — this is a side effect of the swipe action added there, rather than a bug.

We can update the More Tag tests to the current expected output ("<p><!--more--></p>" and "<p>1</p><p><!--more--></p><p>2</p>", respectively) and with the change to that helper method these tests will pass.

Copy link
Contributor

@diegoreymendez diegoreymendez Nov 9, 2017

Choose a reason for hiding this comment

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

Some important info on this: the wrapping we're doing here (I mean the output we provide given the input) is not great. I was aware of this but failed to track this issue.

I think the outputs should be:

1: <!--more-->
2: <p>1</p><!--more><p>2</p>

I've now opened an issue to track this problem, so I'd consider leaving these disabled (and we'll turn them on when that issue is resolved).

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, here's the issue I created: #818

@rachelmcr
Copy link
Contributor

Fixed the getHTMLContent function - now scrolls the toolbar to tap the appropriate button.

I just reread this note; were you having trouble with this function not working as expected before? XCUITest should always scroll in scrollViews to the element you're trying to tap, without having to explicitly swipe.

Changes helper function to scroll if the button isn't tappable.
@catehstn
Copy link
Contributor Author

@rachelmcr yes - this wasn't working for me.

Also, we need to handle the case where the toolbar isn't expanded. The button is missing an a11y label. IMO though, we should just always expand the toolbar in the example app.

For now, I updated the comment for accuracy, and added a check which only scrolls if the button isn't there. This fixed the blockquote thing, but because the behaviour will change in #818 I left it as-is for now.

@frosty
Copy link
Contributor

frosty commented Nov 13, 2017

Is whether or not the toolbar is expanded by default a device setting? Would probably enable that by default for the demo as it makes this easier.

Yes, we store the expanded status in NSUserDefaults, and the toolbar checks on creation to see if it should display expanded or not – so it'd be easy enough for it to always be expanded. I guess even if we defaulted the demo app to always expanded, we'd ideally want tests to verify that it expands / contracts correctly.

@catehstn
Copy link
Contributor Author

@frosty - will need to figure out a11y for the states then "more toolbar options" / "fewer toolbar options"? But regardless, IMO better to have one test that checks compressing / expanding rather than needing to expand it every test.

Copy link
Contributor

@diegoreymendez diegoreymendez left a comment

Choose a reason for hiding this comment

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

Nice!

@catehstn
Copy link
Contributor Author

@diegoreymendez can you merge this please? <3

@diegoreymendez diegoreymendez merged commit bf04d0a into develop Nov 20, 2017
@diegoreymendez diegoreymendez deleted the fix-ui-tests branch November 20, 2017 20:23
@diegoreymendez
Copy link
Contributor

Awesome contribution @catehstn. Thank you! 👍

@diegoreymendez diegoreymendez changed the title Fix ui tests Fixes UI tests Nov 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants