Skip to content

Conversation

@ved-bruno
Copy link
Collaborator

@ved-bruno ved-bruno commented May 16, 2025

Description

Contribution Checklist:

  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

Jira: BRU-1037

}

test('Create a New Collection and Verify the Duplicate Collection Creation Should Not be Allowed', async ({ page }) => {
const collection_location = '/Users/vedpr/Documents/bruno_tests';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Please make sure we use a dynamic path that will work on any system/environment
  2. Please use camelCase naming pattern for variables for consistency

const { execSync } = require('child_process');



Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove unnecessary line breaks. Keep just one line break here

await page.getByLabel('Location').fill(await collection_location);
await page.getByRole('button', { name: 'Create', exact: true }).click();

//await page.pause();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove unwanted commented codes

await page.getByLabel('Name').press('Tab');
await page.getByLabel('Location').fill(collection_location);
await page.getByRole('button', { name: 'Create', exact: true }).click();
await expect(page.getByText('An error occurred while')).toBeVisible();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a line break between assertions and page interactions.
I think it makes more sense and readable if we can put the portion of error message which states duplicate collection or collection already exists

const collection_location = '/Users/vedpr/Documents/bruno_tests';
const collectionName = generateRandomCollectionName();
// ------------code from playwright------------ //
await page.getByRole('img').first().click();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to start adding reliable element hooks or use ids so the tests wont fail when new elements are added to the page

const randomWord = () => Math.random().toString(36).substring(2, 6);
const adj = adjectives[Math.floor(Math.random() * adjectives.length)];
const noun = nouns[Math.floor(Math.random() * nouns.length)];
return `${adj}-${noun}-${randomWord()}`;
Copy link
Contributor

@maintainer-bruno maintainer-bruno May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a line break above return statement for better readability.
Can we use faker-js instead of custom logic?

@helloanoop
Copy link
Contributor

Closing this as this was covered in #4694

@helloanoop helloanoop closed this Sep 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants