Skip to content

Commit

Permalink
Update seed and test for 'Update profile'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sital999 committed Nov 18, 2024
1 parent d1cf13b commit fc78a9d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
42 changes: 16 additions & 26 deletions integration_test/lib/pages/representativesPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@ import { Page, expect } from '@playwright/test';

const representativeUpdatedToast = 'User info updated!';
export default class RepresentativesPage {
readonly updateDelegateBtn = this.page.getByTestId(
'edit-representative-info-2'
);
readonly saveDelegateInfoBtn = this.page.getByTestId(
'save-representative-info-2'
);
readonly updateAlternateBtn = this.page.getByTestId(
'edit-representative-info-3'
);
readonly saveAlternateBtn = this.page.getByTestId(
'save-representative-info-3'
);
readonly transferVotingPowerBtn = this.page.getByTestId(
'edit-active-voter-1'
);
Expand All @@ -32,23 +20,25 @@ export default class RepresentativesPage {
email: string,
stake_address: string
): Promise<void> {
// await this.goto();
// await this.page
// .locator('[data-testid^="edit-representative-info-"]')
// .first()
// .click();
// await this.page.getByRole('textbox').nth(0).fill(name);
// await this.page.getByRole('textbox').nth(1).fill(email);
// await this.page
// .locator('[data-testid^="save-representative-info-"]')
// .first()
// .click();
await this.goto();
await this.updateDelegateBtn.click();
await this.page.getByRole('textbox').nth(0).fill(name);
await this.page
.getByRole('row')
.filter({
has: this.page.getByRole('gridcell', {
name: 'Editable TestUser',
}),
})
.locator('[data-testid^="edit-representative-info-"]')
.click();
await this.page
.getByRole('textbox')
.nth(0)
.fill('Editable TestUser' + name);
await this.page.getByRole('textbox').nth(1).fill(email);
await this.page.getByRole('textbox').nth(2).fill(stake_address);
await this.saveDelegateInfoBtn.click({ force: true });
await this.page
.locator('[data-testid^="save-representative-info-"]')
.click({ force: true });
}

async isRepresentativeUpdated(infos: Array<string>): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,13 @@ test.describe('User Control', () => {
page,
pollId,
}) => {
const name = faker.person.fullName();
const name = faker.person.lastName();
const email = name.split(' ')[0] + '@email.com';
const stake_address = faker.person.jobArea();
const represntativePage = new RepresentativesPage(page);
await represntativePage.updateUserProfile(name, email, stake_address);
await represntativePage.isRepresentativeUpdated([
name,
'Editable TestUser' + name,
email,
stake_address,
]);
Expand Down
10 changes: 10 additions & 0 deletions prisma/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,16 @@ const users = [
wallet_address:
'stake_test1uz8nudr07gyltqapgzvx9avyxcwp3cxnnlmgfd35px5jfgcq2hezv',
},
{
is_convention_organizer: false,
is_delegate: false,
is_alternate: true,
workshop_id: BigInt(6),
name: 'Editable TestUser',
email: '[email protected]',
wallet_address:
'stake_test1uz8nudr07gyltqapgzvx9avyxcwp3cxnnlmgfd35px8jfgcq2hezp',
},
];

const workshopInfo = [
Expand Down

0 comments on commit fc78a9d

Please sign in to comment.