Skip to content

Commit

Permalink
Update swap test to handle the details modal
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelSalas committed Sep 4, 2024
1 parent eea663e commit d423fa7
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 13 deletions.
26 changes: 15 additions & 11 deletions e2e/specs/swaps/swap-action-regression.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,25 +110,29 @@ describe(Regression('Multiple Swaps from Actions'), () => {
await Assertions.checkIfVisible(
ActivitiesView.swapActivity(sourceTokenSymbol, destTokenSymbol),
);
await TestHelpers.delay(5000);
await ActivitiesView.tapOnSwapActivity(
sourceTokenSymbol,
destTokenSymbol,
);

if (device.getPlatform() === 'android') {
try {
await Assertions.checkIfVisible(DetailsModal.title);
await Assertions.checkIfElementToHaveText(
DetailsModal.title,
DetailsModal.generateExpectedTitle(
sourceTokenSymbol,
destTokenSymbol,
),
} catch (e) {
await ActivitiesView.tapOnSwapActivity(
sourceTokenSymbol,
destTokenSymbol,
);
await Assertions.checkIfVisible(DetailsModal.statusConfirmed);
await DetailsModal.tapOnCloseIcon();
await Assertions.checkIfNotVisible(DetailsModal.title);
await Assertions.checkIfVisible(DetailsModal.title);
}

await Assertions.checkIfVisible(DetailsModal.title);
await Assertions.checkIfElementToHaveText(
DetailsModal.title,
DetailsModal.generateExpectedTitle(sourceTokenSymbol, destTokenSymbol),
);
await Assertions.checkIfVisible(DetailsModal.statusConfirmed);
await DetailsModal.tapOnCloseIcon();
await Assertions.checkIfNotVisible(DetailsModal.title);
},
);
});
12 changes: 10 additions & 2 deletions e2e/specs/swaps/swap-action-smoke.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,20 @@ describe(SmokeSwaps('Swap from Actions'), () => {
await Assertions.checkIfVisible(
ActivitiesView.swapActivity(sourceTokenSymbol, destTokenSymbol),
);
await TestHelpers.delay(5000);
await ActivitiesView.tapOnSwapActivity(
sourceTokenSymbol,
destTokenSymbol,
);
await Assertions.checkIfVisible(DetailsModal.title);

try {
await Assertions.checkIfVisible(DetailsModal.title);
} catch (e) {
await ActivitiesView.tapOnSwapActivity(
sourceTokenSymbol,
destTokenSymbol,
);
await Assertions.checkIfVisible(DetailsModal.title);
}
await Assertions.checkIfElementToHaveText(
DetailsModal.title,
DetailsModal.generateExpectedTitle(sourceTokenSymbol, destTokenSymbol),
Expand Down
23 changes: 23 additions & 0 deletions e2e/specs/swaps/swap-token-chart.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import FixtureServer from '../../fixtures/fixture-server';
import { getFixturesServerPort } from '../../fixtures/utils';
import { Regression } from '../../tags';
import Assertions from '../../utils/Assertions';
import ActivitiesView from "../../pages/ActivitiesView";

Check failure on line 21 in e2e/specs/swaps/swap-token-chart.spec.js

View workflow job for this annotation

GitHub Actions / scripts (lint)

Replace `"../../pages/ActivitiesView"` with `'../../pages/ActivitiesView'`

Check failure on line 21 in e2e/specs/swaps/swap-token-chart.spec.js

View workflow job for this annotation

GitHub Actions / scripts (lint)

Strings must use singlequote
import DetailsModal from "../../pages/modals/DetailsModal";

Check failure on line 22 in e2e/specs/swaps/swap-token-chart.spec.js

View workflow job for this annotation

GitHub Actions / scripts (lint)

Replace `"../../pages/modals/DetailsModal"` with `'../../pages/modals/DetailsModal'`

Check failure on line 22 in e2e/specs/swaps/swap-token-chart.spec.js

View workflow job for this annotation

GitHub Actions / scripts (lint)

Strings must use singlequote

const fixtureServer = new FixtureServer();

Expand Down Expand Up @@ -81,5 +83,26 @@ describe(Regression('Swap from Token view'), () => {
console.log(`Toast message is slow to appear or did not appear: ${e}`);
}
await device.enableSynchronization();
await TestHelpers.delay(5000);
await TabBarComponent.tapActivity();
await Assertions.checkIfVisible(ActivitiesView.title);
await Assertions.checkIfVisible(ActivitiesView.swapActivity('LINK', 'DAI'));
await ActivitiesView.tapOnSwapActivity('LINK', 'DAI');

try {
await Assertions.checkIfVisible(DetailsModal.title);
} catch (e) {
await ActivitiesView.tapOnSwapActivity('LINK', 'DAI');
await Assertions.checkIfVisible(DetailsModal.title);
}

await Assertions.checkIfVisible(DetailsModal.title);
await Assertions.checkIfElementToHaveText(
DetailsModal.title,
DetailsModal.generateExpectedTitle('LINK', 'DAI'),
);
await Assertions.checkIfVisible(DetailsModal.statusConfirmed);
await DetailsModal.tapOnCloseIcon();
await Assertions.checkIfNotVisible(DetailsModal.title);
});
});

0 comments on commit d423fa7

Please sign in to comment.