Skip to content

Commit 5c2c485

Browse files
authored
fix: Update dependencies and tests for Summer'25 release (#313)
1 parent cff1b89 commit 5c2c485

File tree

11 files changed

+78
-46
lines changed

11 files changed

+78
-46
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This repository contains examples of how to test the Salesforce UI using the [UT
99
> These recipes are designed to work with a generic Salesforce org. If your org has customizations, you might need to modify page objects or tests locally to avoid errors.
1010
1111
> [!IMPORTANT]
12-
> __This repository's page objects and UI tests are compatible with the Salesforce Spring'24 release.__
12+
> __This repository's page objects and UI tests are compatible with the Salesforce Summer'25 release.__
1313
1414
## Project structure
1515

@@ -190,13 +190,13 @@ Follow the steps in the [Quick Start: Lightning Web Components](https://trailhea
190190
1. If you haven't already done so, authorize your hub org and provide it with an alias (**myhuborg** in the command below). Use the login credentials generated from your Trailhead Playground in the Prerequisites section above or your own Developer Edition org if you prefer:
191191
192192
```sh
193-
$ sfdx auth:web:login -d -a myhuborg
193+
$ sf org login web --alias myhuborg
194194
```
195195
196196
2. Create a scratch org and provide it with an alias (**utam-js-recipes** in the command below):
197197
198198
```sh
199-
$ sfdx force:org:create -s -f config/project-scratch-def.json -a utam-js-recipes
199+
$ sf org create scratch -f config/project-scratch-def.json -a utam-js-recipes -o myhuborg
200200
```
201201
202202
> [!NOTE]
@@ -213,13 +213,13 @@ Follow the steps in the [Quick Start: Lightning Web Components](https://trailhea
213213
3. Push the app to your scratch org:
214214
215215
```sh
216-
$ sfdx force:source:push
216+
$ sf project deploy start -o myhuborg
217217
```
218218
219219
4. Assign the **utam** permission set to the default user:
220220
221221
```sh
222-
$ sfdx force:user:permset:assign -n utam
222+
$ sf org assign permset -o myhuborg -n utam
223223
```
224224
225225
> [!NOTE]
@@ -228,13 +228,13 @@ Follow the steps in the [Quick Start: Lightning Web Components](https://trailhea
228228
5. Open the scratch org:
229229
230230
```sh
231-
$ sfdx force:org:open
231+
$ sf force source open -o myhuborg
232232
```
233233
234234
If you need to recreate a scratch org:
235235
236-
- find created org `sfdx force:org:list --all`
237-
- delete previously created org with `sfdx force:org:delete`. It will prompt you to delete the org from the list, or specify an org alias or email `sfdx force:org:delete -u utam-js-recipes`
236+
- find created org `sf org list --all`
237+
- delete previously created org with `sfdx force:org:delete`. It will prompt you to delete the org from the list, or specify an org alias or email `sf org delete -u utam-js-recipes`
238238
- recreate scratch orgs (repeat steps starting from step 3)
239239
240240
## Running UI tests

force-app/test/app-navigation.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
// yarn test --spec force-app/test/app-navigation.spec.js
1010

1111
import ApplicationHome from 'salesforce-pageobjects/navex/pageObjects/desktopLayoutContainer';
12-
import { login } from './utilities/salesforce-test';
13-
import { TestEnvironment } from './utilities/test-environment';
12+
import { login } from './utilities/salesforce-test.js';
13+
import { TestEnvironment } from './utilities/test-environment.js';
1414

1515
// TODO: replace with prefix of the environment from .env file
1616
const TEST_ENVIRONMENT_PREFIX = 'na44';

force-app/test/record-all-items.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
// to run:
99
// yarn test --spec force-app/test/record-all-items.spec.js
1010

11-
import { RecordType } from './utilities/record-type';
12-
import { login, openRecordModal } from './utilities/salesforce-test';
13-
import { TestEnvironment } from './utilities/test-environment';
11+
import { RecordType } from './utilities/record-type.js';
12+
import { login, openRecordModal } from './utilities/salesforce-test.js';
13+
import { TestEnvironment } from './utilities/test-environment.js';
1414

1515
// TODO: replace with prefix of the environment from .env file
1616
const TEST_ENVIRONMENT_PREFIX = 'na44';

force-app/test/record-create.spec.js

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
// yarn test --spec force-app/test/record-create.spec.js
1010

1111
import RecordHomeFlexipage2 from 'salesforce-pageobjects/global/pageObjects/recordHomeFlexipage2';
12-
import { RecordType } from './utilities/record-type';
13-
import { login, openRecordModal } from './utilities/salesforce-test';
14-
import { TestEnvironment } from './utilities/test-environment';
12+
import { RecordType } from './utilities/record-type.js';
13+
import { login, openRecordModal } from './utilities/salesforce-test.js';
14+
import { TestEnvironment } from './utilities/test-environment.js';
1515
import RecordActionWrapper from 'salesforce-pageobjects/global/pageObjects/recordActionWrapper';
16+
import InputStageName from 'salesforce-pageobjects/sfa/pageObjects/inputStageName';
1617

1718
// TODO: replace with prefix of the environment from .env file
1819
const TEST_ENVIRONMENT_PREFIX = 'na44';
@@ -42,7 +43,9 @@ describe('Record creation tests', () => {
4243
const recordLayout = await recordForm.getRecordLayout();
4344

4445
console.log('Access record form item by index');
45-
const item = await recordLayout.getItem(1, 2, 1);
46+
const section = await recordLayout.getSection(1);
47+
const row = await section.getRow(2);
48+
const item = await row.getItem(1);
4649

4750
console.log('Enter account name');
4851
const accountName = 'Utam';
@@ -64,30 +67,40 @@ describe('Record creation tests', () => {
6467
const recordLayout = await recordForm.getRecordLayout();
6568

6669
console.log("Enter 'Close date' as 01/01/2020");
67-
const closeDateItem = await recordLayout.getItem(1, 2, 2);
70+
const section = await recordLayout.getSection(1);
71+
const dateRow = await section.getRow(2);
72+
const closeDateItem = await dateRow.getItem(2);
6873
const datePicker = await closeDateItem.getDatepicker();
6974
await datePicker.setDateText('01/01/2020');
7075

7176
console.log("Pick first option in a 'Stage' combobox");
72-
const stageItem = await recordLayout.getItem(1, 4, 2);
73-
const stageCombobox = await (await stageItem.getStageNamePicklist()).getBaseCombobox();
77+
const stageRow = await section.getRow(4);
78+
const stageItem = await stageRow.getItem(2);
79+
const inputStageNameField = await stageItem.getInputField(InputStageName);
80+
const stagePicklist = await inputStageNameField.getRecordPicklist();
81+
const basePicklist = await stagePicklist.getBasePicklist();
82+
const stageCombobox = await basePicklist.getBaseCombobox();
7483
await utam.waitFor(
7584
async () => {
76-
await stageCombobox.expandForDisabledInput();
77-
await stageCombobox.pickItem(2);
85+
await stageCombobox?.expandForDisabledInput();
86+
await stageCombobox?.pickItem(2);
7887
return true;
7988
},
8089
{ message: 'cant pick opportunity name' },
8190
);
8291

8392
console.log('Find and pick first account, link it to the opportunity');
84-
const accountLookupItem = await recordLayout.getItem(1, 4, 1);
93+
const accountLookupSection = await recordLayout.getSection(1);
94+
const accountLookupRow = await accountLookupSection.getRow(4);
95+
const accountLookupItem = await accountLookupRow.getItem(1);
8596
const accountLookup = await (await accountLookupItem.getLookup()).getBaseCombobox();
8697
await accountLookup.expand();
8798
await accountLookup.pickItem(1);
8899

89100
console.log('Enter opportunity name');
90-
const nameItem = await recordLayout.getItem(1, 3, 1);
101+
const nameSection = await recordLayout.getSection(1);
102+
const nameRow = await nameSection.getRow(3);
103+
const nameItem = await nameRow.getItem(1);
91104
const nameInput = await nameItem.getTextInput();
92105
await nameInput.setText('Opportunity name');
93106

force-app/test/record-update.spec.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
import RecordHomeFlexipage2 from 'salesforce-pageobjects/global/pageObjects/recordHomeFlexipage2';
1212
import RecordActionWrapper from 'salesforce-pageobjects/global/pageObjects/recordActionWrapper';
1313
import Tab2 from 'salesforce-pageobjects/flexipage/pageObjects/tab2';
14-
import { RecordType } from './utilities/record-type';
15-
import { login } from './utilities/salesforce-test';
16-
import { TestEnvironment } from './utilities/test-environment';
14+
import { RecordType } from './utilities/record-type.js';
15+
import { login } from './utilities/salesforce-test.js';
16+
import { TestEnvironment } from './utilities/test-environment.js';
1717

1818
// TODO: replace with prefix of the environment from .env file
1919
const TEST_ENVIRONMENT_PREFIX = 'na44';
@@ -64,7 +64,9 @@ describe('Record update test', () => {
6464
const recordLayout = await recordForm.getRecordLayout();
6565

6666
console.log('Access record form item by index');
67-
const item = await recordLayout.getItem(1, 2, 1);
67+
const section = await recordLayout.getSection(1);
68+
const row = await section.getRow(2);
69+
const item = await row.getItem(1);
6870

6971
console.log('Enter updated account name');
7072
const accountName = 'Utam';
@@ -98,7 +100,9 @@ describe('Record update test', () => {
98100
let recordLayout = await baseRecordForm.getRecordLayout();
99101

100102
console.log('Access Name field on Details panel');
101-
let nameItem = await recordLayout.getItem(1, 2, 1);
103+
let section = await recordLayout.getSection(1);
104+
let row = await section.getRow(2);
105+
let nameItem = await row.getItem(1);
102106
console.log('Remember value of the name field');
103107
let formattedName = await nameItem.getFormattedName();
104108
const nameString = await formattedName.getInnerText();
@@ -120,7 +124,9 @@ describe('Record update test', () => {
120124

121125
const reloaded = await gotToRecordDetailsTab();
122126
recordLayout = await reloaded.getRecordLayout();
123-
nameItem = await recordLayout.getItem(1, 2, 1);
127+
section = await recordLayout.getSection(1);
128+
row = await section.getRow(2);
129+
nameItem = await row.getItem(1);
124130

125131
console.log('Wait for field to be updated');
126132
await nameItem.waitForOutputField();

force-app/test/sfdx-scratch-org.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
// to run:
99
// yarn test --spec force-app/test/sfdx-scratch-org.spec.js
1010

11-
import Hello from '../../pageObjects/hello';
12-
import HomePage from '../../pageObjects/homePage';
13-
import WireGetObjectInfo from '../../pageObjects/wireGetObjectInfo';
14-
import { TestEnvironment } from './utilities/test-environment';
11+
import Hello from '../../pageObjects/hello.js';
12+
import HomePage from '../../pageObjects/homePage.js';
13+
import WireGetObjectInfo from '../../pageObjects/wireGetObjectInfo.js';
14+
import { TestEnvironment } from './utilities/test-environment.js';
1515

1616
describe('Scratch Org Tests', () => {
1717
const testEnvironment = new TestEnvironment('scratchOrg');

force-app/test/utilities/salesforce-test.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*/
77

88
import Login from 'salesforce-pageobjects/helpers/pageObjects/login';
9-
import ConsoleObjectHome from 'salesforce-pageobjects/global/pageObjects/consoleObjectHome';
109
import RecordActionWrapper from 'salesforce-pageobjects/global/pageObjects/recordActionWrapper';
10+
import ObjectHome from 'salesforce-pageobjects/lists/pageObjects/objectHome';
1111

1212
/**
1313
* Helper function used in crud tests to login in STMFA environment
@@ -38,12 +38,16 @@ export async function openRecordModal(baseUrl, recordType) {
3838
console.log(`Navigate to an Object Home for ${recordType.name}`);
3939
await browser.navigateTo(recordType.getObjectHomeUrl(baseUrl));
4040
console.log(`Load ${recordType.name} Object Home page`);
41-
const objectHome = await utam.load(ConsoleObjectHome);
42-
const listView = await objectHome.getListView();
41+
const objectHome = await utam.load(ObjectHome);
42+
await objectHome.waitFor(async () => (await objectHome.getListViewManager()).isPresent());
43+
const listViewManager = await objectHome.getListViewManager();
44+
await listViewManager.waitFor(async () => (await listViewManager.getCommonListInternal()).isPresent());
45+
const listView = await listViewManager.getCommonListInternal();
4346
const listViewHeader = await listView.getHeader();
4447

4548
console.log("List view header: click button 'New'");
46-
const actionLink = await listViewHeader.waitForAction('New');
49+
const actionsContainer = await listViewHeader.getAuraActionsContainer();
50+
const actionLink = await actionsContainer.getActionLink('New');
4751
await actionLink.click();
4852

4953
console.log('Load Record Form Modal');

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"isbinaryfile": "^5.0.0",
4545
"lint-staged": "^15.2.2",
4646
"prettier": "3.1.1",
47-
"salesforce-pageobjects": "^8.0.0",
47+
"salesforce-pageobjects": "^10.0.2",
4848
"wdio-utam-service": "^3.2.2"
4949
},
5050
"volta": {

scripts/generate-login-url.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function getUpdatedEnvFile(filePath, url, timestamp) {
3838
* @returns {Promise<string>} the scratch org url fetched from the getUrlCmd
3939
*/
4040
async function getScratchOrgLoginUrl() {
41-
const getUrlCmd = 'sfdx force:org:open -p /lightning -r --json';
41+
const getUrlCmd = 'sfdx org open -p /lightning -r --json';
4242
console.log('Executing the following command: ', getUrlCmd);
4343
const { stderr, stdout } = await exec(getUrlCmd, { cwd: __dirname });
4444
if (stderr) throw new Error(stderr);

wdio.conf.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,16 @@ exports.config = {
2121
{
2222
maxInstances: 1,
2323
browserName: 'chrome',
24-
browserVersion: '120.0.6099.62',
24+
browserVersion: '139.0.7258.67',
25+
'goog:chromeOptions': {
26+
args: [
27+
'--no-sandbox',
28+
'--disable-dev-shm-usage',
29+
'--disable-gpu',
30+
'--disable-web-security',
31+
'--disable-features=VizDisplayCompositor',
32+
],
33+
},
2534
},
2635
],
2736
logLevel: 'debug',

0 commit comments

Comments
 (0)