-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Playwright: Create a New Collection and Validate Rejection of Duplicate Collection Creation. #4691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
} | ||
|
||
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'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Please make sure we use a dynamic path that will work on any system/environment
- Please use camelCase naming pattern for variables for consistency
const { execSync } = require('child_process'); | ||
|
||
|
||
|
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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()}`; |
There was a problem hiding this comment.
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
Description
Contribution Checklist:
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