Skip to content

Commit

Permalink
mocha_test.js - update to modern syntax (#697)
Browse files Browse the repository at this point in the history
This is a companion change to mdn/content#31050
  • Loading branch information
hamishwillee authored Dec 18, 2023
1 parent 558306e commit 6b96087
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions tools-testing/cross-browser-testing/selenium/mocha_test.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
'use strict';
"use strict";

const assert = require('assert');
const assert = require("assert");

let webdriver = require('selenium-webdriver'),
By = webdriver.By,
until = webdriver.until;
const { Builder, Capabilities, By } = require("selenium-webdriver");

describe('Alert', () => {
it('should have the correct text content - this is from the first button', done => {
let driver = new webdriver.Builder()
.withCapabilities(webdriver.Capabilities.firefox())
.build();
describe("Alert", () => {
it("should have the correct text content - this is from the first button", (done) => {
let driver = new Builder()
.withCapabilities(Capabilities.firefox())
.build();

driver.get('http://mdn.github.io/learning-area/tools-testing/cross-browser-testing/accessibility/native-keyboard-accessibility.html')
.then(() => driver.findElement(By.css('button:nth-of-type(1)')))
.then(button => button.click())
.then(() => driver.switchTo().alert())
.then(alert => alert.getText())
.then(text => assert.equal(text, 'This is from the first button'))
.then(() => driver.quit())
.then(done)
.catch(err => done(err));
driver
.get(
"http://mdn.github.io/learning-area/tools-testing/cross-browser-testing/accessibility/native-keyboard-accessibility.html"
)
.then(() => driver.findElement(By.css("button:nth-of-type(1)")))
.then((button) => button.click())
.then(() => driver.switchTo().alert())
.then((alert) => alert.getText())
.then((text) => assert.equal(text, "This is from the first button"))
.then(() => driver.quit())
.then(done)
.catch((err) => done(err));
});
});

0 comments on commit 6b96087

Please sign in to comment.