UI Test Application
Nativescript Vue and Angular have a full test application that contains an instance of each supported component. We should add a complete test application for use with e2e tests and to help ensure that new versions of Nativescript or Svelte don't break us.
Is there anything like Enzyme that we can use to test nativescript applications autonomously? Or would we just have a kitchen sink app that will sort of be manually tested to see if anything breaks?
Gday benbot, there is a supported end to end tool for nativescript https://docs.nativescript.org/tooling/testing/end-to-end-testing/getting-started which we should use. I think in theory we can change the app in the demo folder so we can use this tool
I have updated the demo project to a format that can contain a page per widget for e2e testing and updated the code in the project to the latest unit test runner
I'm a fan of React Native's RNTester. They have a list view of each component's page and the properties to test. Would we want something like this? https://github.com/facebook/react-native/tree/master/RNTester
I am up to take on creating the tester app and create the base tests for each component. And iterate off that to test each property.
I think nativescript has a preferred end2end test tool "Appium" https://www.nativescript.org/blog/whats-new-with-nativescript-dev-appium. And I think an app that showcases each of the widgets is ideal for that use case. We have the beginnings of one in the demo folder https://github.com/halfnelson/svelte-native/tree/master/demo/app currently it only contains examples of listView and tabs since these seem to be the most troublesome components atm. It would be great to have that fleshed out and used as the basis of automated tests
Your idea is to have an app that renders all SvelteNative components and lets Appium execute tests on each of the defined components?
In the recent The NativeScript Show -Episode 2 a new testing approach using Detox was briefly introduced. In the next episode the guys wanna show some more in-depth details.
sounds good, I haven't even started on getting appium integrated, so if detox is smoother, that would be sweet.
I got detox to work with svelte-native but there are issues with selectors. Currently you can not get elements by.id or by.label. No matter if I set automatedText, accessibilityLabel or testID it can't find the element. Maybe an issue with how those attributes get passed to Nativescript? Or just an issue with Detox? It does work with by.text and by.type I am open to help with this
@Dariusz-Czepiel could it be related to this https://github.com/NativeScript/NativeScript/issues/9450?
@farfromrefug I applied the fix from there and now it works with by.label and testID attribute on elements! I can post a gist if someone is interested or I can try to update the docs with the info @halfnelson
@Dariusz-Czepiel I'd love to see your gist. I had trouble getting the solution posted by @rigor789 here in angular. I ended up modifying it to look like what was put in the PR to add in testID support (but closed, not merged).
Why not create a similar approach to the one used for testing Angular / Nativescript applications? (https://v7.docs.nativescript.org/angular/tooling/testing/testing)