From 15b79c1bb1e27cd152e7458b27bfd860825faca7 Mon Sep 17 00:00:00 2001 From: ashuntu Date: Mon, 9 Dec 2024 19:04:06 -0600 Subject: [PATCH] Fix Landscape tests --- .../landscape/landscape_data_model_test.dart | 153 +++++---- .../pages/landscape/landscape_model_test.dart | 66 +--- .../pages/landscape/landscape_page_test.dart | 299 ++++++++---------- 3 files changed, 228 insertions(+), 290 deletions(-) diff --git a/gui/packages/ubuntupro/test/pages/landscape/landscape_data_model_test.dart b/gui/packages/ubuntupro/test/pages/landscape/landscape_data_model_test.dart index 9d2313024..c8f2903b5 100644 --- a/gui/packages/ubuntupro/test/pages/landscape/landscape_data_model_test.dart +++ b/gui/packages/ubuntupro/test/pages/landscape/landscape_data_model_test.dart @@ -4,119 +4,114 @@ import 'package:ini/ini.dart'; import 'package:ubuntupro/pages/landscape/landscape_model.dart'; void main() { - group('saas data model', () { + group('manual data model', () { final testcases = { 'success': ( - account: 'test', - wantError: isFalse, + fqdn: saasURL, + certPath: '', + registrationKey: '', + wantFQDNError: isFalse, + wantFileError: FileError.none, wantComplete: isTrue, wantConfig: contains('landscape.canonical.com') ), - 'with empty account': ( - account: '', - wantError: isFalse, - wantComplete: isFalse, - wantConfig: isNull + 'success with registration key': ( + fqdn: saasURL, + certPath: '', + registrationKey: 'abc', + wantFQDNError: isFalse, + wantFileError: FileError.none, + wantComplete: isTrue, + wantConfig: contains('landscape.canonical.com') ), - 'with account standalone': ( - account: 'standalone', - wantError: isTrue, - wantComplete: isFalse, - wantConfig: isNull + 'success with valid cert': ( + fqdn: saasURL, + certPath: validCert, + registrationKey: '', + wantFQDNError: isFalse, + wantFileError: FileError.none, + wantComplete: isTrue, + wantConfig: contains('landscape.canonical.com') ), - }; - for (final MapEntry(key: name, value: tc) in testcases.entries) { - test(name, () { - final c = LandscapeManualConfig(); - c.accountName = tc.account; - expect(c.accountNameError, tc.wantError); - expect(c.isComplete, tc.wantComplete); - final raw = c.config(); - expect(raw, tc.wantConfig); - if (raw != null) { - expectINI(raw); - } - }); - } - }); - group('self-hosted data model', () { - const testUrl = 'test.landscape.company.com'; - final testcases = { - 'success': ( - url: testUrl, - certPath: '', - wantFqdnError: isFalse, + 'success with valid cert and key': ( + fqdn: saasURL, + certPath: validCert, + registrationKey: 'abc', + wantFQDNError: isFalse, wantFileError: FileError.none, wantComplete: isTrue, - wantConfig: contains(testUrl) + wantConfig: contains('landscape.canonical.com') ), - 'with SaaS URL': ( - url: saasURL, - certPath: '', - wantFqdnError: isTrue, + 'success changing cert into empty path': ( + fqdn: saasURL, + certPath: '-', + registrationKey: 'abc', + wantFQDNError: isFalse, wantFileError: FileError.none, - wantComplete: isFalse, - wantConfig: isNull + wantComplete: isTrue, + wantConfig: contains('landscape.canonical.com') ), - 'with SaaS hostname': ( - url: Uri.parse(saasURL).host, - certPath: '', - wantFqdnError: isTrue, + 'error with invalid fqdn': ( + fqdn: '::', + certPath: validCert, + registrationKey: 'abc', + wantFQDNError: isTrue, wantFileError: FileError.none, wantComplete: isFalse, wantConfig: isNull ), - 'with ssl key path as dir': ( - url: testUrl, - // the directory that contains the test sources. - certPath: './test', - wantFqdnError: isFalse, - wantFileError: FileError.dir, + 'error with not found cert': ( + fqdn: saasURL, + certPath: notFoundPath, + registrationKey: 'abc', + wantFQDNError: isFalse, + wantFileError: FileError.notFound, wantComplete: isFalse, wantConfig: isNull ), - 'with ssl key changing into empty path': ( - url: testUrl, - // Magic value to make the test case apply a good path first, then an empty path. - certPath: '-', - wantFqdnError: isFalse, - // SSL key path is an optional entry. - wantFileError: FileError.none, - wantComplete: isTrue, - wantConfig: contains(testUrl), + 'error with invalid cert': ( + fqdn: saasURL, + certPath: invalidCert, + registrationKey: 'abc', + wantFQDNError: isFalse, + wantFileError: FileError.invalidFormat, + wantComplete: isFalse, + wantConfig: isNull ), - 'with ssl key file empty': ( - url: testUrl, - certPath: './test/testdata/landscape/empty.txt', - wantFqdnError: isFalse, - wantFileError: FileError.emptyFile, + 'error with cert path as a dir': ( + fqdn: saasURL, + certPath: './test', + registrationKey: 'abc', + wantFQDNError: isFalse, + wantFileError: FileError.dir, wantComplete: isFalse, wantConfig: isNull ), - 'with ssl key not found': ( - url: testUrl, - certPath: notFoundPath, - wantFqdnError: isFalse, - wantFileError: FileError.notFound, + 'error with empty cert': ( + fqdn: saasURL, + certPath: emptyFile, + registrationKey: 'abc', + wantFQDNError: isFalse, + wantFileError: FileError.emptyFile, wantComplete: isFalse, wantConfig: isNull ), }; for (final MapEntry(key: name, value: tc) in testcases.entries) { test(name, () { - final c = LandscapeSelfHostedConfig(); - c.fqdn = tc.url; + final c = LandscapeManualConfig(); + c.fqdn = tc.fqdn; + c.registrationKey = tc.registrationKey; - // Dart records can't be modified, so we need a proxy variable. var path = tc.certPath; if (tc.certPath == '-') { // Apply a good path first. - c.sslKeyPath = customConf; + c.sslKeyPath = validCert; path = ''; } c.sslKeyPath = path; - expect(c.fqdnError, tc.wantFqdnError); + expect(c.fqdnError, tc.wantFQDNError); expect(c.fileError, tc.wantFileError); expect(c.isComplete, tc.wantComplete); final raw = c.config(); @@ -127,6 +122,7 @@ void main() { }); } }); + group('custom data model', () { final testcases = { 'success': ( @@ -148,7 +144,7 @@ void main() { wantConfig: isNull ), 'with empty config file': ( - path: './test/testdata/landscape/empty.txt', + path: emptyFile, wantFileError: FileError.emptyFile, wantComplete: isFalse, wantConfig: isNull @@ -208,3 +204,6 @@ void expectUrlSchemes(Config config) { const saasURL = 'https://landscape.canonical.com'; const customConf = './test/testdata/landscape/custom.conf'; const notFoundPath = './test/testdata/landscape/notfound.txt'; +const validCert = './test/testdata/certs/client_cert.pem'; +const invalidCert = './test/testdata/certs/not_a_cert.pem'; +const emptyFile = './test/testdata/landscape/empty.txt'; diff --git a/gui/packages/ubuntupro/test/pages/landscape/landscape_model_test.dart b/gui/packages/ubuntupro/test/pages/landscape/landscape_model_test.dart index 87598db68..1c38070fe 100644 --- a/gui/packages/ubuntupro/test/pages/landscape/landscape_model_test.dart +++ b/gui/packages/ubuntupro/test/pages/landscape/landscape_model_test.dart @@ -14,7 +14,7 @@ void main() { final client = MockAgentApiClient(); test('active', () { final model = LandscapeModel(client); - expect(model.configType, LandscapeConfigType.selfHosted); + expect(model.configType, LandscapeConfigType.manual); for (final type in LandscapeConfigType.values) { model.setConfigType(type); @@ -43,60 +43,35 @@ void main() { expect(notified, isTrue); notified = false; - model.setAccountName('testuser'); - expect(notified, isTrue); - notified = false; - model.setManualRegistrationKey('123'); expect(notified, isTrue); notified = false; - model.setConfigType(LandscapeConfigType.selfHosted); - expect(notified, isTrue); - notified = false; - - model.setFqdn(testFqdn); + model.setFqdn('https://example.com'); expect(notified, isTrue); notified = false; - model.setSelfHostedRegistrationKey('123'); - expect(notified, isTrue); - notified = false; - - model.setSslKeyPath(customConf); + model.setSslKeyPath('/some/path'); expect(notified, isTrue); notified = false; }); test('assertions', () { // Verifies that methods throw assertions when called under non-relevant scenarios. + // Those assertions exist because the methods are not relevant for the current config type. + // Allowing those conditions to proceed could contribute to hide logic errors. final model = LandscapeModel(client); model.setConfigType(LandscapeConfigType.manual); - // Those assertions exist because the methods are not relevant for the current config type. - // Allowing those conditions to proceed could contribute to hide logic errors. - expect(() => model.setCustomConfigPath(customConf), throwsAssertionError); - expect(() => model.setFqdn(testFqdn), throwsAssertionError); - expect(() => model.setSslKeyPath(customConf), throwsAssertionError); - expect( - () => model.setSelfHostedRegistrationKey('123'), - throwsAssertionError, - ); - expect(() => model.setCustomConfigPath(customConf), throwsAssertionError); - - model.setConfigType(LandscapeConfigType.selfHosted); - expect(() => model.setAccountName('testuser'), throwsAssertionError); - expect(() => model.setManualRegistrationKey('123'), throwsAssertionError); expect(() => model.setCustomConfigPath(customConf), throwsAssertionError); model.setConfigType(LandscapeConfigType.custom); expect(() => model.setSslKeyPath(customConf), throwsAssertionError); - expect(() => model.setAccountName('testuser'), throwsAssertionError); expect(() => model.setManualRegistrationKey('123'), throwsAssertionError); expect(() => model.setFqdn(testFqdn), throwsAssertionError); expect( - () => model.setSelfHostedRegistrationKey('123'), + () => model.setManualRegistrationKey('123'), throwsAssertionError, ); expect(() => model.setSslKeyPath(customConf), throwsAssertionError); @@ -106,7 +81,7 @@ void main() { group('apply config', () { const msg = 'test message'; const error = GrpcError.custom(StatusCode.unavailable, msg); - test('saas', () async { + test('manual', () async { final client = MockAgentApiClient(); when(client.applyLandscapeConfig(any)).thenAnswer( (_) async => throw error, @@ -116,7 +91,7 @@ void main() { model.setConfigType(LandscapeConfigType.manual); expect(model.applyConfig, throwsAssertionError); - model.setAccountName('testaccount'); + model.setFqdn('landscape.canonical.com'); var err = await model.applyConfig(); expect(err, msg); @@ -124,36 +99,19 @@ void main() { (_) async => LandscapeSource()..ensureUser(), ); - model.setAccountName('testaccount'); + model.setFqdn('landscape.canonical.com'); err = await model.applyConfig(); expect(err, isNull); - }); - test('self-hosted', () async { - final client = MockAgentApiClient(); - when(client.applyLandscapeConfig(any)).thenAnswer( - (_) async => throw error, - ); - final model = LandscapeModel(client); - - model.setConfigType(LandscapeConfigType.selfHosted); - expect(model.applyConfig, throwsAssertionError); - model.setFqdn(testFqdn); - var err = await model.applyConfig(); - expect(err, msg); - - when(client.applyLandscapeConfig(any)).thenAnswer( - (_) async => LandscapeSource()..ensureUser(), - ); - - model.setFqdn(testFqdn); + model.setSslKeyPath(caCert); err = await model.applyConfig(); expect(err, isNull); - model.setSslKeyPath(caCert); + model.setManualRegistrationKey('abc'); err = await model.applyConfig(); expect(err, isNull); }); + test('custom', () async { final client = MockAgentApiClient(); when(client.applyLandscapeConfig(any)).thenAnswer( diff --git a/gui/packages/ubuntupro/test/pages/landscape/landscape_page_test.dart b/gui/packages/ubuntupro/test/pages/landscape/landscape_page_test.dart index 60c3cb209..c0e65cf0a 100644 --- a/gui/packages/ubuntupro/test/pages/landscape/landscape_page_test.dart +++ b/gui/packages/ubuntupro/test/pages/landscape/landscape_page_test.dart @@ -53,12 +53,12 @@ void main() { final app = buildApp(model); await tester.pumpWidget(app); - final context = tester.element(find.byType(LandingPage)); + final context = tester.element(find.byType(ColumnPage)); final lang = AppLocalizations.of(context); - final continueButton = find.button(lang.buttonNext); + final continueButton = find.button(lang.landscapeRegister); expect(continueButton, findsOne); - expect(tester.widget(continueButton).enabled, isFalse); + expect(tester.widget(continueButton).enabled, isFalse); for (final type in LandscapeConfigType.values) { final radio = find.byWidgetPredicate( @@ -67,7 +67,7 @@ void main() { expect(radio, findsOne); expect( tester.widget(radio).groupValue == - LandscapeConfigType.selfHosted, + LandscapeConfigType.manual, isTrue, ); } @@ -76,21 +76,21 @@ void main() { testWidgets('continue enabled', (tester) async { final model = LandscapeModel(MockAgentApiClient()); model.setConfigType(LandscapeConfigType.manual); - model.setAccountName('testaccount'); + model.setFqdn('landscape.canonical.com'); final app = buildApp(model); await tester.pumpWidget(app); - final context = tester.element(find.byType(LandingPage)); + final context = tester.element(find.byType(ColumnPage)); final lang = AppLocalizations.of(context); - final continueButton = find.button(lang.buttonNext); + final continueButton = find.button(lang.landscapeRegister); expect(continueButton, findsOne); - expect(tester.widget(continueButton).enabled, isTrue); + expect(tester.widget(continueButton).enabled, isTrue); }); }); group('calls back on success', () { - testWidgets('saas', (tester) async { + testWidgets('manual', (tester) async { final agent = MockAgentApiClient(); final model = LandscapeModel(agent); @@ -102,90 +102,86 @@ void main() { final app = buildApp(model); await tester.pumpWidget(app); - final context = tester.element(find.byType(LandingPage)); + final context = tester.element(find.byType(ColumnPage)); final lang = AppLocalizations.of(context); - final saasRadio = find.ancestor( - of: find.text(lang.landscapeQuickSetupSaas), - matching: find.byType(YaruSelectableContainer), - ); - await tester.tap(saasRadio); + await tester.tap(find.text(lang.landscapeSetupManual)); await tester.pump(); - final accountInput = find.ancestor( - of: find.text(lang.landscapeAccountNameLabel), - matching: find.byType(TextField), - ); - final continueButton = find.button(lang.buttonNext); - - // expect false since account name cannot be 'standalone' for the saas subform. - await tester.enterText(accountInput, standalone); - await tester.pump(); - await tester.tap(continueButton); - expect(applied, isFalse); - - await tester.enterText(accountInput, 'testaccount'); - await tester.pump(); - await tester.tap(continueButton); - await tester.pump(); - expect(applied, isTrue); - }); - testWidgets('self-hosted', (tester) async { - final agent = MockAgentApiClient(); - final model = LandscapeModel(agent); - - var applied = false; - when(agent.applyLandscapeConfig(any)).thenAnswer((_) async { - applied = true; - return LandscapeSource()..ensureUser(); - }); - - final app = buildApp(model); - await tester.pumpWidget(app); - final context = tester.element(find.byType(LandingPage)); - final lang = AppLocalizations.of(context); - - final selfHosted = find.ancestor( - of: find.text(lang.landscapeQuickSetupSelfHosted), - matching: find.byType(YaruSelectableContainer), - ); - await tester.tap(selfHosted); - await tester.pump(); final fqdnInput = find.ancestor( of: find.text(lang.landscapeFQDNLabel), matching: find.byType(TextField), ); - final continueButton = find.button(lang.buttonNext); + final continueButton = find.button(lang.landscapeRegister); - // expect false since FQDN cannot be landscapeSaas for the self-hosted subform. - await tester.enterText(fqdnInput, landscapeSaas); + await tester.enterText(fqdnInput, '::'); await tester.pump(); await tester.tap(continueButton); expect(applied, isFalse); - await tester.enterText(fqdnInput, 'test.l.com'); - await tester.pump(); - - await tester.tap(find.text(lang.landscapeFilePicker)); - await tester.pumpAndSettle(); - - final fileInput = find.ancestor( - of: find.text(caCert), - matching: find.byType(TextField), - ); - expect(fileInput, findsOne); - - await tester.tap(fileInput); - await tester.pump(); - - await tester.enterText(fileInput, clientCert); + await tester.enterText(fqdnInput, 'landscape.canonical.com'); await tester.pump(); - await tester.tap(continueButton); await tester.pump(); expect(applied, isTrue); }); + // testWidgets('self-hosted', (tester) async { + // final agent = MockAgentApiClient(); + // final model = LandscapeModel(agent); + + // var applied = false; + // when(agent.applyLandscapeConfig(any)).thenAnswer((_) async { + // applied = true; + // return LandscapeSource()..ensureUser(); + // }); + + // final app = buildApp(model); + // await tester.pumpWidget(app); + // final context = tester.element(find.byType(LandingPage)); + // final lang = AppLocalizations.of(context); + + // final selfHosted = find.ancestor( + // of: find.text(lang.landscapeQuickSetupSelfHosted), + // matching: find.byType(YaruSelectableContainer), + // ); + // await tester.tap(selfHosted); + // await tester.pump(); + // final fqdnInput = find.ancestor( + // of: find.text(lang.landscapeFQDNLabel), + // matching: find.byType(TextField), + // ); + // final continueButton = find.button(lang.buttonNext); + + // // expect false since FQDN cannot be landscapeSaas for the self-hosted subform. + // await tester.enterText(fqdnInput, landscapeSaas); + // await tester.pump(); + // await tester.tap(continueButton); + // expect(applied, isFalse); + + // await tester.enterText(fqdnInput, 'test.l.com'); + // await tester.pump(); + + // await tester.tap(find.text(lang.landscapeFilePicker)); + // await tester.pumpAndSettle(); + + // final fileInput = find.ancestor( + // of: find.text(caCert), + // matching: find.byType(TextField), + // ); + // expect(fileInput, findsOne); + + // await tester.tap(fileInput); + // await tester.pump(); + + // await tester.enterText(fileInput, clientCert); + // await tester.pump(); + + // await tester.tap(continueButton); + // await tester.pump(); + // expect(applied, isTrue); + // }); + testWidgets('custom config', (tester) async { final client = MockAgentApiClient(); @@ -198,14 +194,10 @@ void main() { final model = LandscapeModel(client); final app = buildApp(model); await tester.pumpWidget(app); - final context = tester.element(find.byType(LandingPage)); + final context = tester.element(find.byType(ColumnPage)); final lang = AppLocalizations.of(context); - final customRadio = find.ancestor( - of: find.text(lang.landscapeCustomSetup), - matching: find.byType(YaruSelectableContainer), - ); - await tester.tap(customRadio); + await tester.tap(find.text(lang.landscapeSetupCustom)); await tester.pump(); final fileInput = find.ancestor( @@ -219,8 +211,8 @@ void main() { await tester.enterText(fileInput, customConf); await tester.pump(); - final continueButton = find.button(lang.buttonNext); - expect(tester.widget(continueButton).enabled, isTrue); + final continueButton = find.button(lang.landscapeRegister); + expect(tester.widget(continueButton).enabled, isTrue); expect(applied, isFalse); await tester.tap(continueButton); @@ -230,108 +222,101 @@ void main() { }); group('feedback on error', () { - testWidgets('saas', (tester) async { + testWidgets('manual', (tester) async { final model = LandscapeModel(MockAgentApiClient()); final app = buildApp(model); await tester.pumpWidget(app); - final context = tester.element(find.byType(LandingPage)); + final context = tester.element(find.byType(ColumnPage)); final lang = AppLocalizations.of(context); - final saasRadio = find.ancestor( - of: find.text(lang.landscapeQuickSetupSaas), - matching: find.byType(YaruSelectableContainer), - ); - await tester.tap(saasRadio); + await tester.tap(find.text(lang.landscapeSetupManual)); await tester.pump(); - final accountInput = find.ancestor( - of: find.text(lang.landscapeAccountNameLabel), + final fqdnInput = find.ancestor( + of: find.text(lang.landscapeFQDNLabel), matching: find.byType(TextField), ); - expect(accountInput, findsOne); + expect(fqdnInput, findsOne); - await tester.enterText(accountInput, standalone); + await tester.enterText(fqdnInput, '::'); await tester.pump(); - final errorText = find.text(lang.landscapeAccountNameError); + final errorText = find.text(lang.landscapeFQDNError); expect(errorText, findsOne); }); - testWidgets('self-hosted', (tester) async { - final model = LandscapeModel(MockAgentApiClient()); - final app = buildApp(model); - await tester.pumpWidget(app); - final context = tester.element(find.byType(LandingPage)); - final lang = AppLocalizations.of(context); + // testWidgets('self-hosted', (tester) async { + // final model = LandscapeModel(MockAgentApiClient()); - final selfHosted = find.ancestor( - of: find.text(lang.landscapeQuickSetupSelfHosted), - matching: find.byType(YaruSelectableContainer), - ); - await tester.tap(selfHosted); - await tester.pump(); + // final app = buildApp(model); + // await tester.pumpWidget(app); + // final context = tester.element(find.byType(LandingPage)); + // final lang = AppLocalizations.of(context); - final fqdnInput = find.ancestor( - of: find.text(lang.landscapeFQDNLabel), - matching: find.byType(TextField), - ); - expect(fqdnInput, findsOne); + // final selfHosted = find.ancestor( + // of: find.text(lang.landscapeQuickSetupSelfHosted), + // matching: find.byType(YaruSelectableContainer), + // ); + // await tester.tap(selfHosted); + // await tester.pump(); - await tester.enterText(fqdnInput, '::'); - await tester.pump(); + // final fqdnInput = find.ancestor( + // of: find.text(lang.landscapeFQDNLabel), + // matching: find.byType(TextField), + // ); + // expect(fqdnInput, findsOne); - final fqdnErrorText = find.text(lang.landscapeFQDNError); - expect(fqdnErrorText, findsOne); + // await tester.enterText(fqdnInput, '::'); + // await tester.pump(); - await tester.tap(find.text(lang.landscapeFilePicker)); - await tester.pumpAndSettle(); + // final fqdnErrorText = find.text(lang.landscapeFQDNError); + // expect(fqdnErrorText, findsOne); - final fileInput = find.ancestor( - of: find.text(lang.landscapeSSLKeyLabel), - matching: find.byType(TextField), - ); - expect(fileInput, findsOne); + // await tester.tap(find.text(lang.landscapeFilePicker)); + // await tester.pumpAndSettle(); - await tester.tap(fileInput); - await tester.pump(); + // final fileInput = find.ancestor( + // of: find.text(lang.landscapeSSLKeyLabel), + // matching: find.byType(TextField), + // ); + // expect(fileInput, findsOne); - await tester.enterText(fileInput, notFoundPath); - await tester.pump(); + // await tester.tap(fileInput); + // await tester.pump(); - final fileErrorText = find.text(lang.landscapeFileNotFound); - expect(fileErrorText, findsOne); + // await tester.enterText(fileInput, notFoundPath); + // await tester.pump(); - await tester.enterText(fileInput, clientKey); - await tester.pump(); - expect(find.text(lang.landscapeFileInvalidFormat), findsOne); + // final fileErrorText = find.text(lang.landscapeFileNotFound); + // expect(fileErrorText, findsOne); - await tester.enterText(fileInput, notATextCert); - await tester.pump(); - expect(find.text(lang.landscapeFileInvalidFormat), findsOne); + // await tester.enterText(fileInput, clientKey); + // await tester.pump(); + // expect(find.text(lang.landscapeFileInvalidFormat), findsOne); - await tester.enterText(fileInput, notABinCert); - await tester.pump(); - expect(find.text(lang.landscapeFileInvalidFormat), findsOne); + // await tester.enterText(fileInput, notATextCert); + // await tester.pump(); + // expect(find.text(lang.landscapeFileInvalidFormat), findsOne); - await tester.enterText(fileInput, binaryCert); - await tester.pump(); - expect(find.text(lang.landscapeFileInvalidFormat), findsNothing); - }); + // await tester.enterText(fileInput, notABinCert); + // await tester.pump(); + // expect(find.text(lang.landscapeFileInvalidFormat), findsOne); + + // await tester.enterText(fileInput, binaryCert); + // await tester.pump(); + // expect(find.text(lang.landscapeFileInvalidFormat), findsNothing); + // }); testWidgets('custom config', (tester) async { final model = LandscapeModel(MockAgentApiClient()); final app = buildApp(model); await tester.pumpWidget(app); - final context = tester.element(find.byType(LandingPage)); + final context = tester.element(find.byType(ColumnPage)); final lang = AppLocalizations.of(context); - final customRadio = find.ancestor( - of: find.text(lang.landscapeCustomSetup), - matching: find.byType(YaruSelectableContainer), - ); - await tester.tap(customRadio); + await tester.tap(find.text(lang.landscapeSetupCustom)); await tester.pump(); final fileInput = find.ancestor( of: find.text(lang.landscapeFileLabel), @@ -357,26 +342,22 @@ void main() { final app = buildApp(model); await tester.pumpWidget(app); - final context = tester.element(find.byType(LandingPage)); + final context = tester.element(find.byType(ColumnPage)); final lang = AppLocalizations.of(context); - final saasRadio = find.ancestor( - of: find.text(lang.landscapeQuickSetupSaas), - matching: find.byType(YaruSelectableContainer), - ); - await tester.tap(saasRadio); + await tester.tap(find.text(lang.landscapeSetupManual)); await tester.pump(); - final accountInput = find.ancestor( - of: find.text(lang.landscapeAccountNameLabel), + final fqdnInput = find.ancestor( + of: find.text(lang.landscapeFQDNLabel), matching: find.byType(TextField), ); - expect(accountInput, findsOne); - await tester.tap(accountInput); + expect(fqdnInput, findsOne); + await tester.tap(fqdnInput); await tester.pump(); - await tester.enterText(accountInput, 'testaccount'); + await tester.enterText(fqdnInput, 'landscape.canonical.com'); await tester.pump(); - final next = find.button(lang.buttonNext); + final next = find.button(lang.landscapeRegister); await tester.tap(next); await tester.pump(); final snack = find.descendant(